In 1983 Borland changed the face of PC programming with the release of Turbo Pascal 1.0. Before that, languages were expensive, unwieldy, command-line driven affairs which ensured that programming remained the exclusive preserve of programmers. Borland provided an environment which integrated a full-screen editor with a lightning fast compiler at an unbelievably low price; suddenly programming was accessible to ordinary people.
However, programming for Windows has remained entirely within the remit of professional programmers. For a start it was much more complicated than programming for DOS , and the tools required were expensive.
But now Borland has released Turbo Pascal for Windows (TPW) which is not only cheap but makes programming for Windows much easier than it’s ever been before.
This is a big package, taking up 6.5Mb. TPW arrives on four 3 1/2-inch disks and takes about 10 minutes to install. Not surprisingly, it’ll only run under Windows, where it presents a typically attractive Windows interface. There are pop-down menus, scross bars and all the other visual extras you expect when using Windows. Your source code can appear in one window while the compiled version of it is running in another; you can have multiple source code files open (up to 32) in different windows; and you can even have multiple copies of the same (or different) compiled files running at the same time.
ObjectWindows is the heart of TPW. It’s a collection of objects for building and controlling windows, dialogue boxes and controls. Borland has essentially put all the difficult coding into a series of objects.
As long as you’re familiar with object oriented programming (OOP), you can use them — but there’s more than that.
Just as you don’t need to know how an engine works in order to drive a car, you don’t need to know how these objects work in order to drive them. This ability to wrap up functionality inside an object has always been a strong selling point of OOPs, and I can think of no better justification of their use than in Windows programming.
In Windows terminology, resources are entities like buttons, cursors and icons. To avoid having to code these each time you develop a new program, Windows allows programmers to store them in a ‘resource file’. These resources are handled and generated by the Whitewater Resource Toolkit (WRT) which is supplied with TPW. Once constructed, a resource file acts as a reservoir of useful bits which can be called by any other program that you write.
The WRT provides drawing packages for the construction of resources like cursors and simplifies the process of managing resources and moving them between resource files. Making these facilities widely available is going to generate much more variation within Windows than we’ve seen so far. The buttons used in TPW, presumably developed with the WRT, are imaginative and fun to use — and they’ll help programmers to stop Windows programs all looking the same.
The Editor is a fairly typical Windows offering. The scroll bars can be used to move around, and you can cut and paste sections of code in the expected manner.
There have been complaints in the past about the lack of a decent Undo facility in Borland’s editors, but this one seems impossible to fault. It can be set to undo every single keystroke, or to treat keystrokes as groups and undo them in logically cohesive blocks. A separate buffer is set aside to hold the edits performed in each window, and the buffers seem adequate for a very large number of changes to be recalled.
I tried everything I could think of to upset the undo system and it never failed to restore my changes.
The help system is there, as you might expect, with both the normal sort of Windows help and the language-specific help (Ctrl-F1) which I’ve found so useful in the past. Borland has also supplied a manual called the Borland Languages Help Compiler, which tells you how to write Windows help systems for your own applications. This not only details the mechanism by which help systems are constructed but is also full of helpful hints about conventions and consistency.
TPW only compiles to disk, so a fast hard disk will increase the apparent (and indeed actual) speed of the compiler. A trivial program (220 lines) on a 33MHz 386 with a fast hard disk took about a second to compile. Borland says it runs at 85,000 lines per minute on a similar machine, so it’s fast.
The debugger comes as a bit of a shock; even though it’s accessible from the IDE, it isn’t a Windows application. The debugger can only operate in text mode (although it’s mouse driven) and has the look and feel of earlier offerings from Borland. But it’s clear that this is a powerful tool.
Features that five years ago were a revelation now seem only worth mentioning in passing. Breakpoints can be set and variables watched. The code can be stepped through line by line and you can step backwards through the code. For those who need to do serious work it’s possible to debug using dual monitors, one showing the program and the other the code.
The class hierarchy browser that Borland introduced for object oriented work is here, and it’s designed to allow you to examine the objects that you’ve created.
New features especially for Windows applications include novel breakpoints which can be set based on messages received by the application during execution. These messages can be trapped or just logged. Local and global heap dumps maintained by Windows can be viewed using the Turbo Debugger.
Most people who intend to use TPW will probably have some experience of using Turbo Pascal (although the manuals are written for complete beginners) and will want to know how their old programs will run. A unit called WinCrt provides support for those old favourite commands which were used in DOS to put text on to the screen: commands like ClrScr, GotoXY and KeyPressed. Including WinCrt at the start of simple text-based programs automatically creates a standard window, and these commands will behave much as they did under DOS.
Clearly, the point of Windows is that it offers much more than DOS, so simply altering text-based programs until they’ll run in a Window is rather to miss the point. Nevertheless, it’s nice to see old dogs of programs suddenly appearing in a neat, scrollable window. One of mine dates from Turbo Pascal 3.0 days and has become a Windows application with the addition of the single line Uses WinCrt.
I like TPW a lot. It’s the most attractive programming environment I’ve ever used, and the compiler is blisteringly fast. It makes programming Windows applications feel less like sticking your head in a bucket of coal and more like fun.
The editor has an unbeatable undo facility, the documentation is good, and I love the whole package. So, don’t delay. If you’ve ever fancied being a Windows programmer, go out and grap a copy.