Classic Computer Magazine Archive COMPUTE! ISSUE 56 / JANUARY 1985 / PAGE 114


Tom R. Halfhill, Editor

Which Computer Language Is Best?

Most of us have heard the Biblical story about the Tower of Babel—how God made mankind speak in hundreds of different languages for daring to build a tower to heaven.

In the computer age we seem to suffer from a similar problem. We're burdened with scores of different computer programming languages. And like human languages, they're all largely incompatible with each other.

There are, however, definite reasons why we have so many human languages and computer languages. Both were invented because of the need to communicate ideas. The first language for a modern electronic computer was invented in the 1950s for a specific purpose—to make it easier for people to program computers. Today there are scores of different languages and dialects within languages.

Why, then, if computer languages are conscious inventions all conceived for the same reason, do we have so many of them? Why does one language use the word PRINT to put messages on the screen while another uses TYPE? Why weren't words and definitions standardized from the very beginning to eliminate confusion?

A Language For Every Purpose

One answer is that it's no more realistic to expect a single programming language to be suitable for all possible tasks than it is to expect one type of computer to be ideal for every possible application. Another answer is that those who write languages all have their own ideas about how computers should be programmed (or, depending on your point of view, how humans should be programmed to work with computers). In addition, some languages are hard to implement on certain types of computers, especially home computers with relatively small amounts of memory.

That leaves it up to us to sort out the confusion and decide which language to use to get the job done. Generally there are three things to consider: the suitability of the language to the task; the ease of learning and using the language; and the availability of the language on the computer we want to use.

Here's a summary of the most popular lan­guages available today for home and personal computers:

BASIC (Beginner's All-purpose Symbolic Instruction Code). Invented in the early 1960s at Dartmouth College, BASIC was originally designed as a very simple language that beginners could pick up and use with only a few hours of study. Since then, there have been so many extensions and spin-off dialects that BASIC is used to program everything from videogames to powerful business applications. As a result, some people criticize BASIC as a messy, unstructured hodgepodge of commands. Others find it simple, effective, and versatile. Because BASIC has been built into nearly all microcomputers for years, it's by far the dominant language in personal computing. That doesn't seem likely to change in the near future.

Logo. Designed in the 1970s especially for children, Logo is found primarily on home computers and includes turtle graphics, a simplified system for drawing pictures on a video screen. You control a small cursor, the turtle, which can be rotated and moved in different directions while leaving behind a colored trail. Series of commands can be grouped into procedures and executed repeatedly to create geometric patterns. Logo also helps teach logical thinking and organization.

PILOT (Programmed Instruction, Learning, Or Teaching). This language resembles Logo and usually includes turtle graphics. It also has flexible word-matching commands that make it easier to write educational programs which ask questions and evaluate answers.

Pascal (named after Blaise Pascal, the seventeenth-century French mathematician). Invented in the 1970s partly as a reaction to the perceived weaknesses of BASIC, Pascal is known as a structured language and is widely used to teach programming at the college level. Programs written in Pascal usually have a modular, organized construction. Although Pascal doesn't necessarily force this structure on the programmer, it strongly encourages it.

Forth (so-named because it was conceived as a "fourth-generation" language). Forth is an unusual language, known for its speed of execution, flexibility, and reverse Polish notation arithmetic. It's used for many scientific applications, especially in astronomy, and has a vocal following among microcomputer hobbyists. Forth is one of the few languages that can be readily extended by the programmer. It lets you define your own commands by linking together a series of simpler commands. This new command, in turn, can be used to build commands which are even more powerful.

BASIC: Bread And Butter

For most personal computer programming, BASIC is the first choice. Not necessarily because it's the best language—BASIC certainly has its share of shortcomings. However, it does satisfy the three considerations mentioned above: It's a true general-purpose language which can do a lot of things adequately; it's fairly easy to learn and use; and, perhaps most important, it's widely available. Chances are BASIC is built right into your computer as a standard feature. If not, it's available separately at minimum cost.

BASIC runs on practically every computer because it doesn't require lots of memory. That's partly why it was the first language of its type adapted to microcomputers, back in the days when 4K of RAM was considered luxurious. Even the old Sinclair ZX-81, which came with only IK of RAM, had a fairly powerful built-in BASIC. What's more, BASIC usually doesn't require you to buy a disk drive or other expensive peripherals. Nearly all BASICs can work with tape storage.

BASIC has other things going for it, too. The vast majority of program listings published in computer magazines and books are in BASIC. It's not that authors don't submit programs written in other languages. It's just that BASIC is the only language which editors can be sure their readers own. Publishing a program in a language like Pascal or Forth renders it useless to 90 percent of the readership. Unavoidably, of course, this policy solidifies BASIC'S position and perpetuates its dominance.

BASIC also comes in many flavors. If the BASIC that came with your computer isn't powerful or flexible enough for your purposes, you can probably buy an extended or enhanced BASIC. For instance, the BASIC built into the Commodore 64 lacks commands to take advantage of the computer's excellent sound and graphics capabilities. If you want to easily write a program using sound and graphics, you can plug in a Simons' cartridge and gain 114 more commands. Similarly, trade-offs made by the designers of Atari BASIC omitted certain features (such as string arrays) which are considered stan­dard in the more common Microsoft BASICs. If this matters, you can buy an extended Microsoft BASIC on cartridge or disk.

Despite all the criticisms leveled at BASIC, for the foreseeable future it's here to stay.

When To Switch

All these reasons don't mean you're pinned down to BASIC by any means. Here are some situations when you might want to make your computer bilingual:

  • —You're writing a program that simply demands more power, speed, or flexibility than BASIC can deliver.
  • —You're writing programs only for yourself that won't be shared with other people or submitted to general-interest publications.
  • —You've run across a program so useful that it's worth your while to buy the language you need to run it.
  • —You'd like to introduce youngsters to computer programming without bogging them down in the picky details of BASIC.
  • —You're learning another language at school or work and want to practice writing programs at home with your own computer.
  • —You want to explore alternatives to BASIC just out of curiosity.

Second languages are available for most computers on cassettes, disks, and cartridges. Cartridges are handiest because you don't have to wait around for a long program (the language) to load—you just plug it in and switch on the computer. Cartridges are also sturdy and generally don't require a disk drive. But because the memory capacity of a cartridge is severely limited (usually no more than 16K), many languages won't fit in a cartridge and are available only on disk.

If you already know one computer language, such as BASIC, you'll find that it's easier to learn a second language—certainly much easier than learning to speak and read a second human language. Human languages have vocabularies of tens of thousands of words, and the rules of syntax are often vague and conflicting. But most computer languages have a total vocabulary of only 50 to 100 words, and the rules for using them are carefully defined. The computer even tells you when you make a mistake. Plus, the fundamental knowledge you gain by learning your first language lets you adjust fairly quickly to the rules of the new language.

The Computer's Native Tongue

You may have noticed one popular computer language missing from the list above: assembly language or machine language (for now we'll use both terms synonymously).

We deliberately omitted machine language because it isn't quite a language in the same sense as BASIC, Logo, or Pascal. True, machine language is a method of encoding your ideas so that the computer can understand and act on them. In that sense it is a language. But with machine language, you're dealing with the computer on a much more intimate level. You're speaking in its native tongue.

The fact is, languages such as BASIC—known as high-level languages—were invented for people, not for computers. They were designed for convenience, so people wouldn't have to program computers in machine language. Why? Because machine language programming can be more exacting. Sometimes it takes a dozen or more commands in machine language to do something as simple as display a message on the screen. You might accomplish the same thing in a high-level language with a single command such as PRINT.

But it's important to realize that the computer doesn't understand BASIC or any other high-level language any more than it knows English. A high-level language is really a sophisticated program which itself is written in machine language. When you use a command such as PRINT, the BASIC language translates the command into the proper sequence of ma­chine language commands. In this form, the computer can carry them out.

Despite the extra steps required when programming directly in machine language, it's still very popular. That's because the translation process required by a high-level language takes time, and some programs demand all the speed and power that the computer can deliver. A program written in machine language bypasses this translation step and runs much faster. Sometimes it's the only way to get the job done. However, as technology advances and computers get faster and faster, it's likely that fewer programs will be written directly in machine language.

Questions Beginners Ask

QI've seen specifications for computers that talk about graphics modes with 320 X 200 pixels, 640 X 200 pixels, etc. But what's a pixel?

APixels (an abbreviation for picture elements) are the tiny dots on the screen that make up the image. If you look very closely at your computer monitor you can see the dots, although they may be too blurred to see clearly on an ordinary color TV.

All video images are composed of pixels, including regular broadcast video pictures. How­ever, there's no standard size for pixels. They can be large or small. Size is important because the smaller the pixel, the more will fit on the screen, and therefore the more detailed the image will be.

For example, a graphics mode of 320 X 200 pixels means the computer can display 320 pixels horizontally and 200 pixels vertically. That's a total of 64,000 pixels. If the computer has a 640 X 200 graphics mode, it can display 128,000 pixels. With twice as many screen dots to work with, the picture can be twice as detailed. In video terms, the more pixels, the greater the resolution.

It might seem that creating superdetailed computer images would be as easy as displaying more pixels. But there are several technical obstacles to overcome.

To begin with, the information which de­fines how each pixel will appear on the screen must be stored in the computer's memory. The computer must know where each pixel will be placed and what color it will be. The more pixels and colors you want to display, the more memory you need. For example, the IBM PCjr has a graphics mode of 640 X 200 pixels with four colors (SCREEN 6 in Cartridge BASIC). It requires 32K of RAM just to store all this information. A 640 X 200 mode with eight colors would require 64K, and a 640 X 200 mode with 16 colors would eat up 128K.

A related problem is computer speed. The more memory it takes to define how the screen will look, the more time it takes the computer to access that memory. An extremely high-resolution screen could bog down the computer so much that it would run programs noticeably slower. (In fact, to reduce this problem, many computers have separate microprocessors just to control the screen display.)

Finally, there's a limit to how sharply a TV set can resolve a pixel. Computers can be designed to work with special monitors (such as the Apple Macintosh), but home computers must be compatible with ordinary TV sets to reach the mass market.