The BASIC Clairvoyant
Even though BASIC gives you great freedom for writing programs, it still forces you to think procedurally; your programs become a series of linked, step-by-step procedures to perform certain actions. Programming this way becomes an exercise in project management: First do this, then do that if something else happens, and so on.
As programs become more complex, these "projects" get harder to manage. Structured programming concepts deal with this complexity by encouraging programmers to break up code into small chunks, and then tie the chunks together with the unfortunately error-prone convention of function calls within, and across, module and file boundaries. Object-oriented programming puts. a new twist on that idea: Make each program chunk a self-contained package of data and the procedures for manipulating that data, and then have the chunks send and receive messages to interact with other chunks.
This scheme provides a "black-box" mentality for program pieces -- the pieces become objects whose internal complexity stays hidden from other objects. But why do you need to think of programs as collections of objects?
The visual environments that are used on computers today give a clue as to why thinking about program objects is important and different. In a visual environment, you choose an action or event after you choose the data that is the target of the action or event. For example, delete character, delete word, delete paragraph, and delete page are simply one command applied to different objects. You must choose the object -- a character, word, paragraph, or page-before you select the command delete.
Object-oriented design techniques package data and the methods of manipulating that data together: The package becomes an object. If you want an object to do things that it doesn't currently know how to do, you create a new object that inherits the capabilities of the old object and then add the new capabilities you want to define. In traditional procedural programming, you set up the action first and then identify the data and supervise every step in the action's manipulation of that data.
Object-oriented programming will influence the development of all languages, including BASIC, over the next several years. Objects contain both code and data, and they manage their own behavior while hiding their internal complexity.
Objects interact with other objects by passing messages back and forth. That way, any object can be changed without affecting other objects. Any programmer can create an object that can interact with any other object; all the programmer has to know is the message-passing syntax.
To adapt to this object-oriented emphasis in programming, BASIC will need the ability to create and manipulate classes and subclasses, which are the principal data abstraction devices of object-oriented programming. BASIC will also need a visual component. After all, the best way to design a form is to draw the form, not write code to reproduce it. With a mouse and a palette of predrawn graphics images, you should be able to combine lines, boxes, and buttons interactively on a screen to design a form for a program. That kind of interactive design of objects should also let you attach to or combine your creations within a program.
Future versions of BASIC will increasingly provide support for this kind of programming. The programs will look different from the BASIC we're used to. A visual BASIC program will be a mixture of code, programmer-written objects, and visually specified objects. With separate windows, you would be able to edit both the visual and code parts of the program.
HyperCard provides an interesting example of this combination of visual and more standard procedural programming. The screen display of the card, with its buttons and display areas, provides the visual field; the script language, HyperTalk, lets you create procedures that relate to the card and the information that the card links with. Although HyperCard is only a partial implementation of object-oriented programming, it forms an understandable intermediate step between procedural and object-level programming.
Another major change in BASIC's future will be its universality. This change will result from BASIC's becoming part of the overall computing environment. BASIC may soon become the equivalent of today's MS-DOS command interpreter, COMMAND.COM. If this happens, BASIC will playa role similar to the one it played in the earliest personal computers--as a universal "macro" language through which users interact with their computers and all the applications they run.
A universal BASIC would come in different flavors. One flavor would serve as a central control language for the computing environment. As an environment control tool, BASIC would be a command-line adjunct to a visual user interface. Another flavor would serve as an embedded language within application programs. Embedded BASIC would allow power users to embellish the performance of their applications, as Lotus 1-2-3 users do today, without having to learn a new macro language for each application they use.
You would be able to use BASIC syntax to tell your application programs to perform their various functions in the order you want them performed. For example, if you needed a certain report each month, you'd be able to write a short BASIC program that tells the application to gather the relevant data, format it properly, and have it waiting for you at the appointed hour. BASIC can provide this power while remaining easy to learn and use. These kinds of changes will keep BASIC vibrant for a long time.
The next 25 years in BASIC's life will probably be even more exciting than the first 25. BASIC's development has mirrored the explosive growth of the personal computer industry: When the hardware was weak, BASIC was pretty cramped, too. The rapid improvements in hardware in the last 15 years have been matched by the growth of BASIC in both power and flexibility. If you haven't looked at BASIC in the last few years, you'll be surprised by how it's changed. Compare Listings 1, 2, and 3 to see the evolution of BASIC from 1964 through 1985.
In the late 1970s, when C started becoming very popular, many people predicted the demise of the COBOL and FORTRAN languages. Pascal was supposed to sound the death knell for BASIC. But all these languages continue to survive. I believe that in the case of BASIC, the language is flourishing. If BASIC becomes a universal macro language, as I think it will, it may outlive all the procedural languages. BASIC may, in fact, outlive us all.