Subject: RE: [hackers-il] World Domination with MS - Rev. 2

From: Chen Shapira <[email-masked]>
Date: Thu, 18 Apr 2002 10:44:48 +0200

>     1. The Win32 API is overly complicated and verbose. How many
>        programmers would prefer to call [2]CreateFile with 7 
> arguments,
>        over fopen() with 2 or open() with 2 or 3, just to 
> open a file for
>        reading or writing? Or GlobalAlloc() followed by 
> GlobalLock() when
>        malloc() would do in POSIX?
>        Most programming courses and books that cover ANSI C teach the
>        ANSI C/POSIX functions. The reason is obvious, because 
> it is much
>        simpler to program in. And in Linux it maps 1 -> 1 to what the
>        kernel has to offer.

You are misrepresenting you facts here.

You can still use fopen and open in MS enviroment.
open has more than 2 or 3 parameters. The last one is an "infinite"
parameter.
O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_WRONLY and many more - all
those are hiding in the last parameter.

GlobalAlloc IIRC is deprecated since win 3.11 and kept to maintain
compatibility (as always).
It did something that malloc simply can't do: restrict/permit memory access.

Take a look at Linux functions for sharing memory between threads and
processes. It isn't nicer.

malloc, of course, was always availble to any C programmer.

>     2. There isn't a very clear separation between the GUI and the
>        non-GUI parts of the system. This makes it difficult to write
>        full-fledged non-GUI applications, and makes it harder 
> to automate
>        and administrate.

This is UI - a choice of the programmer/designer.
The API is very clear about GUI and non-GUI issues.

Most NT apps aren't automated through shell scripts and command lines.
Their COM objects and API's themselves are availble for scripting. I can
script IExplorer, OutLook, Word, etc. through VB - can you script Mozilla
from Perl?

>     3. Generally, understanding the internals of the 
> operating system is
>        much harder than in Linux or other UNIXes. Most 
> OS-design courses
>        focus on some flavour of UNIX, and only cover Windows 
> NT briefly.
>        Writing kernel device drivers is much more difficult 
> in NT, too.

Writing kernel devices in NT isn't more difficult. The only exception was
Networking - and it was fixed in XP.
The OS is more complicated, so it isn't fit for students of OS. So what?

>     4. Several versions of the same shared library cannot be kept at
>        once. Microsoft pulled some ugly tricks to make sure MFC uses
>        several versions (by renaming the DLLs "MFC40.DLL" and
>        "MFC42.DLL"). In UNIX, with symbolic links and all, 
> this problem
>        can be trivially solved.

IIRC a symbolic link can point to one library at a time. Sort of like
renaming?

>    The Win32 Graphical User-Interface (GUI) - the Win32 GUI 
> is much more
>    sub-standard in comparison to those common on Linux like 
> Gtk+ or Qt.
>    It has only one geometry manager - X-Y - and all others have to be
>    implemented in user-land. Communicating between two widgets (or
>    controls in Windows speak) requires passing obscure messages. The
>    Hello World application is itself very complicated and not legible.

Apples and Oranges.
Win32 should be compared to Motif. 
MFC and ATL are comparable to Gtk+.
Not to mention that I can use GTK+ on windows.

>    Complexity of Code-base - Microsoft is notorious for the 
> exceptionally
>    bad code its programs contain. Part of the reason is that requiring
>    the code to work on every version of Win32 where it is supposed to,
>    requires writing a large number of workarounds, which 
> makes the code
>    much uglier. Trying to remove those workarounds may bite you in
>    unexpected places.
>
>    In UNIX, a lot of open-source and proprietary software 
> build from the
>    same code-base for a large number of different flavours (much less
>    distributions) and architectures. That's because there is 
> usually no
>    need for workarounds and bugs in the underlying layers are 
> expected to
>    be fixed by their vendors.

I'm note sure what you are talking about. Care to explain this point?

>    The conclusion is clear: writing true Linux POSIX-fied applications
>    and APIs would actually be a very good thing for 
> Microsoft. Microsoft
>    can sell Linux applications and libraries while actually reducing
>    development costs and overhead considerably. So, the question being
>    asked is why Microsoft does not port its applications to run there.

No one can sell anything for Linux. Selling for Linux is a bad business
plan, since for some reason most Linux users perfer not to buy. The only
exception I see is Oracle.

Ex-Loki games may serve as a example. 

Also, porting Word to Linux may enable many people to switch to Linux. Why
would MS do that?
 
>    The reason is simple: it would require too much work and 
> will generate
>    a relatively small amount of revenue. Porting the Win32 API-based
>    software to run on Linux using a Win32 emulation-layer 
> (such as Wine)
>    would take a long time. Afterwards, abstracting everything 
> so that it
>    is a native Linux application would also take a long time. As a
>    general rule Microsoft does not re-write code from scratch, or
>    maintain two distinct code-bases of the same program. 
> (which is very
>    hard, even with the best source control and project management
>    software money can buy).

I disagree with your analysis here. Porting would be difficult, but won't
require either rewrite nor two distinctive codebases.

Also, MS does rewrite code from scratch. Rarely and carefully, but it does. 
 
>    Some people think that Microsoft wishes to control and 
> abuse everybody
>    else. But as a commercial public company, Microsoft's 
> chief intent is
>    to make money. I don't think controlling anything has 
> anything to do
>    with it. Microsoft would have become as big as it is now, 
> regardless
>    of how much abuse it does, because of the wise decisions of Bill
>    Gates' and its other managers. Microsoft can maintain its size and
>    strength even in a Linux and Open Source based world.

Can it really?

>    As far as I'm concerned, Linux has already achieved "World
>    Domination". It is not used as much as Windows, but a large part of
>    the people who use it and develop on it (including me) swear by it,
>    and won't abandon it for all the fortune in the world. Does being
>    successful means being dominant? I don't think it is, 
> especially not
>    if your products are free content ones, where usually one 
> gains little
>    commercial profit from "shipping" more.

Linux may be a successfull religion, but I think that it should be judged as
an OS and a tool, instead.
Which means that # of zealots and how fanatic are they isn't a good factor.
If 50% of your user base is under 18, you can expect many zealots.
But as a tool - is it really a success? Is Linux the best server I can find?
The best desktop system? I'm not so sure here.

>    Secondly, by fighting FUD, not with counter-FUD, but with 
> hard facts
>    and well-reasoned, well-phrased and objective opinions. Counter-FUD
>    just confuses the reader, and manipulating emotions is always a bad
>    thing.

I agree here! Please don't FUD API's you don't understand.
 
>    Thirdly, by making genuine effort to make Linux easier to use and
>    administrate for newbies. The term "user-friendly" is very hard to
>    realize, and even Bill Gates has [3]wisely mocked it. So it can be
>    assumed that it means "what the users are already used 
> to". Imitation
>    is the sincerest form of flattery.

The way open-source projects treat their UI designers, it'll be a cold day
in hell before Linux is easy to use.

A good place to start is to stop scream "show the code!" to UI designers.
They are designers - they show statistics and screen shots. If they wanted
to code they could be programmers.
Demanding that your designers should code, lowers the quality and quantity
of designers dramaticly. And UI designers are damn rare even if you pay for
them.

---

From: "Nadav Har'El" <[email-masked]>
Date: Thu, 18 Apr 2002 11:43:44 +0300

Chen, I think I agree to most of your analysis of how Windows is not as crappy
is it first appears (especially to the Linux fanatic ;)), though there is
one point that you missed (and I'm not sure how well Shlomi stressed it
in his article): both Linux and Windows can do anything (Turing-complete,
etc.), but the question in my opinion is just how naturally certain things
fit into the standard framework of each OS.

For example, in Linux (when using a shell, not one of the new GUIs which
basically try to immitate Windows and inherit most of its design faults)
once you know how to delete a single file, automating it and deleting
(say) every file whose name starts with "a" and ends with ".out" is almost
as easy. In Windows, 99% of the users will not be able to automate anything
with COM, because it is not a natural extension of how they usually work
(I think I already expanded on this quite a lot a while ago).

Another example, in Linux, remote system administration is just as easy
and natural (not more, and not less easy) as sitting on the console of
that machine. In fact, I know quite a few Linux machines that don't even
have a local keyboard or video card, and I manage a Linux server which I
only saw 3 times in the last 5 years. In Windows this might be possible,
but only if you purchase special software (or get something for free,
like VNC). And even then, you run into problems when applications are
all designed to "hog" the single display a Windows machine is "supposed"
to have, and two people can't log in at the same time. I bet there're
solutions to this problem too, but again it isn't a natural Windows
feature - both in the sense that it costs extra and in the sense it was
added later and probably isn't compatible with many applications.

There are converse examples too: If you want to play state-of-the-art games,
designed and written for Windows, you can probably do it on Linux too
(with VMware, Lindows, or whatever) but that would be an unnatural thing
to do on Linux. If all you care about is gaming, and especially titles
written for Windows, you'd be making a mistake if you insist on running
only Linux.

> exception I see is Oracle.

This is a silly argument: Windows users also don't like to buy anything.
Especially Israeli Windows users. Most people I know never bought a piece
of software in their life (except, perhaps, the OS they were forced to
buy with their computer).

If some (say) doctor paid $1000 for his appointment-management software
on Windows, he wouldn't mind paying the same $1000 for a Linux one, if
someone came and installed everything for him. He doesn't know how to use
either Windows or Linux anyway, and wouldn't know the difference between
them if his life depended on it :)

> Also, porting Word to Linux may enable many people to switch to Linux. Why

Two words: Sherman act.

> >    strength even in a Linux and Open Source based world.

Yes.
Do you think Microsoft can survive if split into two companies (a "Windows"
company and a "MS Applications" company)? If the answer is "yes" (and I
think it is), then you can continue the thought experiment considering
people stop buying Winodws, the Windows company goes bankrupt, but the
applications company continues to prosper.
As always, people will get their OS for free with their new computers,
but it would be Linux, not Windows. Who cares? Home users will continue
to copy Word illegally from friends, and business users will continue
to buy legal copies of Word - whether their OS is Windows, Apple's OS X,
or Linux.

> If 50% of your user base is under 18, you can expect many zealots.

Probably more than 50% of the Windows users are under 18 too. So?

> I agree here! Please don't FUD API's you don't understand.

Right.

> in hell before Linux is easy to use.

It will be a cold day in hell before Microsoft junkies realise the difference
between "easy to learn" and "relatively hard to learn, but easy to use once
you know how". Unix (and Linux) is the latter. Windows is the former. I
personally consider the latter more important for people who use a computer
as a primary tool in their job (not only programmers - also scientists, and
things like that).

People who only use one very specialized application on the computer (e.g.,
the doctor's appointment program in my previous example) don't care in what
OS it runs anyway - as long as the application itself is convenient.

-- 
Nadav Har'El                        |      Thursday, Apr 18 2002, 6 Iyyar 5762
[email-masked]             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |It is better to be thought a fool, then
http://nadav.harel.org.il           |to open your mouth and remove all doubt.

---

From: Shlomi Fish <[email-masked]>
Date: Thu, 18 Apr 2002 18:36:47 +0300 (IDT)

> You can still use fopen and open in MS enviroment.

Can IIS use them, then? Can Oracle or Apache? Apache tried using the C
RTL, but it caused all kinds of memory leaks, random crashes and weird
side-effects.

> those are hiding in the last parameter.

But remember that it is much easier to remember all those flags than the
_order_ of all the parameters in CreateFile, some of which are flag-based
too.

> compatibility (as always).

GlobalAlloc is in the Win32 standard. LocalAlloc is deprecated, and maps
directly to it.

> processes. It isn't nicer.

I think the Thread-Local-Storage has nothing to do with GlobalAlloc. As
for shared-memory - one will not use it 95% of the time. The point is that
GlobalAlloc is malloc in the Win32 API.

> malloc, of course, was always availble to any C programmer.

Again, at the cost of relaying ona not-too robust emulation layer.

> script IExplorer, OutLook, Word, etc. through VB - can you script Mozilla

No I can't. But I can create LWP scripts that will perform web operations
very easily. Mozilla is just a lot of User-Interface sugar above HTTP and
HTML, it is not meant to be scripted. But I believe Mozilla can be
scripted using C (and indirectly Perl too if someone writes Perl/XS
bindings) and JavaScript. However, the issue here if you can automatically
change the resolution (x*y*bitdepth) of all NT workstations in a network
using VB. Frankly, I have no idea how to do it without using GUI, but in
Linux it is pretty straightforward. (just an example)

> Networking - and it was fixed in XP.

Really? A friend of mine who did exactly that for the Israeli Air Force
told me that it was much more difficult than UNIX. Maybe it changed in NT
5.0 and XP, but I believe that was the state of the art a few years ago.

When I learned about Linux kernel programming I was amazed at the
simplicity in which one could implement char devices and block devices.
And one can communicate with them using any language that supported the
basic I/O operations well enough.

> The OS is more complicated, so it isn't fit for students of OS. So what?

More complicated for students of OS ==> More complicated for System
Programmers.

> IIRC a symbolic link can point to one library at a time. Sort of like

No. You can keep several versions of the same shared library at a time,
while using symbolic links to point to the most recent version for every
depth of version numbers. That way every application can use the version
of the library that it needs.

> MFC and ATL are comparable to Gtk+.

MFC is a 1 -> 1 mapping to the Win32 API. A bit more syntactic sugar.
Slightly more convenient. But still - pretty much the same crap. I was not
impressed with it, when I worked with it, and I used it a lot.

Does MFC have other geometry managers than X-Y? I don't remember seeing
them anywhere, and I actually run into a problem where I had to re-allign
my controls to accomodate for a different font Scheme.

MFC may not always be an option because of its large overhead.

> Not to mention that I can use GTK+ on windows.

And it will look Gtk+-ish exactly as it looks on UNIX. Gtk+ for Windows
uses the Windows GDI to draw and manage the Widgets, and does not make use
of Windows' inherent Widgetting capabilities. A Gtk+ button is an
emulation of a button, not a real Windows Button Control.

But assuming you use Qt or wxWindows - yes, you can do that. But I don't
think Microsoft does. And on Linux it can use Gtk+ without paying Troll
Tech or anyone else a dime, and:

1. Have a more powerful GUI library.
2. Get native-looking controls.

> I'm note sure what you are talking about. Care to explain this point?

Did you ever look into the source of an open-source application. As you
know, by running "./configure", "make" and "make install", one can compile
and install a properly written application everywhere. The UNIX API is
stable and reliable in a way that you don't need to write workarounds for
various bugs that you encountered in the system.

In Windows one often encounters a situation in which configuration A works
and configuration B which is slightly different crashes Win95 or Win98 or
ME or NT 4.0 or NT 5.0 or XP or any particular version or set of versions
of them. Everything under the hood is so poorly documented and complicated
that it is usually faster to write a workaround than to try and address
Microsoft about it. In UNIX, writing workarounds that just "make
things work" while not explaining why is usually unnecessary and
considered a Bad Thing.

> exception I see is Oracle.

I think that "Linux users won't pay for anything" is a myth. I agree that
it is possible to survive in Linux without paying a dime for anybody.
However, I believe several companies managed to generate revenue selling
commercial software on Linux. The problem, so far, IMO, had been that they
did not make it up to par with the Open-Source or Windows equivalents, or
as integrated with the underlying system as them.

> Also, porting Word to Linux may enable many people to switch to Linux. Why

Because it has much better things to do with ~ 1000 of its best
programmers than let them work on maintaining Windows... Maybe Windows
brings revenue to Microsoft, but I don't think it gives as much as other
divisions.

> require either rewrite nor two distinctive codebases.

I did not say it would. I described the methodology and then I said that
the alternative of rewriting and maintaining two different codebases was
not something that MS would normally consider.

> Also, MS does rewrite code from scratch. Rarely and carefully, but it does.

The _whole_ codebase from scratch? Why? When?

> >    strength even in a Linux and Open Source based world.

I don't see a reason that it cannot. And I'd rather not make a
fortune-teller error. MS can certainly survive for a while giving it time
to become accustomed with the new environment. If it can survive in the
long run - it's a different issue - but only time can tell.

Microsoft has a tendency to take one software paradigm (a spreadsheet, a
presentation manager, an IDE) and perfect it - investing a lot of time
making a consistent, easy to use if you are used to it, integrated,
feature-full product that has everything one wants. A company that follows
this paradigm, can survive on Linux, because it takes time for an O-S
product to reach this state, especially considering the fact that only so
much developers can work on it at a given time.

Lately we have seen a trend that Microsoft started to add redundant
features to their products, because they could not think of anything
better to add to them. But the products are still, or at least used to be,
very polished.

> The best desktop system? I'm not so sure here.

I am not a Linux zealot. I use Windows and use it a lot. But given the
choice, I would use Linux exclusively. I believe many people do not have
inherent dislike against proprietary software, yet would agree that Linux
is by far superior to the various Windows offerings. This is the case for
me.

I believe Linux with KDE is the best desktop system I have used yet. As a
server, it is definitely better than NT. Comparing it to other UNIXes is
more difficult because UNIXes tend to be very similar to one another and
to copy many concepts from one another. Still, even as a user, I find
surviving on Solaris or IRIX, much more difficult and I'm simply addicted
to the Linux-way of doing things.

The fact is that most UNIX gurus you can get off the street use Linux at
home. And usually, the power offered by today's i386 machines exceeds what
is needed for a mundane UNIX server. (usually the bottleneck is
bandwidth). And Linux is:

1. What most people are most used to.
2. Offers the most complete and feature-full tools.
3. The system where everything works most flawlessly.
4. The most commonly used system.
5. A very portable operating-system.
6. Very flexible.
7. Costs zero.
8. Very flexible package management and updating.

Maybe it's not the "best" in any way, but it is pretty damn "good". ;-)

> I agree here! Please don't FUD API's you don't understand.

I don't think what I did was FUD. And I do understand the Win32 API.

> in hell before Linux is easy to use.

Again - a generalization. And I think Linux is easy to use. But then
again, I'm not an average computer user.

> of designers dramaticly. And UI designers are damn rare even if you pay for

Agreed. I believe programmers can become good UI desigeners with some
effort. But I'm speaking in general guidelines rather than logistical
details. Do you oppose my guidelines?

Regards,

	Shlomi Fish

>
>
>
> To unsubscribe from this group, send an email to:
> [email-masked]
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>

----------------------------------------------------------------------
Shlomi Fish        [email-masked]
Home Page:         http://t2.technion.ac.il/~shlomif/
Home E-mail:       [email-masked]

"Let's suppose you have a table with 2^n cups..."
"Wait a second - is n a natural number?"