ESR's Art of Unix Programming Updated
SRS Webby writes "Eric Raymond has updated his The Art of Unix Programming page with two new chapters - Chapter 3: Unix's Zoo of Languages and Chapter 4: A Developer-Friendly Operating System." This is actually fairly old, but its a nice slow friday. Personally I'm resolving this
by re-reading every Penny Arcade.
CVS is quite suitable for tiny projects. RCS isn't suitable for anything, compared to CVS.
The comments about the disk space requirements of CVS versus RCS are strange and irrelevant in the days of 40GB drives being affordable to consumers.
I use CVS even for things that consist of a small handful of text files and are developed only by me. Even with one developer and a small project, it's useful, for instance, to be able to go back to a release and easily make a bugfix branch.
While I certainly wish that Emacs were a little leaner, I am not about to give up any of it's features (well, at least any of the ones *I* use), nor am I willing to give up it's flexibility.
Besides, it's not that bad. Heck, it's not half as bad as Mozilla (or Visual Studio for that matter). And the fact that I can use basically start it once and use it as a "daemon" for ages is sort of cool, it's not like it is prone to crashing.
Every once in a while I dust off gvim and give it a whirl as a programming environment, and I find it an impressive piece of work, but once you have gotten used to running your whole life from inside of Emacs, even gvim is pretty spartan.
Although tinier, I would also complain about the startup time of all shell scripts except perhaps /bin/sh -f. A lot of Unix design relies on executing these scripts fast, and the original systems did start up these interpreters relatively fast (ie it took less time to start than to run a typical command).
A very simple counter-example, where enforced policy is causing trouble. Since you mention some amazing command-line parsing interface, I think this is a good example of this! In this case I think Windows does things right and Unix does them wrong.
Unix does do some interface to enforce policy: the shell splits commands at the spaces and does glob expansion and quoting. Windows does not, it passes the typed line unchanged to the program.
Yes, this results in some inconsistency of Windows programs, but really very little. Most programs call some function when they encounter a word with '*' or '?' in it. Most of the inconsistency is people working around their stupid decision to use the directory seperator '/' to introduce switches. This is trivial to do beacuse Windows does not enforce such policy, but like you said it results in inconsistency. But I still feel the result is better than if we were forced to use '/' to introduce switches.
But one of the immediate questions people familiar with DOS asked about Unix is "where is the 'rename *.A *.B' command?" Unix people, being sometimes illogical in their defense, will go on about this being undesirable or bad computer science, but the real answer is that Unix's "policy" is preventing a very logical user interface design!
Another good counter-example is X. X admittedly sucks, but the suprising thing is that this primitive thing, designed in 1983 or so, is able to reproduce the GUI that MicroSoft and Apple are writing now. If Unix had done "policy" like you said, we would all be forced now to use the Athena toolkit. The fact that all the applications correctly respond to the "reverse video" configuration option might impress you, but I think most people would immediately dismiss Unix as crap!
Wow. That's not inflammatory at all.
Just kidding, really, but I've heard both sides of this argument, and I dunno which to believe. "#ifdefs rock!" "#ifdefs suck!"
Thus, I just write everything in PHP and Tcl... :)
Potato chips are a by-yourself food.
Memory management in C++
There are two things you can do if you're lazy and somewhat allergic to new and delete, like I am.
1) Use the Standard Template Library. This isn't empasized enough in C++ courses. If you learn it and use it properly, you will drastically cut down on the news and deletes that you need to use in your programs. The STL containers own their objects, so you can stick an object (not a pointer or reference to an object) into a container and forget about it. When the container disappears, the object will be destroyed. This doesn't negate the necessity for a programmer to think about memory management, but it eases the burden greatly. Be careful though, stupid implementations can result in a lot of time wasted in the copy constructor.
2) Use the truly excellent Boehm garbage collection library. This page has all the good information about it.
C++ isn't perfect, but what language is?
If tits were wings it'd be flying around.
I hope not. Swing produces the most ungainly and bloated GUIs I've ever had to work with. I'd rather see someone who knows JNI port Qt or xwWindows to Java. Until then, I'll stick with AWT if I have to use Java for GUI programming at all.
ObJectBridge (GPL'd Java ODMG) needs volunteers.
Finding God in a Dog
Come meet the boy who saw his $41,000,000 turn into $650,000! Are those tears of sadness running down his cheeks, or has he gone insane?!
Cheers,
Like most of us, ESR is a language bigot.
I hope that will be taken as "explanatory" rather than as "flamebait", but I have to say it regardless of how anyone takes it.
--
Sheesh, evil *and* a jerk. -- Jade
Yes, Java suffers in terms of performance when compared with C++. But then again, C++ takes a performance hit when compared with C, or assembler. Yet people still use Java, and other "slow" languages such as Perl and Python.
Ten years ago, the general rule was to use the tool that gave you the best performance possible, because CPU cycles and memory were expensive. Now CPU cycles and memory are very cheap. For many tasks, it is cheaper to spend a few thousand dollars to throw a faster computer at the problem, or let the computer crunch at a problem for more time, than it is to spend tens or hundreds of thousands of dollars of extra development time to pay experienced gurus to rewrite in C++, C or assembler, hand optimize the code and fix all the bugs that inevitably come from developing in that way.
But I'm not a language zealot. I believe in using the right tool for the job. Sometimes it's Python + Tk, other times it's Java, or Perl with CGI.pm, or C++ or assembler. For my current little project (a ray-tracer for a graphics class) I chose C++. The job is CPU intensive, so I rejected Java, Python, all the other interpreted languages. I also refused to do the job in straight C because the algorithms and data structures are so complex I found the extra tools (classes, encapsulation, the limited but still better than C tools for memory management, the STL) to be a necessity. But that's just for this little project. I'll choose something else for the next project.
Meldroc, Waster of Electrons
I hate to pull an AOL, but I can't emphasize enough the usefulness of the Standard Template Library and the rest of the ISO C++ Standard Library. It comes with a string class that already knows how to concatenate, search for substrings, resize itself and Do The Right Thing in most cases. Never write a linked list again, because the STL contains a list class template (in other works, a linked list of whatever you want.) It already handles all the ugly new/delete memory management for you. The vector class is an improved array. It can resize itself, it can easily be adapted to perform automatic range checking. The STL is a godsend for lazy programmers like me. Yes, C++ has its warts, but when you code wisely and use all of its capabilities, it is an incredibly powerful tool.
Meldroc, Waster of Electrons
I admit it's highly subjective ;-)
;-)
But Java avoids a lot of the problems older languages like C have to solve with #ifdefs by providing (1) standardized primitive types and (2) a standard library that behaves the same everywhere, be it under Irix, Tru64, Linux, Windows, OS/390 or EPOC.
Example: An int is always signed, always 32 bits. The Java Language Specifiication thus is a very important document for any Java programmer. Answers 20 percent of all questions in Java newsgroups
Java's a lot faster in the newer versions. I can't give a number comparing it to C / C++, but raw speed doesn't matter for many applications anyway. Swing also has become better but there still are some issues. Hardware-accelerated buffering etc. will hopefully solve these problems in 1.4.
Translation: Java is fast. By fast I mean adequate. By adequate I mean slow.
(credits to whomever I stole this from.)
ESR has some stuff on his personal pages that someone might take offense too, stuff about firearms, anarchy, paganism, polyamory, and so on.
Who makes your filtering software? Being an armed anrchist pagan hacker, I'm offended by someone labeling that content as offensive.
Tom Swiss | the infamous tms | http://www.infamous.net/
Tom Swiss | the infamous tms | my blog
You cannot wash away blood with blood
Um, you seem to be laboring under a mighty misapprehension about the word "pagan". (Or maybe you're a lame-ass troll, but for the sake of potentially being educational I'll assume not.) Might I suggest ESR's Neopagan FAQ?
You're also laboring under a mighty misapprehension about the word "socialist", for which I'd recommend some reading about libertarian socialism.
And if I were afraid of gun owners I'd be unable to look in the mirror without my knees quaking.
Tom Swiss | the infamous tms | http://www.infamous.net/
Tom Swiss | the infamous tms | my blog
You cannot wash away blood with blood
Pardon me, AC, but I believe you have just demonstrated that you have never worked on a real project of significant size that tried to use CASE tools for any real length of time.
First, CASE is nothing like automatic routing, since the key element of programming is semantics, while the key element of routing is, well, routing.
I have. 100,000 lines of automatically generated crap which bore little resemblance to my actual intent as stated in the CASE model has been a hindrance, not to mention now being saddled with a number of silly idioms which I will be months removing.
You might like an IDE. I don't. I understand my tools. Most of the people I know who like IDE's like them because they don't understand the tools, or even some of the more important aspects of program construction.
It's friday, so -- I'll flame. Advocating CASE and IDE's is a demonstration of your unmitigated ignorance.
You oversimply my viewpoint, and thus get it wrong. There is a difference between the system enforcing policy, and the system enforcing a *particular* policy. In my example of the command line, one could concievable create an add-on that would create different exception based on the user's preferences. Since apps never see the actual command line, but the processed version of it, all apps would automatically accept the new changes.
Yea I know that takes some clever system design. I never said it was easy, just that it was possible.
Second, who said you one would have to use Athena? I'm a big fan of binary interfaces. This is one thing OpenGL gets right. All OpenGL apps are compiled to for the OpenGL ABI. The actual code that gets called varies from implementation to implementation, and in the Windows world, is entirely different for different cards. Yet it still works... wow! Actually, it's not wow, just good design. In the X case, one could have a standard API that all apps would have to write to (maybe a version controlled one like DirectX, so the API could expand) and different implementations could be plugged in at will. Again, it takes good design, but the longevity of UNIX has shown that some well designed stuff does stand the test of time in good shape, so it's not impossible.
A deep unwavering belief is a sure sign you're missing something...
I have a huge problem with his statement "the cost of this approach is that when the user can set policy, the user must set policy"
It is simply untrue. It should read
"But the cost of this approach is that application developers get to set policy"
Because UNIX does not enforce policy, policy gets enforced in other places. Specifically, it gets enforced in end-user apps. The problem is, that in this way, the only thing that happens is that an inconsistant/hacked up policy is exposed to the user, instead of a consistant one.
Think about it. Who gets to decide what toolkit you use? Not you, the user, but the app-developer who decides to use GTK. Who decides what desktop you use? Not you, but the Rasterman, who decided to make Enlightenment the only accelerated window manager. Who decides what command-line switches you use? Yep, whoever wrote the program.
The whole, fundemental, problem is that by not enforcing policy at the system level you simply allow the app-developers to decide it. You do didly for the non-programming user.
Consider this, instead of simply providing a text-stream for command line arguements, you provide a strictly-defined messaging interface. The app is just passed a set of messages that describe the command line. Then, the user can choose whatever command line format they want, and can depend on a dynamically loaded system add-on to convert the data.
Take the whole paradigm of message passing. It is an extremely strict interface, yet it allows the user huge flexibility. Take a GUI app for example. Instead of enforcing hotkey policies like Windows, UNIX leaves the developer free to do what they want. Instead, if apps were required to responed to strict message sets to use hotkeys, then the user could send a message from a remote server in Australia to activate the features, or map hotkeys to whatever buttons they chose, IN ANY APPLICATION.
It is a paradox. The more policy you enforce at the API level, the more freedom you give to the user. Yes its hard. Yes it takes a lot of forethought. Yes, it *can* be done. Force developers to use a particular API. Then give the user the freedom to chose any implementation of that API they wish. Force developers to use a standard set of services. Then give the user the freedom to mix and match, replace and rebuild those services as they see fit.
A deep unwavering belief is a sure sign you're missing something...
And giving accordingly, I hope.
If you enjoy reading PA, why not show Tycho and Gabe you appreciate the laughs?
-the wunderhorn
Karma: Bored. (Thinking about resurrecting the "Anyone else is an imposter" joke.)
I have to grant that Penny Arcade gets a "hit" more often than User Friendly has for the past while. But back in the day User Friendly was *really* good and the good ones are very funny it is still taking a look at everyday just for that. I also like both.
Cypherpunks: Civil Liberty Through Complex Mathematics. Those who live by the sword die by the arrow.
BTW, it would be cool if any Slashdotters wanted to review Raymond's books on The Assayer.
The Assayer - free-information book reviews
Find free books.
I think you missed his point. He says that obviously some things just can't be done by piping lots of small commands together. At least not with a screen interface.
:w, is it?
Sure, there are utilities that will do almost any emacs thing to a file, but after editing in vi or nano do you really want to have to type all those shell commands in when a couple of keystrokes in emacs will run make or let you check your tested source back into the CVS repository? Typing C-x C-s is certainly no more difficult than doing ESC
Yes, emacs is large, and it has a lot of features (some of which are only useful as entertainment), but that's the point. Saying emacs is big and bloated if all you take advantage of are the text editing features is like saying a RDBMS is big and bloated if all you use it for is sorting and grouping lists. I mean, the OS itself takes forever to load compared to emacs, but no one complains about that because it does so much stuff.
That said, if you don't take advantage of any of the features that emacs offers, then no, it's not the tool for you. I have the same opinion of most of the uses I see Word put to. Incredible waste of power (and in the case of Word, money and freedom).
I do not have a signature
Does anyone remember a while back when ESR got some shares in VA Linux for his contribution to the company and the open source movement? Did he sell his shares at the allowed time (I believe June of last year?)? Insider trading info seems to indicate that he hasn't, and if not that $32 million has dropped to about $600,000.
More details of it can be found at yafla. Note in particular the text on the link on "potential wealth disappear"
Cheers!
Apparantly your censorware thought the site was about dissecting zoo animals... the page starts with:
"Unix's Zoo of Languages... We dissect nature along lines laid down by our native language..."
-thomas
"And like that
It also offers Unicode support, something not widely offered elsewhere
Yeah, unless you consider Perl and Java to be "widely offered." (I would.)
"And like that
This article has some glaring errors with respect to Tcl. Tcl has offered binary file I/O since release 8.0 (released in March '99; current release is 8.3). It also offers Unicode support, something not widely offered elsewhere, and a syntax that does not look like line noise.
Finally, Tcl is one of the few languages (on any platform) with a completely open source IDE, including a debugger: TclPro! See SourceForge or Scriptics.
"This is actually fairly old, but its a nice slow friday. Personally I'm resolving this by re-reading every Penny Arcade."
n ny-arcade.com/img/link.gif"</IMG src>
o nionlink1098.gif"</IMG src>
PennyArcade is great. here's the code to stick it in your slashbox:
<A href=http://penny-arcade.com/view.php3> <IMG src="http://a332.g.akamai.net/7/332/493/v1/www.pe
And in case you live in a box (albiet one with an internet connection), go check out the onion, at http://theonion.com. It's hilarious.
And if you want to stick it in your user defined slashbox:
<A href=http://theonion.com><IMG src="http://graphics.theonion.com/universal_pics/
...when you reject all of the submissions! Sorry, just a little bitter. In the meantime, here's an interesting article on Larry Ellison views on computing.
"People who do stupid things with hazardous materials often die." -- Jim Davidson on alt.folklore.urban
Yes, not only are students taught Java, but they hear a lot of Sun sponsored propoganda about how it's so much better than C++. This stuff is about as valid as MS's analysis of competing operating systems. You can't really argue against the assertion that C++ has lost a lot of mindshare to java over the last few years. Recently I've noticed that the backlash against this has become more pronounced, particuarly by those who have tried it in large projects and become disenchanted with it. These developers then become Java's mroe adamant critics.
Although I definitely prefer to code in C++ myself, I agree with decision to teach Java as a first language rather than C++, which has too many complications to make sense as a teaching language. If you're trying to get to grips with the basics of programming, you've got enough to worry about already.
However, if you *really* want to get to grips with the basics of programming, I really think its best to learn some simple assembly code. Nothing else can give you an adequate understanding of what goes on after the compiler has done it's job, even if you never use assembly commerically.
http://rareformnewmedia.com/
Eiffel: He describes this as one of the noble but failed attempts to oust C/C++ because they don't have automatic memory management. Garbage collection is one of the core features of Eiffel. Read Chapter 9 of Object-Oriented Software Construction by Myers to understand how absolutely vital he considers it.
Tcl: Has had a clean, well documented interface for adding new functionality in C longer than Python or Perl. It was one of the original features of the language. That's how Tk is implemented.
Sorry for the "OT" question, but what exactly does the www.tuxedo.org site do? It seems to be banned by the "Censor-ware" at the client I am at.
e r3 .html
The response when I try to get:
http://www.tuxedo.org/~esr/writings/taoup/chapt
Is:
RESTRICTED - You have attempted to access a restricted site. This restriction is to prevent you from inadvertently bringing offensive/non-business related material into the workplace.
The proxy's access control configuration denies access to the requested object through this proxy.
Seeing as how I'm working with Unix systems I find the idea that this is either Offensive or Non-Business related rather amusing.
The only thing I can think of is that all of www.tuxedo.org is blocked, but I'm not sure why.
So what is it?
This space for rent. All reasonable inquiries will be entertained at proprietors discretion.
Penny Aracade has changed a lot over the past 6 months, and I'm not sure if it's for the best. But the last three have been a return to old values so we'll see what happens. Plus, the entire controversy around their sudden unplugging might make them return to the old good stuff. `8r) Now, if the stupid ads built into their comic didn't freak out firewall constantly... `8r/
Oh, and cause I can: Wang!
--
Gonzo Granzeau
Gonzo Granzeau
"Nothing the god of biomechanics wouldn't let you into heaven for.." -Roy Batty
While The Art of Unix Programming is a fun to read, I think that it's actually pretty devoid of useful content. With a name starting with "The Art Of...", I was hoping for something more technically oriented. Knuth set the standard with his classic The Art of Computer Programming; perhaps a discussion of standard Unix APIs, services, etc is what I wanted. (But I guess Richard Stevens covered this already in Advanced Programming in the UNIX Environment.)
Instead, we're getting a slightly gussied up advocacy piece, which really isn't much more than a retread of The Cathedral and the Bazaar, with a dash of superficial advice thrown in. As a UNIX programmer, I've found the existing chapters to be useless--I already believe in the UNIX way, and there's nothing concrete in there I don't already know. There are little hints of goodness, but so far, no topic has been covered simply enough to be useful to a novice, or in sufficient depth to be of value to an expert.
I guess I'm not in the intended audience--this really is a book for people relatively new to UNIX. But I wish Raymond had chosen a title which was more honest and less pretentious. I guess the "Who should read this book" is honest on what the book covers, but I was still disappointed. Perhaps the title "The Art of..." set my expectations too high.