Introduction to Programming Practice: Pascal
A Global View
The main objective of this is to teach you how to program computers using the Pascal programming language. However, learning to write computer programs is very much like learning any skill, you must first understand the underlying principles upon which the craft is based and then practice, practice, practice.
For example, you can read all the books ever published about riding a bicycle but, until you actually get on one and start pedaling on your own, you will not know how to ride a bicycle. The same applies to computer programming! Here, we provide the second book, the Programming Practice: Pascal, which assumes that you have already familiarized yourself with the Principles of Programming (referred to as Principles): the first book which describes the method behind problem solving using a computer.
“it’s best to learn through examples.” Each uses example programs, many taken from the Principles, to teach the same point. For this reason, you may find the number of examples overwhelming and you should feel free to pay attention to only the examples which you feel best describe the point that is being illustrated.
The Road Ahead
In this, we give a brief summary of what is in each chapter of the Programming Practice: Pascal. A synopsis of each chapter is presented so that you can visualize the road ahead.
- Computing: A short survey of some applications, this introduces software by giving some examples of packaged programs, applications, which perform specific tasks.
- Programming Language: Pascal, in this we further introduce the Pascal programming language by comparing it to natural languages and by using syntax diagrams to help our understanding. Some extremely simple Pascal program examples are given as illustrations of the syntax presented. Although it will take a few more to introduce all of the Pascal syntax, some other examples of complete Pascal programs are also given in this chapter.
- Data and Actions, this continues with the introduction to the Pascal programming language that was started in the last two chapters. Its main concerns are the basic components of the language with some emphasis on the way in which the language is written (i.e. the syntax or grammar) but also on the precise meaning (i.e. the semantics) of what is written.
- The Four Fundamental Forms in Pascal, the goal of this is to introduce the four fundamental forms: Sequence, Selection, Repetition, and Invocation, that are necessary and sufficient to create any algorithm. At the end of the you will have the necessary tools to develop your own programs.
- Pascal with Bigger Blocks, this continues the presentation of the programming language Pascal by introducing other forms, deeper nests, different data types and more details. These complements are not as fundamental or important as the topics of the previous, but are useful and convenient in the development of clear and correct programs. Remember, bigger is not always better.
- Better Blocks: Procedures and Libraries, this presents the creation and use of Pascal subprograms, i.e. the Pascal procedures and functions. Subprograms are often part of libraries, and this introduces the Pascal units that are used to implement libraries.
- Pascal Data Structures, in this we consider the three structured data types: arrays, records, and sets, and how they are used in Pascal. ADTs will also be used to create three libraries: IntArrayLib, ComplexLib, and a Matrix Library
- Algorithms to Run With, the primary purpose of this is to provide more extensive examples of the data structures introduced later. Algorithms to sort and search data structures will be discussed, along with the various ways of implementing stacks, queues, and trees. Also, this chapter will further develop the concept of an “Abstract Data Type” (or ADT) and create the StackLib, QueueLib, and SetLib libraries.
- The Seven Step Method, this implementations solutions as computer programs, and then demonstrates how to verify the correctness of solutions through testing. To reach this solution, the seven step problem-solving method– introduced in the Principles book– will be reviewed and discussed. Although we’ll concentrate on the implementation in Pascal of an already designed program, we cannot ignore the design.
Signs Along the Road
Although each chapter constitutes a stage in our learning journey, introduci new topics and conventions while expanding on others, the same basic pattern is followed:
- Each begins with a Preview that gives a summary of the material that will be presented in the chapter. This will give you an idea of what to expect and introduce you to the major concepts in this.
- Next, the actual material of the is provided, where topics concerning the Pascal language is divided into sections. Since the emphasis through each chapter is that we learn best by example, each section has many sample programs illustrating the Pascal statements being discussed. Most of these examples are taken from the Principles and references are made when appropriate.
- Following this, a Review of the material contained in the is presented. This will serve to remind you of what you have learned and nudge you to go back and reread anything that you have forgotten.
- Finally, each chapter ends with a set of Problems and Programming Projects to solve. These are the most important parts of each. Some chapters contain Programming Problems as well. In any case, programming is an intensely practical skill that can only be acquired by practice. Remember: “Practice makes perfect!”
The Principles of Programming, because it is which explains a great many theories and concepts, includes signs to visually illustrate important points and concepts. However, because the Principles of Programming: Pascal teaches a programming language, it does not include these signs as frequently. If you are not familiar with these signs they are as follows: