In its earliest years, Modula-2 was often regarded as an appropriate second computer language, one best studied after the student had mastered Pascal. However, Modula-2 did not simply add modern concepts to its rusty parent; it also inherited all of the clarity, simplicity and utility of Pascal, and is therefore a worthy successor, both in the classroom and for commercial production purposes.
Whether students are already experienced computer programmers or are relative beginners, many want to learn a language or other computer skills, on their own or with some assistance from a formal instructor. All of these need a text which is at once easy to read and yet complete enough to be used as a reference.
It is therefore my hope that this book will be used and enjoyed as much by individual hobbyists and self-taught programmers with their own machines as by the mainframe-linked college and university students who constitute its normal market. After all, microcomputers--and the hobbyists and "hackers" they have brought to the scene--have caused a fresh breeze to blow through the whole realm of computer science. One purpose of this book is to open a window in the ivory tower and let in some fresh air by making Modula-2 accessible to beginning students in the formal classroom in a non-threatening manner. The student-oriented, casual and informal style of this book is therefore deliberately chosen, and in its first two editions, was very well received by students. This, coupled with a very broad coverage of the language, should place it squarely in the mainstream of modern computer education.
It must be kept in mind, however, that this is an introductory book, not an exhaustive treatise, and many things are not covered in depth. It is assumed that this course must be accompanied with or followed by more detailed treatments of algorithm construction and software engineering. Thus, such matters as the software engineering life cycle, object-oriented design, and program verification are discussed only lightly, are under other headings, or are not mentioned at all. On the other hand, it departs from the traditional text by attempting to cover typical data structures topics in an integrated fashion throughout. Instructors who wish to go into EBNF (Extended Backus-Naur Formalism, see Appendix 3) descriptions, or to get right into designing with modular design charts are certainly welcome to supplement this material--it provides an introduction to computer science through a language, but does not cover all possible topics.
Constructive criticism on all aspects of this book will be greatly appreciated. My students, adopters of the second (Merrill publishing) edition, and reviewers have already provided some. I have every intention of keeping this book alive through more editions and of including suggested improvements, especially those of students. After all, they are the "end-users" and their edification is the final judgement on this text.
Finally, a word on the organization of the book itself. The interchapter notes constitute a broad introduction to the history of computing and to important ethical and other issues. They often have little to do (directly) with the programming content, and are intended to help set students in the appropriate cultural context in which this book exists. Old hands or hackers of long standing could skip some of these little words without damaging themselves seriously.
The first five to seven chapters may suffice as an appropriate one-semester introduction to programming for the beginner depending on what topics other than the language are covered. The pace at first is designed to accommodate those who come to the course with only a modest background in computing. The next five to seven chapters could serve as the basis for a second programming course for these same students.
On the other hand, Chapters 7 and following could be selected from to provide the meat of a course for students already familiar with another programming language. These students could skim the first portion of the text in a few days, and begin serious work at Chapter 6. Thus the student with previous computing experience could cover through Chapter 9 (and selections beyond) in a four semester hour course. Depending on how many other topics are to be taken, the remaining material could be incorporated into a subsequent course, replacing the traditional data structures course, because of the integration of material.
This book is intended to provide a relatively complete coverage of the main points of the Modula-2 language, but not for all possible versions of the language. It generally is complete for the ISO standard versions, though some references to others are included as well. With minor adaptations, particularly in those chapters dealing with input, output and utility modules, it should suffice for most installations. Teachers will almost certainly have to supplement those sections dealing with file handling--this is the area in which there is the greatest difference between versions of Modula-2. The author has spent several years on the ISO standards committee for Modula-2 as Canada's representative, and much material from the forthcoming standard has now been incorporated into the text. It is the hope of this committee that all vendors will eventually conform to the standard.
The assignments were kept somewhat general in the last edition, but specific problems from mathematics, business, chemistry, and physics have now been added. No student will want to do them all, nor any teacher to assign them all. Sufficient variety has been provided, especially in the earlier chapters, so that both those with a technical background, and also those wanting only a less technical introduction, can find suitable exercises. My approach has been to assign the general "Questions" to all students, and then to give them several choices from among the "Problems" so as to cater to their particular developing interests.
There are many other ways to select material. For instance, many of the examples and exercises are mathematically oriented, reflecting my own background and interests, but the general flow of the book does not depend heavily on this orientation. It is possible for an instructor to change this to a large extent for students on a less technical track. After all, a classroom teacher designs all her own examples for the lectures in any case, so these can (and probably should) represent a very different group of problems.
In the latter chapters, some of the problems are quite challenging, and could be made the basis for major programming projects, even in a second or subsequent course.
Note that numerous changes were made to the HTML version for the 1997 and 1999-2000 edition. In addition, Chapters 12 and 13 were reversed; a new chapter of Generic Modula-2 was inserted before the original Chapter 16; some material that was out of place in chapter 7 was removed; and many small improvements were made. At this point, Chapters 1-7 are an introduction to programming; Chapters 8-12 make a good second course; Chapters 13-16 are intended for a course in data structures, and Chapter 17-19 are the first of several more in an advanced programming course. Note, however, that chapter 19 can also be used at an earlier and introductory level, perhaps in conjunction with a seminar introducing object oriented programming. Some additional exercises were added for the 2004-2005 edition.
This book does not attempt to fully document all the features that may be available in every Modula-2 installation, nor does it attempt to teach how to operate any particular operating system. Such matters are the responsibility of the lab instructor and student. I would suggest that students should be very familiar with the editing, filing, compiling, and linking functions of their particular system no later than by the time they finish Chapter 1, so as not to impede progress through the rest of the book.