Turbo Pascal
Authors: Elliot B. Koffman
Venue:  (1993)

From the Book:PREFACE: Since the last revision of this book, there have been no new revisions to Turbo Pascal. However, there has been a vast increase in interest in the Internet and the World Wide Web. For that reason, we decided to u pdate this book by adding a chapter discussing the Internet and World Wide Web. This chapter explains how the Internet works and also tells students how to access the World Wide Web as a general resource and as a source of more information about this book. Students can download program files for this book directly from the book's website. The new Chapter 19 provides information on how to do this. This textbook is intended for a first course in problem solving and program design using Turbo Pascal (version 7.0). It assumes no prior knowledge of computers or programming, and for most of its material, high school algebra is sufficient mathematics background. A limited knowledge of discrete mathematics, however, is desirable for certain sections. This edition, like its predecessors, closely follows the recommendations of the ACM Computing Curricula Task Force for CS11 and CS22 and the ACM/IEEE-CS Joint Curriculum Task Force.3 We emphasize problem solving, abstraction, and software engineering throughout the text. New in This Update: Internet and World Wide Web Chapter Chapter 19 provides an introduction to the Internet, discussing how the Internet works and how students can access the World Wide Web through a web browser. It also describes the use of search engines and demonstrates how students can access the website for the textbook to download program files through FTP. Finally, it discusses Hypertext Markup Language(HTML)and shows students how to use it to create their own web documents. Problem Solving The connection between good problem-solving skills and effective software development is established early in Chapter 1 (Overview of Computers and Programming). This chapter also introduces the Turbo Pascal integrated environment. The software development method, introduced in Chapter 2 (Problem Solving and Pascal), is used to solve the first case study and is applied consistently to all the case studies of the text. Chapter 3 (Functions, Procedures, and Graphics) continues the emphasis on problem solving by discussing top-down design, divide-and-conquer, solution by analogy, and generalization of a solution. An important section of this chapter demonstrates how a Pascal program can be derived by editing the documentation that results from systematically following the software development method. Graphics This edition contains an introduction to computer graphics. We describe Turbo Pascal's graphics procedures in Chapter 3 (Functions, Procedures, and Graphics), graphics animation in Chapter 6 (Modular Programming), and user interfaces in Chapter 9 (Software Engineering and Units). Software Engineering The text covers many aspects of software engineering. Discussions of program style issues appear throughout in special displays. The concept of a program as a sequence of control structures is introduced early in Chapter 4 (Selection Control Structures: if and case Statements). Several chapters include sections that discuss algorithm tracing, debugging, and testing. Chapter 9 (Software Engineering and Units) is a complete unit on software engineering. This chapter discusses the system/software life cycle (SLC), prototyping, and programming teams. The in-depth coverage of all phases of the SLC includes more discussion of informal techniques for program testing (e.g., glass box versus black box testing, integration testing, structured walkthroughs) and formal methods for program verification as well as a discussion of loop invariants. This chapter also reviews procedural abstraction and introduces data abstraction. At this point, we introduce Turbo Pascal units and use unit Crt to create a windowlike interface. We also show how to write your own units to implement procedure libraries and abstract data types. Chapter 9 concludes with a discussion of professional ethics. Procedural Abstraction Although there is no universal agreement on when to introduce procedures and procedure parameters, most educators do agree on the following points: Procedures should be introduced as early as feasible, procedures should never process global variables (side effects), and procedure parameters are a difficult concept for students to understand. The approach taken in the text is to discuss the importance of program modularization and reusability in Chapter 3 by introducing the standard functions, structure charts, and procedures without parameters. The chapter motivates the use of procedures as program building blocks by showing some applications of procedures without parameters (for example, by displaying long lists of user instructions and drawing diagrams). Chapter 3 then discusses, in Section 3.5, the need for parameters and the limitations of procedures without parameters, thereby providing a foundation for the later study of parameters. Section 3.6 introduces Turbo Pascal's graphics procedures and demonstrates their use. Chapter 6 (Modular Programming) completes the study of procedures and functions, covering all aspects of parameter lists. The chapter begins by discussing procedures with only value parameters, then value and variable parameters, and finally functions. An optional section at the end of the chapter introduces recursive functions. Some instructors prefer to cover procedures with and without parameters together. To this end, you can easily rearrange the sequence of topic coverage. If you want to wait until Chapter 6 to cover procedures with and without parameters, defer Sections 3.4 and 3.5 until then. Conversely, if you want to cover procedure parameters earlier, cover Section 6.1 (introduction to parameter lists) right after Chapter 3 and cover Sections 6.2 and 6.3 (variable parameters, syntax of parameter lists) after completing the first three sections of Chapter 4 (control structures, Boolean expressions, and the if statement). Data Abstraction and Object-Oriented Programming The software engineering chapter (Chapter 9) introduces data abstraction, providing the first example of an abstract data type (ADT). We introduce enumerated data types and show how to encapsulate a data type and its operators as a Turbo Pascal unit. Data abstraction and ADTs are used extensively in the advanced topics portion of the textbook, starting in Chapter 13. Chapter 13 (Data Abstraction and Object-Oriented Programming) introduces Turbo Pascal objects and object-oriented programming (OOP) and includes a discussion of inheritance. Objects and OOP are also covered in Chapter 17 (Pointers and Linked Lists) and in Chapter 18 (Dynamic Data Structures). Interviews with Computer Scientists A popular feature of the last edition was a collection of interviews with notable computer scientists (Adele Goldberg, David Patterson, and Patrick Winston, among others), which were placed throughout the text. These interviews alert beginning students to the breadth of the subject area, providing them with a description of issues of concern in several fields of computer science (for example, artificial intelligence, operating systems, databases, user interfaces) and some idea of the background preparation needed for success in these fields. We have updated these interviews and provided several new ones in the 5th edition. Coverage of Theoretical Concepts This edition covers theoretical topics recommended by the curriculum committee report. An optional section in Chapter 7 introduces numerical computation and iterative approximations. Chapter 9 provides a discussion of program verification, focusing on assertions and loop invariants. Chapter 10 introduces searching and sorting of an array followed by a discussion of algorithm analysis and big-O notation. Pedagogical Features We employ several pedagogical features to enhance the usefulness of this book as a teaching tool. Discussion of some of these features follows. Approximately one-third of all exercises, review questions, and programming projects are new to this edition. End-of-Section Exercises: Most sections end with a number of self-check exercises, including exercises that require analysis of program fragments as well as short programming exercises. Answers to odd-numbered self-check exercises appear at the back of the book; answers to the rest of the exercises are provided in the Instructor's Manual. End-of-Chapter Exercises: Each chapter ends with a set of quick-check exe rcises and answers. Immediately following are chapter review questions, whose solutions appear in the Instructor's Manual. End-of-Chapter Projects: Most end-of-chapter projects include one or two special programming project pairs in which the second of the pair requires a modification to the solution of the first project. Solutions to the first project in each pair are available from Addison-Wesley. All project solutions appear in the Instructor's Manual. Examples and Case Studies: The text contains a large number and variety of programming examples. Whenever possible, examples contain complete programs or procedures rather than incomplete program fragments. Each chapter contains one or more substantial case studies that are solved following the software development method. Syntax Displays: The syntax displays describe the syntax and semantics of each new Pascal feature and then provide examples. Several syntax diagrams appear in the body of the text; an appendix contains a complete collection of syntax diagrams. Program Style Displays: The program style displays discuss issues of good programming style. Error Discussions and Chapter Review: Each chapter ends with a section that discusses common programming errors. Chapter reviews include a table of new Pascal constructs. Coverage of Advanced Topics The material in Chapters 1 through 12 normally will be covered in the first semester of a course in programming methods. The book contains six additional chapters that cover advanced topics normally studied in the second semester or in the first semester of an accelerated course. This material may be used as a reference for students continuing their study of computer science and, in some cases, may be used as the primary text for a second-semester course. There is certainly sufficient material for a two-quarter sequence. Advanced topics covered include: Data abstraction and object-oriented programming (Chapter 13) Recursion (Chapter 14) Sets and strings (Chapter 15) External data structures: files (Chapter 16) Pointers and linked lists (Chapter 17) Dynamic data structures (Chapter 18) Appendixes and Supplements Appendixes: The text concludes with separate appendixes covering the Turbo Pascal environment, language elements, compiler directives, syntax diagrams, and the ASCII code. Program Files: For case studies, all procedures and functions are incorporated in a single program file. Also available are files containing solutions to selected programming projects. These solutions serve as the starting point for follow-on projects. These files can be downloaded from Addison-Wesley's website and loaded into the Turbo Pascal environment. An icon like the one in the margin appears alongside each program module or project directing the reader to the website at ...