Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

ArticlesComments on Code


J uly 1996 / Pournelle / Comments on Code

Once nearly everyone did a little programming -- then along came C.

Jerry Pournelle

Most computer users don't write their own programs. Usually, that makes sense. Like books, computer programs are written by professionals, and most readers don't write their own novels. On the other hand, there are many more things we'd like our computers to do, if only we knew how to teach them. I've always said the real computer revolution will come when programming is like writing: while most people don't write novels, just about everyone can use a ballpoint pen to write a letter or keep a diary. We no longer depend on a literate elite to read and write our letters, and we shouldn't have to depend on an elite of programmers to make our computers do ordinary tasks specific to our needs.

That was a lot more obvious when I began this column. In those days, nearly everyone interested in computers did a little programming, and much of this column was devoted to languages. It was a big deal when Turbo Pascal hit the market. When Philippe Kahn's Borland International brought out Turbo Basic, it shook Microsoft to the core. After years of neglect, they rapidly produced two major revisions to Microsoft Basic, and they haven't slowed much since.

In those days, computer literacy included at least an elementary understanding of programming, generally Pascal. The computer world wasn't divided into users and programmers; most of us were a little of each.

Then along came C.

I'm not sure why C took over so fast. It's a guru-friendly but user-hostile language that's difficult to learn. Unlike Pascal or BASIC, it requires near mastery before you can write useful programs. I think it went like this. In those days, our hardware wasn't very good. While C produced programs that were bulky compared to what you could do in assembly language, they were smaller and faster than Pascal and compiled BASIC programs, and enormously faster than interpreted languages.

Moreover, C code was portable, meaning that there were compilers for different CPU chips, so with luck you could compile programs to run on different hardware. That was very important before IBM set compatibility standards and ended much of the fragmentation in the non-Apple world. Today, all but a tiny fraction of the computer world is made up of two unequal parts, Intel/PC and Mac, and portability isn't so much of an issue. Almost all languages are portable within the two major communities, and neither C nor anything else is especially portable between them.

Meanwhile, our hardware has gotten a lot better, so that, for many applications, code size and program speed aren't as important as they used to be. Nowadays, we don't really need the special capabilities of C, but you'd never guess that. Today, being a "programmer" generally means the ability to use C and C++.

I think C is a disaster. It will compile almost anything, including complete nonsense, meaning that programmers must simulate the compiler in their heads and often don't catch mistakes until the program is nearly done. Forget that, though. The real problem with C and its derivatives is that using it is nearly a full-time job. With BASIC or Pascal, you can write some code, lay it aside for a while, and pick up where you left off without much lost time. With C and its derivatives, it takes more time than I have to understand what has been written, so there's rarely any time to add new code.

C is also painful to debug, because the compiler doesn't help you much. With Pascal, and to a lesser extent with BASIC, the tough job is getting a program to run at all; assuming you used a reasonably logical design, if you get it to run at all, it more or less does what you intended. Not so with C. It will run nearly anything; the problem is f iguring out why it's doing something nobody would want a computer to do.

One of Pournelle's laws states that hardware solutions are generally better than software. The good news is that our hardware is now good enough that programs written in high-level languages will run fast enough despite the inefficiency. You don't need C to write useful programs. Sure, the latest real-time graphic actions for a space simulator may take professional skills; but languages like BASIC and Pascal are good enough to do some pretty amazing things, and with game design add-ons, Visual Basic (or VB) can produce quite professional games running at arcade speeds.

It amazes me how quickly you can produce complex working programs in BASIC, and with VB 4, you can give them a professional look. VB knows about Windows and toolbars and menus and that sort of thing. One of the big advantages of the Mac is that most programs work the same way, so that once you've learned the Mac conventions, you can sit down and do productive work with relatively unfamiliar software. VB lets you do much the same thing for Windows programs. I can say this with some authority because I've been doing some programming for both platforms.

A long time ago, I inherited an unfinished BASIC version of Roberta's whole-phonics reading program. I used QuickBasic to get a primitive DOS edition completed and out the door. A couple of years ago, she worked with another programmer to bring out a Mac version. The first DOS and Mac versions require an instructor, not necessarily a teacher, but someone to read what's on the screen. Both the PC and Mac versions work well, and they've been used to teach thousands of people of all ages to read English.

Alas, the DOS version was written to use ancient CGA graphics and thus looks clunky and out of date. I truthfully don't know of a better system for teaching reading, but for marketing purposes, the DOS version needs updating to a Windows version with better graphics. The Mac version is a b it more modern, but it too could use a face-lift.

Cosmetic improvements would help sales, and one of my goals is to use VB to make a pretty Windows version. Before we got to that, Roberta started a much more ambitious project: to create a stand-alone version that would teach people to read English without an instructor.

A couple of years ago, that would have been flat-out impossible on a PC. There wasn't good enough text-to-speech capability. In theory, we could have recorded each lesson as digital sound, but that would have taken at least one floppy disk for each lesson--and there are 70 lessons. Digital-sound files are big. It could be done on a CD-ROM, but we don't have the resources for building that.

The Mac was a different story. Apple is big in education, and the Mac world has always had superior sound capability. It only remained to choose a language and find a programmer. I was in the middle of a novel, so Roberta did that herself. The original notion was to do i t in C++; but just then Apple brought out a text-to-speech capability that can be installed in the Mac OS and accessed with Allegiant Technologies' SuperCard, so that's what they chose. It took longer than she thought it would--programming always does--and before it was finished, she lost her programmer. That's where I came in.

What I inherited was a nearly complete but buggy SuperCard program that would take Roberta's scripts and present the lesson to the student. The basic program concept worked, but Roberta did a lot of experimenting, making improvements in the scripts and discovering that you can get dramatically different results depending on which voice you use to read the lessons. Some of her improvements didn't run in the code we had. She was anxious to get the program finished and out the door. I told her I'd look at it.

It turned out to be several thousand lines of uncommented SuperCard script.

Some years ago, Larry Niven and I wrote Inferno , an homage modernizing the g reat medieval work by Dante Alighieri. If we ever do a revision, I guarantee that I'll have an especially gruesome place in hell for programmers who write uncommented code. On the other hand, while we're unlikely to do an update of Dante's Paradiso , if we do, I'll give a special place to Allegiant Technologies. The excellent debugging features of SuperCard let me walk through the program commenting as I went, and in two weeks, I understood it well enough to go in and fix the bugs. We visited Allegiant Technologies in San Diego, and their people showed us some tricks for making things run faster with less memory. We particularly want to thank Richard Harper, their director of content development.

SuperCard is an odd language. For example, the only variable types are local (available in only one module of the program) and global. Otherwise, a variable can be a real number, an integer, a text string, a list, or an array. Indeed, the same variable can be each of those in turn if y ou're foolish enough to do that. SuperCard employs a lot of natural language. Suppose we have a variable named StudentText, consisting of a list of words separated by spaces. `Get Item 3 of StudentText and Put it and ", " after NewText' will get the third word from the first list, append it to the second, and put a comma and a space after the word. You can then treat the first list as one big string, and if you change the delimiter to "," you can treat the second list as a list with items separated by commas.

This cavalier treatment of data structures is likely to drive professional programmers up a wall. On the other hand, it was possible for me to decipher page after page of uncommented code, insert diagnostic variables to help figure out what was going on, and write a hundred lines of SuperCard to fix the various bugs. I could never have done that with a C program, and I probably couldn't have done it with an uncommented BASIC program.

In other words, while SuperCard isn't truly self-document ing--you really should make comments as you go--it's a lot closer to that ideal than anything else I've seen so far. The result is an extremely useful tool for nonprogrammers who want to make their Mac do something interesting. You can work at your own pace and not spend all your time trying to remember what you did last. Teachers will find it valuable.

Like its predecessor, HyperCard, SuperCard is easy to learn; there's an excellent tutorial. Apple's HyperCard was a true breakthrough, an easily learned way to write Apple applications. Alas, Apple did not follow through, and SuperCard has pretty well displaced it as the language of choice for complex programs. Either one can get you started programming, though. The real limit is being afraid to start. SuperCard and the Mac are hands down the easiest way for nonprogrammers to write interesting programs.

There's nothing really comparable to SuperCard for PCs. VB comes closest, but it is a truly structured language, with real type checking: you can 't arbitrarily use the same variable as a string, an array, and a number. The syntax is more "computer-like" than SuperCard, and writing VB programs is more like "real programming," particularly if you give some thought to data structures.

As Professor Niklaus Wirth of ETH --the Swiss equivalent of MIT--said long ago, data structures plus algorithms equals programs. Wirth wrote Pascal largely to demonstrate that; Pascal was designed more as a teaching aid than a practical language. Modula-2 and Oberon were the languages that Wirth intended for practical use. Either, in my judgment, would have been preferable to C--by a lot--but they didn't catch on, either for professional programmers or for the rest of us.

Instead, partly because Bill Gates got his start by writing Altair BASIC for the first microcomputer, in the U.S., BASIC became the language of choice outside professional programming circles. QuickBasic, and its successor VB, incorporate most of the best features of Pascal an d Modula-2. VB has the vital ability to hide subroutine variables from the rest of the program (SuperCard also has that feature). Because it's tailored for and takes advantage of the Windows environment, you can build complicated screens and intricate control structures (e.g., menus, buttons, messages, and live areas on graphic screens) without writing any code at all; and given the new hardware, you can write astonishingly powerful programs that run quite well.

Moreover, there are a great number of third-party tools and add-ons, with more coming all the time. You can get tools for graphing, scientific calculations, and communications. You can add a database or a word processor to your application--even speech recognition. Once you know how to use VB, it's relatively simple to add these capabilities. Alas, I still haven't found a text-to-speech VB add-on that comes close to what the Mac can do.

I spent the day doing some serious archiving. Over the years, I have had over a hundred computers. While I have used some formal backup systems, my real archive system is just to copy everything from the old machine to the new, network the old, and copy stuff back and forth; what might be called the maximum redundancy system. It's also a system of maximum confusion, since I don't really have any record of what's where.

It works so long as I keep adding disk space, but recently I found I was running out of space on Pentafluge, the Pentium 60 I do most of my work on, despite its 1 GB. The remedy for this is obvious: I can take many DOS programs like Q&A Write that don't need to access the disk after loading and put them onto a networked machine, like Little Cheetah, the ancient Cheetah 25-MHz 386/387 that has been running since 1988 and is being used as an archive server. That will free up lots of local space. I use Q&A Write all the time, so it loads once on start-up and never gets closed.

I've got a whole bunch of other programs I seldom use but don't want to get rid of, and they c an all go onto a networked machine. The only problem was that the networked machines were all full. There are multiple copies of nearly everything I ever wrote and every game I ever played. Today, I finally decided to do something about it.

I have an embarrassment of tools for archiving. There's the HP Colorado Memory Systems T1000 tape drive that uses Travan 400-MB cartridges. There's the Datasonix Pereos tape drive that puts a gigabyte onto a cassette about the size of a postage stamp, and, no, I'm not kidding. It works, too. There's the Iomega Zip/Z100P drive. Those all work off the parallel port and are a lead-pipe cinch to install and use.

There's the Fujitsu DynaMO 230 magneto-optical (MO) drive. Finally, there's the Maxoptix T3-1300 optical drive. Those are both SCSI and thus slightly harder to install, but they're faster. In the end, I used the T3-1300 because it holds half a gigabyte per side, the medium is very stable and archives will last a long time, and the system has been installe d for some time.

If I hadn't had the T3-1300, I'd have used the Zip/Z100P. It's not as fast as a SCSI drive, but even with automatic installation and not using the accelerator software that comes with the drive, it does a couple of megabytes a minute, and with Windows 95, it runs nicely in the background while I'm working on something else.

Iomega did the Zip/Z100P right. It's inexpensive for both the drive and the medium; it works with almost any PC (not the Mac, alas). It installs simply and almost automatically; just connect to the parallel port, turn on the system, and run the software. It's well behaved, choosing the next-available drive letter rather than trying to replace an existing drive. Because it installs so simply, it's one of the best sneakernets imaginable, and because the medium is inexpensive, it's good for archives.

Those who need serious archiving capabilities are better off with the Maxoptix T3-1300. If you want something that is neat, and works as well as any tape sys tem, the Datasonix Pereos is guaranteed to be a conversation starter. If you just want a low-cost, medium-performance backup-and-archive system, you should get an Iomega Zip/Z100P. You won't regret having one even if you have other stuff. It's highly recommended.

The CD-ROM of the month is Digital Humans. Imagine taking sections through a human body (two, actually, one of each sex), starting at the feet and going all the way to the head; photographing each section; and adding labels and comments. That's part of what's on this Windows CD-ROM. There's a lot more, including 3-D models and the tools to manipulate them. This is the best anatomy tool short of dissecting a corpse that I know of. Fair warning: they really did section human corpses. This isn't for the squeamish.

Meanwhile, the American Medical Association Family Medical Guide (Random House) has long been a standard home health reference book. It's now available on a CD-ROM from DK Multimedia. It's not fancy, mos tly a book on a disc, but it's solid information in an easy-to-use format. The same company puts out other CD-ROMs, including Eyewitness Virtual Museum: Bird and Eyewitness Virtual Museum: Cat. These claim to be the ultimate multimedia guides to their subjects. That may be a bit overstated.

There isn't much multimedia to them. You walk through a museum and see the exhibits, such as a fresco of St. Francis preaching to the birds. The pictures are nice, but there's not much about any particular species. If you're really interested in birds, you'll do a lot better with a book. On the other hand, they can make a CD-ROM a lot cheaper than they can print a book, a CD-ROM takes up less room, and the indexing might be better than a book, although that's not true here.

This is the kind of product we saw a lot of in the early days of CD-ROM. I'd advise you to look at them before you buy them.

The Diamond SupraSonic 288V+ combines a highly reliable 28.8-Kbps V.34 fax modem with a he adset that lets you use it as a telephone instrument. It understands caller ID. It comes with a conditioned high-speed RS-232 cable. It uses flash ROM, so updates can be downloaded. It can be used to implement voice mail and fax on demand. Like the old Supra modems, it uses an LCD rather than flashing lights.

I've been testing it with my horribly noisy lines, and so far the SupraSonic 288V+ is performing as well as my U.S. Robotics Courier. I haven't yet taken it to the Hotel Bellevue in Washington D.C., a place with I think the noisiest phone lines in the country, so I can't say it works as well as the Courier in all cases; but I'm impressed. I've always thought Diamond Multimedia Systems' Supra division built the most cost-effective modems around; the Diamond SupraSonic 288V+ is no exception. Recommended.

Because I seldom write about stuff I haven't used a lot, I don't often have to apologize for a recommendation, but two of my recent game recommendations were premature. The re asons are instructive.

The two games are MicroProse Software's This Means War and Mindscape's Warhammer: Shadow of the Horned Rat. Both are the kind of game I like, tactical-strategic rather than arcade, with a story line and characterizations. Both can be a lot of fun to play. And both were programmed by people who clearly hate game players.

This Means War has two flaws: the game crashes often under Windows 95, something I can live with, and there's a random event called sabotage, which you can't turn off and can cost you the entire scenario in a second if what it randomly destroys is a crucial unit. When that happens, there's nothing for it but to dump the program and start from a saved position, and I've had that happen a dozen times in one scenario. I played to the end of the game despite all this.

Warhammer: Shadow of the Horned Rat is even worse. The user interface seems all right in early scenarios when you have few units, but after a while, you must control more than a dozen units . You move cavalry and infantry, target archers, designate spells for wizards--all in a "real time" that fights a full day's battle in 10 minutes, and this on a P-60; on the Gateway 2000 P5-133XL, it's far worse. Some units can get all the way across the board in under a minute. You can't slow the game down, and if you pause the game, you can't issue orders to your units. The result more resembles Whack-A-Mole than medieval fantasy war.

There are also some scenarios made hideously difficult because, for no discernible reason, your best troops run away rather than fight certain monsters. Moreover, if you go in with a disk editor and increase your troops' courage, skill, and initiative to ridiculously high levels, they still run away; it's as if the programmers were determined to show the player who is boss.

I fear I never finished Warhammer and thus must withdraw my recommendation. I did complete This Means War and it's fun, provided you're prepared to start over when the random-number g enerator goes insane with the sabotage. Both games, though, show what happens when programmers get the attitude that it's their job to defeat game players. Alas, that happens far more often than it should.

The game of the month is MicroProse Software's Civilization II. This is an improvement on Civilization rather than a fundamentally new game, the way Civilization was, but that's saying a lot. If you liked Civilization, you'll love this.

The other game of the month is Blizzard Entertainment's Warcraft: Orcs and Humans. This is a medieval fantasy game that started a number of trends. It's sort of Sim City with fire and sword, and it's a lot of fun. Then there's Warcraft II: Tides of Darkness, which adds ships, castles, cannons, and a whole bunch of new wrinkles to what was already a great game. Between them, they will probably cut U.S. productivity by about 5 percent....

The book of the month is Wendell Berry's Another Turn of the Cra nk (Counterpoint Press, 1995). Berry is a farmer, an agrarian, and a moralist, as well as a good writer. He has seen U.S. agriculture go from small farms to agribusiness and farming converted into an industrial activity in the name of cheap food. He doesn't like that, and his reasons are both disturbing and well worth thinking about.

The computer book of the month is Windows 95 Answers

The Web site of the month is the BYTE Site. Readers have complained that this column is shorter than it used to be. That's all true, and we're doing something about it. Starting this month, my regular column will b e printed in BYTE, and you can find more on the BYTE Site (see the "Previews" link on our homepage at http://www.byte.com ). Be sure to look it up.

Next month: I'll have more on high-end machines--and yes, I am finally going to get to the Intergraph; also networking and a huge pot full of new software.


Product Information


AMA Family Medical Guide CD-ROM.................$39.95 (estimated)

  Windows and Mac versions
DK Multimedia
New York, NY
Phone:    (800) 225-3362 or (212) 213-4800
Fax:      (212) 213-5240
Internet: 
http://www.dk.
com

Circle 1064 on Inquiry Card.

Diamond SupraSonic 288V+........................$289

Diamond Multimedia Systems, Inc.
Vancouver, WA
Phone:    (800) 727-8772 or (360) 604-1400
Fax:      (360) 604-1401
Internet: 
http://www.supra.com

Circle 1065 on Inquiry Card.

Digital Humans..................................$19.95

Multimedia Medical Systems
Charlottesville, VA
Phone:    (800) 741-6713 or (804) 977-8710
Fax:      (804) 979-3022
Internet: 
http://www.mmms.com/dighuman.htm

Circle 1066 on Inquiry Card.

MicroProse Sid Meier's Civilization II..........Call fo
r price

Spectrum HoloByte, Inc.
Alameda, CA
Phone:    (800) 695-4263 or (510) 522-3584
Fax:      (510) 522-3587
Internet: 
http://www.microprose.com

Circle 1067 on Inquiry Card.

Warcraft: Orcs and Humans.......................$45 (estimated)
Warcraft II: Tides of Darkness..................$50 (estimated)

Blizzard Entertainment, Inc.
Irvine, CA
Phone:    (800) 953-7669 or (714) 955-1380
Fax:      (714) 955-1381
Internet: 
http://www.blizzard.com

Circle 1068 on Inquiry Card.

Zip/Z100P.......................................$239.95

Iomega Corp.
Roy, UT
Phone:
    (800) 697-8833 or (801) 778-1000
Fax:      (801) 778-5763
Internet: 
http://www.iomega.com

Circle 1069 on Inquiry Card.

HotBYTEs
 - information on products covered or advertised in BYTE


Jerry Pournelle is a science fiction writer and BYTE's senior contributing editor. You can write to Jerry c/o BYTE, One Phoenix Mill Lane, Peterborough, NH 03458. Please include a self-addressed, stamped envelope and put your address on the letter as well as on the envelope. Due to the high volume of letters, Jerry cannot guarantee a personal reply. You can also contact him on the Internet at jerryp@bix.com .

Up to the Pournelle section contentsGo to next article: WEB EXCLUSIVE:  Of Java, Visual Basic, and Writing for TVSearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM  
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network