From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 102b75,45b50f14dadfce5b X-Google-Attributes: gid102b75,public X-Google-Thread: 1164f8,45b50f14dadfce5b X-Google-Attributes: gid1164f8,public X-Google-Thread: 110292,45b50f14dadfce5b X-Google-Attributes: gid110292,public From: dg@ (David Gould) Subject: Re: Final kick at the "Merced Guessing Game" Date: 1997/10/10 Message-ID: <61koun$dlb@news.informix.com> X-Deja-AN: 279215328 Sender: dg@illustra.com References: <61g30t$o2n@news-rocq.inria.fr> <61ho3v$3m0$1@goanna.cs.rmit.edu.au> Organization: Informix Corp. (formerly Illustra). Newsgroups: comp.sys.intel,comp.arch,comp.sys.dec In article , Joseph H Allen wrote: >In article <61ho3v$3m0$1@goanna.cs.rmit.edu.au>, >Richard A. O'Keefe wrote: >> nice features of older languages and C9x... > >The real question is why has C caught on in such a big way when other >more powerful languages have not? There are several answers: [many good reasons deleted] I am surprised that no-one has mentioned what may be the most important reason for the success of C: "The C Programming Language" by messrs K & R. An excellent book, far better than the language described. A religious text almost. After reading it, especially early in a career, one is convinced that "C" not only makes sense, but is even "the right way". Think about how thinks might have turned out had this book never existed. The above is a bit tongue in cheek, but twenty years in computing has lead me to believe that software success owes far more to cultural factors than to technical merit. This applies to "users" and "corporate IS management" as the success of MS-DOS, Windows, and now NT amply illustrates. It seems to apply to programmers or "software engineers" perhaps even more strongly. The C vs anything else debate often illustrates this. There are a few central elements to this argument that are common whenever it appears. The interesting thing is that the same assertions continue to be made persistantly even in the face evidence to the contrary, and even when they explicitly contradict each other. - C is "close to the machine" and somehow, this is "efficient" or good. Even after proof that say Fortran is more efficient for some problems, or that Modula or Ada, or lisp is more powerful, or that the whole problem could have been solved with a 20 line script, the C proponent will reply (often paraphrasing K&R) that C is both more efficient and more powerful "since it lets you get close to the machine". This assertion continues to be made even after contrary facts are demonstrated. This can go on to absurd lengths where some unholy concoction of inline assembler and preprocessor abuse on one machine (so sadly no longer made) is claimed to be faster than the "same" program in fortran. - C is "portable" C is certainly common, but even within the confines of the ANSI standard there is wide scope for major portability problems. In the database world, the major players all have entire departments with 100+ or so persons that do nothing except "port" each new release of what is essential one very large C program. Often the portability argument will somehow co-exist with the "close to the machine" argument, even alongside the claim that "if you want real performance, you need to read all the hardware manuals and rewrite for each machine" - C is a simple language with simple syntax. This is simply not true. A look at either the grammars, or the language reports will reveal many simpler languages. C may be simpler than ADA or PL1 or most especially C++, but compared to say Oberon or Modula-3, or even Fortran it is not a simple language. More strongly, it does not have simple syntax. Forth, Smalltalk, Self, the lisp familyi, these have simple syntax. Among the Algol family, some of the Wirth languages, especially Oberon have much simpler syntax than C. The assertion (that C is simple) is often comtemporanious (but hardly supported) with statements that the asserter has frequent reference to more than one C book and that the questioner "must not understand the fine points" of C. - C is terse and elegant. For any C program there is a much shorter and more elegant solution in some other language. As simple proof, consider a language "just like C" but with garbage collection. Most C programs would be far shorter and more elegant if written that way. For a really tough test of terseness, pick a random perl script and write it in C. This argument may be related to the "simple language" argument, except that is seems to be motivated by a subconscious aversion to typing keywords. This is almost explicit in K&R where "{" and "}" are equated to "BEGIN" and "END". - C lets me do what I want. You can't write operating systems in "other". This of course begs the question of how common "writing an operating system" is, and ignores several perfectly good operating systems not written in C. The relevance of this point is also hard to fathom since it is usually raised in opposition to the assertion "for some problems C is not the best choice". The counter argument is that C makes it really easy to do what you do not want. Somehow this is felt to be adaquately countered by assertions about "competent C programmers" vs "crap programmers". The inconsistancy with the "simple language" claim is rarely explored. Enough of the war, now to the unsupported opinions: Why is C successful, and what lies ahead? In a word, it is mostly "fashion". C was initially successful because it had a great book, available implementations (especially, available to universities), was easy to host on smaller hardware, and wasn't much worse than the common alternatives of the time. C survives because it is ubiquitous, it will do most jobs eventually, and many people (who should know better) are unaware of the alternatives or are stuck with it for some reason. C has fanatic followers because it appeals to lazyness with its "terse" syntax, to Walter Mitty fantasy with "I could write an OS with this", and to the need for machismo comparison with its arcane intricacy "a real C programmer would just use macros for that". Each SEGV becomes a bonding ritual with the C brethren akin to an extended fraternity hazing. C++ is successful at the moment, mostly because there are hordes of C programmers eager to "progress" to the next level. Since it is unlikely that most programmers will ever be able to work at an economicly acceptable rate in C++ due to its overwhelming complexity. It also almost completely lacking the actual virtues of C. Java is likely to be a sucess, perhaps in a dialect form that omits some of the tougher parts of the implementation. This will occur not only because it it is better than C, or C++, but also because it, brilliantly, looks a lot like both. The hordes of not quite successful C++ programmers and their managers are going to be casting about for some way out of the swamp. Java will be there with all the familiar appearance and without most of the hidden minefields. Who the heck am I anyway? I have been programming for a living for almost 20 years. I learned C on a PDP-11, where it really did make some sense, and have worked mainly with C for the past 15 years. For the last 10 years I have worked at one or another of the major SQL database companies on the core server engine(s). An SQL server engine is typically a large C program, between 500,000 and 2m lines of code. These engines are about as close to "writing an OS" or "writing a compiler" as possible. They implement the SQL language processor, a file system (usually built on raw partitions), a networking protocol (on top of tcp or other transport), and what looks like an OS kernel (asynch I/O, threading, sychronization, memory management for threads, etc.) These programs ported to dozens of platforms, mostly unix flavored, but also NT and others. They are written, maintained, ported, and enhanced by engineering departments consisting of a few hundred persons. The code is expected to be useable for up to a decade. New versions are expected no more than two years apart. Performance (both time and space, both compute and I/O) and reliability are considered critical. Vast effort is spent on testing, somewhat less on benchmarking, but somehow, performance is easier than reliability. My opinions about C and software development come from my experience as a practitioner and as an observer of the DBMS engineering organizations as well the odd bit of reading here and there. -dg David Gould dg@illustra.com 510.628.3783 or 510.305.9468 Informix Software 300 Lakeside Drive Oakland, CA 94612 If simplicity worked, the world would be overrun with insects. -- David Gould dg@illustra.com 510.628.3783 or 510.305.9468 Informix Software 300 Lakeside Drive Oakland, CA 94612 - A child of five could understand this! Fetch me a child of five.