lundi 6 avril 2009

A comprehensive Introduction to Object-Oriented Programming with Java




This book introduces the basic concepts of object-orientation in Java. It is intended for beginners such as CS1 and CS2 classes. This book must not be taken as a reference by people seeking for deep explanations and motivation on key concepts. This book may not be used for more than giving an introduction.

This book is organized into 21 chapters (numbered from 0 to 20). Chapter 0 is an optional chapter. It provides a general background on computers and programming languages. Chapter 1 provides in 14 pages the essence of object orientation, software engineering and software development methodology. Chapter 2 covers the basics of file editing, compiling and program execution. Simple examples are clearly described. Chapter 3 is about numerical data.

Chapter 4 teaches the basic of creating programmer-defined classes. This chapter covers visibility modifiers, local variables, and passing data to messages. Chapter 5 presents the need of the if and switch statements. Chapter 6 explains the repetition statements while, do-while, and for. Pitfalls in writing repetition statements are presented. The author argues that one important pitfall is to avoid the use of float or double for the data type of a counter variable. Section 6.10 is about recursive methods. This section is marked as optional.

Chapter 7 is the second part of creating programmer-defined classes. It introduce the this pseudo variable. Chapter 8 is about exceptions. Chapter 9 covers non-numerical data types including characters and strings. Chapter 10 teaches arrays. Chapter 11 presents searching and sorting algorithms and provides background on algorithm complexity. Chapter 12 explains the file I/O (e.g., File, JFileChooser).

Chapter 13 discusses inheritance and polymorphism and how to use them effectively in program design. Chapter 14 covers GUI and event-driven programming. Chapter 15 covers recursions. Chapter 16 covers contiguous and noncontiguous memory allocation schemes and introduces the concept of linked lists. Chapter 17 covers generics. Chapters 18, 19 and 20 introduces the concepts of abstract data types such as lists, stacks, and queues.

Numerical operations and number manipulation is at the heart of Chapter 3. Solving mathematical equations are part of the proposed exercises. Putting this chapter so early in the book organization may hamper readers from entirely focusing on the Java language and object-orientation. In addition to solving these equations, difficult part of the Java language such as casting between numerical primitive types are presented in this chapter. People without a strong mathematical interest may find the need for this chapter at a so early stage irrelevant.

Inheritance and polymorphism are introduced in the book organization very lately (Chapter 13). Talking about the collections framework (Chapter 10), sorting and searching (Chapter 11) before having a clear description of inheritance is risky. Page 738 provides the following design guideline “Use the Java interface to share common behavior. Use the inheritance to share common code.” Hard to not see this guideline as misleading or wrong. Making classes use an interface guaranties that a common set of messages will be understood by instances of the classes at runtime. It has nothing to do with behavior sharing. Inheritance should not be used to share common code, but rather expressing specialization. This is quite surprising to have introduced the if and switch statement in Chapter 5 and presenting polymorphism in Chapter 13. One application of polymorphism is to prevent the usage of switch by applying the double dispatch design pattern.

Using this book as a lecture support must be done with care. The book has a strong mathematical focus and the presentation of the key concepts of object-orientation do not provide sufficient insight to fully convey the benefit of object-orientation and Java over procedural programming.

Aucun commentaire:

Enregistrer un commentaire