Acorn User


Pascal For Basic Programmers

Author: Chris Drage
Publisher: Addison-Wesley
Machine: BBC Model B

 
Published in Acorn User #029

Practical Guide To Pascal

Pascal For Basic Programmers

Both Basic and Pascal are computer languages that have been adapted well to microcomputers. Although similar in many ways, there are marked differences, strengths and weaknesses. No doubt an extended, structured Basic is the right language for beginners on microcomputers. (Do I hear cries of dismay from the structuralists?) It is ideal for small computers with limited memory capacity since it can provide immediate response to program changes, which is useful for the novice programmer. Pascal, however, offers increased sophistication and power to everyday programming.

The book is totally orientated towards the micro owner who is familiar with Basic and who wants to investigate the power, structure and convenience of Pascal.

It is in five parts: first, a chapter that will allow 'hands-on experience' with a suitable micro right away, with a subset of Pascal; second, there's a simple discussion of the process of translating high-level languages into machine code (including the influence on the varieties of Pascal); third, a section on the practical aspects of programming; then a description of the process of planning and writing a Pascal program (two helpful illustrative programs are included); and lastly the book contains a very useful Basic-to-Pascal 'phrasebook'.

The book compares Microsoft Basic and UCSD Pascal, both of which the authors claim are "the most popular forms for microcomputers".

The first chapter gets the reader to grips with Pascal without throwing him or her into the deep end. By focusing on the manner in which the simplest programs are organised, the different approaches of the two languages to control statements are emphasised. At a very simple level Pascal seems more cumbersome and wordy than Basic, but the authors reveal the virtues of Pascal in the later chapters.

This introductory chapter is a real gem. It provides that most essential element for a newcomer, immediate understanding and success. After an evening typing in the simple examples given, I had a clear idea of how Pascal is organised. The text is so clear I found myself well motivated to read on to discover the various control statements, syntax and structure of the language. The authors have cleverly devised this initial taster for 'dabbling-in-the-language', analogous to learning a few travellers' phrases in a foreign language before beginning a really serious study. Also, it sets the theme for the whole work, that of moving from what is familiar (programming in Basic) to what is unknown and new.

With the aid of so many concrete examples, transferring to Pascal is far easier than I first anticipated, and I began to accept that Pascal has many advantages over Microsoft Basic. As the book points out, it is superior for longer programs as it can organise them into semi-independent pieces. It doesn't merely encourage the programmer to write in a structured way, it makes him! The advantages are obvious - readability and easy debugging of all programs.

The authors are quick to point out the speed at which Pascal programs run compared to their Basic counterparts but add that such a comparison is irrelevant. On a micro, machine time is free and programmmer time precious. The real virtue of Pascal is that the organisation it forces upon a program reduces program development time, making it possible for the micro-user to accomplish something in the limited time available. (Dare they imply that people don't enjoy spending hours debugging Basic programs?)

When Niklaus Wirth drew up the specification for Pascal, he knew it would enhance its value to make it available for a number of different computers. Seiter and Weis give a detailed explanation of how high-level languages are either interpreted or compiled into machine code, and present a convincing argument for UCSD Pascal. Because it adopts an intermediate approach, no matter how microprocessors develop in the future, UCSD Pascal will be in a uniquely strong position for universal implementation (possibly the standard for computer literacy in the 1980s-90s).

This is an opinion to which I wholeheartedly subscribe. The extended 'structured' Basics (such as BBC Basic) can at best offer only limited structural features. They are essentially machine-tied and non-portable.

Much of the rest of the book explains in detail each aspect of the language, from simple assignment statements through to procedure nesting. At each level copious examples are given to illustrate or extend points made in the text, emphasis being progressively shifted from Basic in the early stages to entirely Pascal in the latter.

The final section of Pascal For Basic Programmers compares MBasic (version 5.2) with UCSD Pascal (version 2.0). This section is essentially a dictionary which enables programmers to access quickly the operation they require (in Basic) and find the equivalent operation in Pascal.

Frankly, it is difficult to fault Pascal For Basic Programmers. Seiter and Weis have a considerable understanding of the learning process, and the text is characterised by its clarity and considered approach.

For any serious programmer wanting to take advantage of the discipline of Pascal, this book is an important step to successful applications programs. Rather than simply translating Basic statements into Pascal, it stresses the process of programming in Pascal and thereby shows the reader how to take full advantage of its power and adds up to a practical, informative guide to learning to use that power.

Chris Drage