About the Book |
| A quick tour of the third edition can be found at the McGraw-Hill website. I repeat here a portion of the Preface to the third edtiion. | |
| We have made a number of improvements in this third edition of the book, but the main objectives remain the same. This book is intended as an introductory text on object-oriented programming, suitable for use in a one-semester CS1 course, and assumes no prior programming experience from the students. We only assume basic computer skills and some background in algebra and trignometry to solve certain chapter exercises. Those who already have experience in traditional non-object-oriented programming languages such as C, BASIC, and others also can use this book as an introduction to object-oriented programming, graphical user interface, and event-driven programming. The two main objectives of this book are to teach Object-orientation has become an important paradigm in all fields of computer science, and it is important to teach object-oriented programming from the first programming course. Teaching object-oriented programming is more than teaching the syntax and semantics of an object-oriented programming language. Mastering object-oriented programming means becoming conversant with the object-oriented concepts and being able to apply them effectively and systematically in developing programs. The book teaches object-oriented programming, and students will learn how to develop object-oriented programs. The second objective of this book is to prepare students for real-world programming. Knowing object-oriented concepts is not enough. Students must be able to apply that knowledge to develop real-world programs. Sample programs in many introductory textbooks are too simplistic, and they do not teach students techniques to develop large object-oriented programs. In this book, we teach students how to use classes from the class libraries from Chapter 2 and how to define their own classes from Chapter 4. We emphasize foremost the teaching of effective object-oriented design and necessary foundations for building large-scale programs. We will discuss further on this point in the Features section of this preface. New Features in the Third EditionWe would like to take this opportunity to thank the adopters of the earlier editions. Numerous suggestions we received from the adopters and their students helped us tremendously in improving the texbook. For this edition, we focused on improving the strengths of the earlier editions, updating and adding the materials by incorporating capabilities of Java 2 SDK 1.4 class libraries, and removing the materials that have less relevance and significance today. Before we get into the features of the book, first we will highlight briefly the changes we made in the third edition: 1. Full-color pages. We started with one color in the first edition. We introduced the second color in the second edition to enhance the illustrations and the overall presentation of the materials. We took one step further and decided to use full-color pages in this edition. The result is dramatic. Different sections are clearly identified, syntax coloring is used in code listings, illustrations are more lucid, and the overall flow of the pages are very attractive and appealing. Pedagogy has been greatly enhanced by the use of full-color pages. 2. No reliance on the javabook classes. In the earlier versions of Java systems, we did not have an easy way to perform input and output. To work around this shortcoming, many authors provided their own classes which the students can use to perform input and output. To that end, we provided a GUI (graphical user interface) based collection of classes organized into a package named javabook . The situation has improved with the introduction of new Swing classes, most notably the JOptionPane class. In this edition, we will be using the standard classes exclusively for input and output. The javabook package is still available, however, for those who wish to use them. We will discuss more on this in the Features section of this preface. 3. Short sample programs. Many reviewers and adopters requested more short sample programs that illustrate the concepts in a succint manner. We now have numerous short sample programs throughout the chapters. At the end of many sections, we provide one or two short sample programs to illustrate the main concept taught in that section. A complete list of all sample classes (programs) is given in Appendix B. 4. Java 2 SDK 1.4 materials. Many new features are added to the newest Java SDK version 1.4. Not only our sample programs are compatible with SDK 1.4, we actively teach newly added features of version 1.4 such as pattern matching capabilities and assertion features. 5. No applets. We do not teach applets in this textbook anymore. After students cover Chapter 7 and a portion of Chapter 14, they can easily master applets on their own. A short handout on applets is available from our website. 6. Swing classes for GUI. For teaching GUI and event-driven programming, we use Swing classes exclusively. There will be no discussion on AWT-based GUI components. 7. UML notations. UML diagrams are used to document the relationships of the classes in the sample programs. Other diagrams (such as state-of-memory diagrams) will also use UML notations for consistency. Notice that although UML notations are used in these diagrams, these illustrative diagrams are not strictly speaking UML diagrams. FeaturesThere are many pedagogical features that make this book attractive. We will describe the defining features of this book.
JavaWe chose Java for this book. Unlike C++, Java is a pure object-oriented language, and it is an ideal language to teach object-oriented programming because Java is logical and much easier to program when compared to other object-oriented programming languages. Java's simplicity and clean design make it one of the most easy-to-program object-oriented languages today. Java does not include language features that are too complex and could be a roadblock for beginners in learning object-oriented concepts. Although we use Java, we must emphasize that this book is not about Java programming. It is about object-oriented programming, and as such, we do not cover every aspect of Java. We do, however, cover enough language features of Java to make students competent Java programmers. Standard Classes for Input and OutputIn this edition, we decided to use the standard classes exclusively for both GUI and console input and output. We still make the author-defined javabook classes available for use, but there will be no discussion on their use in the textbook We use two javabook classes in Chapter 13 as an illustration of using classes from a programmer-defined package. Other classes can easily substitute for these two javabook classes. Also, some exercises may still suggest the use of certain javabook classes, but its use is not mandatory in solving them. In the first two editions, we provided javabook classes for pedagogical and practical reasons. For the pedagogical reasons, we provided the javabook package because
For the practical reason, we provided the package because the earlier versions of Java did not support an easy way for the beginners to implement the input and output routines. We still feel the use of author-defined classes such as javabook is effective, but many instructors have strong negative reaction to any author-defined classes. Promoting the use of the javabook package was never our objective. Rather, our objective was always, and still is, to teach object-oriented programming. The javabook package was simply a means for us to teach object-oriented programming effectively. If there's a suitable replacement, we would replace it. With the advent of Swing classes, specifically the JOptionPane class, the practical reason for using the javabook classes is eliminated for the most part. Moreover, we can achieve most of the pedagogical reasons for providing the javabook classes by using appropriate standard classes such as String , Date , and others instead. We, therefore, decided to drop the javabook classes in this edition. Full-Immersion ApproachWe wrote a series of articles in 1993 on how to teach object-oriented programming in the Journal of Object-Oriented Programming (Vol. 6, No. 1; Vol. 6, No. 4; and Vol. 6 No. 5). The core pedagogic concept we described in the series is that one must become an object user before becoming an object designer. In other words, before being able to design one's own classes effectively, one first must learn how to use predefined classes. We adopt a full-immersion approach in which students learn how to use objects from the first program. It is very important to ensure that the core concepts of object-oriented programming are emphasized from the beginning.
IllustrationsWe believe a picture is worth a thousand words. Difficult concepts can be explained nicely with lucid illustrations. Diagrams are an important tool for designing and documenting programs, and no programmers will develop real-world software applications without using some form of diagramming tools. We use UML diagrams for the sample programs, and UML notations are used consistently in all types of illustrations. This book includes numerous illustrations that are used as a pedagogic tool to explain core concepts such as inheritance, memory allocation for primitive data types and objects, parameter passing, and others. Incremental DevelopmentWe teach object-oriented software engineering principles in this book. Instead of dedicating a separate chapter for the topic, we interleave program development principles and techniques with other topics. Every chapter from Chapter 2 to Chapter 14 includes a sample development to illustrate the topics covered in the chapter, and we develop the program using the same design methodology consistently. This book teaches a software design methodology that is conducive to object-oriented programming. All sample developments in this book use a technique we characterize as incremental development. The incremental development technique is based on the modern iterative approach (some call it a spiral approach), which is a preferred methodology of object-oriented programmers. Beginning programmers tend to mix the high-level design and low-level coding details, and their thought process gets all tangled up. Presenting the final program is not enough. If we want to teach students how to develop programs, we must show the development process. An apprentice will not become a master builder just by looking at finished products, whether they are furniture or houses. Software construction is no different. The problem with other textbooks is that the authors often dedicate a single chapter to discuss and preach effective software development methodologies, but they never actually show how to put these methodologies into practice. They only show and explain the finished products. But without putting what they preach into practice by showing the development process, students will not learn how to develop programs. And it is not enough to show the development process once. We must show the development process repeatedly. In this book, we develop every sample development program incrementally to show students how to develop programs in a logical and methodical manner. Design Guidelines, Helpful Reminders, and Quick ChecksThroughout the book, we include design guidelines and helpful reminders. Almost every section of the chapters is concluded with a number of Quick Check questions to make sure that students have mastered the basic points of the section. Graphical User Interface and Event-Driven ProgrammingSince modern real-world programs are GUI-based and event-driven, we cannot skirt around them if we want to teach the foundation of real-world programming. Although we teach console input and output and use them in many sample programs, the large sample programs in this book are GUI-based. We introduce Swing-based GUI components in Chapter 7 and present advanced GUI topics in Chapter 14. We feel strongly that GUI and event-driven programming must be taught in CS1, but for those instructors who wish to keep the discussion on user interface to a minimum can omit the entire Chapter 14. Assertions and Pattern MatchingTwo of the new features added to Java 2 SDK 1.4 are pattern matching and assertions. Pattern matching is a very powerful and flexible tool in manipulatiing strrings, and we teach pattern matching with many examples in Chapter 9. Assertion is one of the software engineering techniques to ensure the program reliablity, and finally, the assertion feature is added to Java. In Chapter 8, we explain two key language features--exception handling and assertion--which we can use to improve program reliability. Book Organization
There are 16 chapters in this book, numbered from 0 to 15. There are more than enough topics for one semester. Basically the chapters should be covered in linear sequence, but nonlinear sequence is possible. We show the dependency relationships among the chapters at the end of this section. Here is a short description for each chapter:
|