©1982-2015, John E. Miller.
A computer is an information server. When we use a service we must tell the server what we want. Movies and Television have created the image of computer as God rather than slave. We invented the computer just as we invented the loom. We have created computer programs to serve us through these machines. The computer has no natural high-level ability to serve. It is hardware, like the loom. A program, like a pattern to be woven into cloth, is the software that the hardware serves. Programming is a human activity that creates new software.
The computer is an artifact of human ingenuity. We invented the computer out of necessity. We invented programming languages because we invented computers. Chapter One traces this development and introduces the particular language we will be studying.
The computer is a number cruncher. That is how it got started, grinding out tables of logarithms and various functions. Chapter Two deals with this numerical aspect of computing, numbers, variables, operations, functions. We tell the computer what numbers to crunch and how through arithmetical expressions.
The computer is a symbol manipulator. Since a symbol may be represented with a number, a program may compare two symbols for equality. Chapter Three is a short chapter that introduces the concept of string literals and string variables. String manipulation is deferred till Chapter Nine.
The computer is a rational instrument. Computation is more than addition and subtraction, it includes comparison and decision. Virtually every non-trivial problem requires some comparison to be made and different courses of action to be taken as a result. While this concept is introduced in Chapter One, Chapter Four is another short chapter that covers the writing of relations and logical expressions in depth.
Chapter Five introduces the B-machine, a model computer. The model is used to explain concepts in the remainder of the book. While Chapters Two, Three, and Four focus on expression writing, Chapter Five covers the details of writing simple statements which trigger the flow of information from one point to another in the machine.
Chapter Six addresses the problem of creating control-flow structures within a program. It shows how to make a compound statement consisting of simple statements and a control statement. The foundation for structured programming is laid by introducing templates for creating the structures. Nesting of loops, routines and structures is also introduced.
Chapter Seven explains how a computer can represent information, how we measure the quantity of information in bits and bytes, and that it takes space to store and time to transmit information.
Chapter Eight is all about arrays and subscripted variables. Routines are given for inputting, printing, searching, shuffling, and sorting arrays. Arrays may be adapted for a variety of purposes as shown or in ways never used before. Other textbooks introduce arrays somewhat earlier. The dimension of a variable, subscripts, and matrices all overwhelm beginners. This chapter opens a new category of problems; problems unimaginable with simple variables.
Chapter Nine is the last hurdle to jump in learning the BASIC language. The computer, as an information server, must store and retrieve data. A gamut of programs portray file processing as the filtering of information. Text files and string manipulation are developed individually and then combined to show how information can be transformed.
Chapter Ten presents a general approach to problem solving. The problem of specifying problems is discussed, then the logical design of a program is sketched. Pseudo-code is introduced as an intermediate between the design and the writing of a program. Pseudo-coding is introduced here later than in other texts. Program structure is introduced in Chapter Six. Chapters Seven, Eight, and Nine introduce the notion of data structure. Chapter Ten combines the notions of program and data structure to meet the challenge of generalized problem solving.
This book will shock a lot of old-timers. Nothing conventional was done just for the sake of conventionality. The practice of flowcharting has been on the way out for many years but the old forms persist and are even cursed by other authors. The flowgraphs introduced in this book are not intended to replace flowcharts. Flowcharting served its purpose and has been replaced by more useful practices. The flowgraphs are aids that allow concepts and structures to be seen before being examined in BASIC. One should be able to relate to the flowgraphs without prior programming experience. It would be educational to flowgraph programs, but it is not imperative.
Other unconventional aspects include the use of syntax diagrams to describe BASIC and the use of a new model of a computer as seen by the BASIC programmer. The classical model of input, central processing unit, output, etc,... is outmoded. The author has found syntax diagrams instructive, although most students find anything to do with grammar distasteful. This is an unfortunate attitude to which teachers have yielded in the past. This trend is reversing. The fact that an entire program is a single grammatic unit cannot be denied. Bad program structure is as unacceptable as unbalanced parentheses. Recent text books are using watered-down versions of meta-languages to describe the grammar of BASIC. (A meta-language is a language used to describe another language). Such meta-languages preceded the use of syntax diagrams in the definition of other languages. The author sees no reason why the same will not happen with BASIC, although it is "common knowledge" that syntax diagrams are for use only by eccentric computer scientists. This is folklore. Attention to grammatic detail is not stressed out of proportion nor is it swept under the rug. Without appropriate courseware (instructional materials) it is unrealistic to demand discipline.
A new standard for BASIC is in the works. This book stays within established minimal forms. In places where it was unavoidable, hypothetical statements were introduced. The student should have access to a BASIC manual for his system. Such manuals are written for reference, not necessarily for instruction. Long variable names and virtual arrays are used for instructional purposes but are non-standard. The non-standard features and hypothetical statements are noted in the text.
This book evolved from classroom presentations over a period of four years. It may be used for a partial or full-credit high-school, college, or graduate-level course by setting the amount of course work and whether to include arrays and files. Two programs in Chapter Two, NORMAL and TRAPEZOID, may be too mathematical for some readers. They may be passed by without great loss. Section 2.7 may be omitted if time does not permit its inclusion in a course. This is a difficult section but has its rewards if studied and mastered.
The following gives the approximate time needed to cover the material in one-hour lectures.
Chapter Lectures Topic ---------------------------------------- 7 1 The Structure of Information 1 1 The Evolution of Programming Languages 1 A BASIC primer 2 3 Arithmetic Expressions 3&4 1 Strings and Logic 5 2 PRINT Statement 6 1 Alternation and Repetition Structures 1 Routines 8 1 Introduction to Arrays 1 Array Searching 1 Array Sorting 9 1 Introduction to Files 1 File Processing 1 String Manipulation 1 Virtual Arrays 1 Systems 10 ? Structured Programming
Suggestions and other material will be available in the instructor's guide. The student may read the book from front to back if it is not desired to have the lecture on information at the start of the term. I recommend that Chapter Seven be read first and then again later.
Several of my colleagues help has been valuable: Martin Waugh's suggestion to put flowgraphs on an isometric grid; Bob Owens' early review of the book; Ellen P. Jean's encouragement and proofreading.
I thank Marilyn Reiher for her persistence in persuading me to write a prospectus.
I thank my friends who have listened to my various ruminations, especially Jim Hoag. There is a little bit of all my friends in this book, to be sure.
And most of all, I thank all my students who gave their feedback, sometimes in the form of bewilderment. Without their interest, this book would be very obtuse, or perhaps never have come to be.
John Miller May 1983
JoHN MiLLeR's Home Page
Created By: john@timehaven•us