why Unix?

Steven Schveighoffer schveiguy at yahoo.com
Wed Apr 8 06:43:30 PDT 2009


On Wed, 08 Apr 2009 08:55:19 -0400, Yigal Chripun <yigal100 at gmail.com>  
wrote:

> On 08/04/2009 14:34, Steven Schveighoffer wrote:
>
>> My experience with WMI is that it is buggy and very slow, not to mention
>> really complicated. I would hate to rely on it for scripting. On the
>> other hand, having everything as a file allows me to use all existing
>> file processing tools to deal with anything on a UNIX system. The file
>> API is simple and doesn't require me to look at an object spec to do
>> simple tasks.
>
> well, WMI is supposed to be replaced and enhanced by powershell. So you  
> should check that out.
> I agree that a uniform and consistent API is important and I'm sure that  
> MS managed to mess that up :) but that's besides the point. "Everything  
> is a file" does not provide a uniform API but rather provides no API.

Sure it does, open, read, select, etc.  The API is all the same.  So you  
can use standard tools to work with all files, even dynamically generated  
ones.

> Each unix tool has its own mini-syntax and its own set of command-line  
> arguments and you need to learn how to use each tool separately beyond  
> trivial use cases.

how is this different from some powershell set of commands?  I think you  
are confusing the parameters for running tools with the API for system  
objects.

If I don't know how to use a command to do what I want, I first try cmd  
--help, then man cmd if that doesn't show what I need.  I'm sure it's not  
much different than powershell commands.

> At my work, we program in a *nix environment (Solaris) and I also use  
> Linux extensively So I know my way on *nix systems but I simply cannot  
> remember all the different argument for each util. every time I need to  
> find a file I need to ask a co-worker how to use "find". So in my  
> experience there's nothing simple and uniform about unix tools and I use  
> those constantly at work.

Again, you are confusing tool usage with OS object API.  Do you actually  
use powershell?  Do you find that it's objects or tools beam their usage  
directly into your brain or do you have to look up a manual to see how it  
works?  Maybe you don't have to ask your coworkers about powershell  
objects because *nobody uses it*.

>
> given that both options suck - I'd prefer dealing with objects rather  
> than raw files that need to be parsed.
> i.e. someDir.list() which returns an array of files is better than using  
> ls on unix.

The question is not whether you want to deal with that, it's whether other  
tools deal with that.  Since the interface between tools is well defined  
on unix (file descriptors), all tools can be made to work with eachother.   
If some powershell object expects an array of File objects, but your  
directory tool is outputting an array of strings, you're SOL (this  
probably isn't the case, but I'm sure some more obscure objects suffer  
 from this).  Since most unix tools treat input data as whitespace/newline  
delineated tokens, you only need to deal with rare special cases.  Most of  
the time, they just work together without any effort.

>
>>
>>> Windows has a different design than Unix's "everything is a file"
>>> which IMO is a stupid legacy design from the 70's.
>>
>> The old "technology from the 70's" chestnut. Your opinion varies from
>> 90% of people who actually use scripts. New technology for the sake of
>> being new isn't better.
>
> Was Colombus wrong when he said the world is round and 99.9% of people  
> told him he's a fool?

Sure, but I'm sure he felt like one when he found out America wasn't India  
:)

This is a rediculous point.  You ain't Chris Columbus, and you're not  
saying anything radical here, just ignorant.

> My opinion is that there where better OS designs in the _60s_ than what  
> we use today. "everything is a file" is a complete failure.

Yes, I pity all those poor helpless Unix script writers who can't seem to  
accomplish anything.  "If only things were objects instead of files" I  
always hear them say.  What a load of crap.

>>
>>> therefore, trying to do the unix way on windows with BAT files is
>>> simply the wrong way. it doesn't work because it is not designed to
>>> work like that.
>>> my take on all this, I'm not a huge fan of windows and it sure has its
>>> own problems, but this specific aspect is done much better than UNIX
>>> and all those comments about "windows doesn't support unix's
>>> "everything is a file" design and therefore it's crap" just show a lot
>>> of ignorance.
>>
>> It's not crap, just not as good. It's a poor replacement for the
>> "Everything is the same" design. Having everything use the same API has
>> huge advantages in modularity. One of my hugest pet peeves with Windows
>> is that it has several different APIs for I/O objects, and ony sockets
>> support the select interface. I have no idea what Windows devs were
>> smoking when they decided not to allow select on any object. Making
>> efficient I/O driven apps that use more than just sockets is really
>> difficult.
>
> see above, MS got the it wrong. are you surprised? I'm not.

No, definitely not surprised.  MS always seems to make things more  
complicated for the sake of, well I have no idea why.

-Steve



More information about the Digitalmars-d mailing list