brent timothy saner on 27 Oct 2017 03:04:09 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Challenges with "The Unix Way"


On 10/27/2017 02:23 AM, Steve Litt wrote:
> 
> You're right: It's not always the best. But when it is, for gosh sakes
> use it, because it's trivially easy and it was fully debugged decades
> ago.
> 

it's (almost) always the easiest, for sure!

> 
>> especially in
>> modern context -UNIX itself frequently strayed from the so-called
>> "UNIX Way"
> 
> You wouldn't by any chance be talking about Nautilus, Gnome3, KDE,
> and Firefox, would you? You can't blame the Unix way for those: They
> simply abandoned every shred of the Unix way.
> 

oh goodness, no; at the very least i try to be fair in my criticisms.
CDE (KDE's predecessor) certainly even exhibited some of the issues that
recent releases of KDE had, etc. but these definitely weren't things
that set out to follow that philosophy.

the philosophy as documented, in full, is this:


1.)    Make each program do one thing well. To do a new job, build
afresh rather than complicate old programs by adding new "features".

2.)    Expect the output of every program to become the input to
another, as yet unknown, program. Don't clutter output with extraneous
information. Avoid stringently columnar or binary input formats. Don't
insist on interactive input.

3.)    Design and build software, even operating systems, to be tried
early, ideally within weeks. Don't hesitate to throw away the clumsy
parts and rebuild them.

4.)    Use tools in preference to unskilled help to lighten a
programming task, even if you have to detour to build the tools and
expect to throw some of them out after you've finished using them.


now, every --verbose flag/switch breaks #2 right off the bat. (of
course, there aren't many of those flags in SysV if memory serves, but...)

however, SysV's grep is a pretty good example of breaking #1:

http://man.cat-v.org/unix_7th/1/grep

sed's -n outout, combined with a negation regex, duplicates grep's -v
option, wc -c duplicates grep's -c option, awk duplicates grep's -l, and
so on.

now, i'm not saying grep shouldn't *have* those options, but i certainly
am saying that there's a reason that the philosophy was broken, even in
the best-known version of UNIX. they started to realize "hey, if i'm
ALWAYS piping to this certain program most of the time, and loading that
entirely new process into memory just for this one particular function
of that program, then it's probably better to just roll that particular
functionality into the initial program". which i do agree with; it makes
for a more efficient and usable system for operators and a
smoother-running system from the resource consumption standpoint.

so i think a lot of the exaltation of the "UNIX Way" is generally pretty
idealized. does it makes for a good *guideline* for writing programs?
sure! but one oughtn't be afraid of deviating from it for the sake of
e.g. performance or usability. the original philosophy was put in place
almost hostile to these things (much like how we still by and large use
QWERTY in the US, despite it being originally designed to *slow* typists
down to prevent keys from jamming on typewriters).

Attachment: signature.asc
Description: OpenPGP digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug