Monday, April 27, 2009

Book Review – Head First Object Oriented Analysis and Design

HeadFirstOOAD-McLaughlin[2] The Head First series is an interesting approach to presenting technical material. It includes many different teaching styles within each book including; graphics, quizzes, exercises and a variety of presentation styles. This makes this series of books interesting to read and allows you to move through the material quickly.

Head First Object Oriented Analysis and Design (OOA&D) is the first Head First book I have read. The presentation style used throughout the book keeps the material interesting and easy to digest. I found myself reading through this book very quickly and I was impressed in how easy it was to remember the material from chapter to chapter. The frequent reviews and quizzes help to keep the information fresh in your mind as you work through the book.

Most of the examples in the book are written in Java so some familiarity with the language makes the examples easier to follow. However, the code is used to demonstrate the usefulness of objects and how they can relate to one another. Making it possible to still follow the design principals even if you don't know any Java at all. All of the examples follow the three steps to great software writing.

  1. Make sure your software does what the customer wants it to do
  2. Apply basic OO principals to add flexibility
  3. Strive for a maintainable, reusable design.

The first example in the book is a fictional guitar store. You are asked to design an application for managing the inventory of the store. Of course my first thought was to use a database, Advantage would be a good choice :), but the book uses classes instead of a database. The classes do an excellent job of demonstrating the Object Oriented principals described in detail throughout the book

In order to demonstrate more design principals we are presented the problem of creating a doggie door. Our door goes through several iterations demonstrating an incremental design and the importance of creating a flexible program to begin with. We then revisit our guitar store and find that the owner wants to sell different types of instruments. This allows for some refactoring of the original application.

The last section of the book discusses big problems. In this section we are asked to design a game framework. Using a "real world" example provides a framework for introducing the principals of design. First a feature list is created based on the customer's input. After the features are determined use cases are developed to ensure that the program will meet all the requirements. This process is broken into three sections, Architecture, Design Principals and Iteration and Testing

In the Architecture section the really big problem, in this case a game framework, is defined and broken down into smaller pieces. Once the pieces are determined it is time to determine how they will fit together. Things like deciding which pieces need to be built first and identifying dependencies. This is done through the three Q's of architecture.

  • Is it part of the essence of the system?
  • What the heck does it mean?
  • How the heck do I do it?

The design principals chapter discusses several principals including; The Open-Closed Principal (OCP), Don't Repeat Yourself (DRY)Principal, Single Responsibility Principal (SRP) and Liskov Substitution Principal (LSP). Each principal is summarized and a step-by-step example is given. The principals are reinforced with exercises after each principal using the examples from throughout the book. I found this chapter full of good information.

The iteration and testing chapter describes two basic iteration types. Focus on specific features, completing one piece of functionality at a time, or focus on specific flows, which complete a flow through the application with all the relative functions. The choice is yours to make but the authors suggest you choose the mechanism that makes your customer happy. Both these approaches are demonstrated by building the game framework which allows for a good discussion on testing.

The last chapter discusses the lifecycle and does a good job of wrapping all the concepts up into a nice package. This is highlighted by walking through three iterations of the game framework example. Again many exercises are provided in the chapter which reinforce the material in an entertaining way.

Make sure you check out the first appendix which is a collection of the top 10 things that are not discussed in detail in the book. These include things like Use Case Design, Unit testing and readable code. All of these topics could be examined in more detail but this chapter provides a good summary of each of the topics.

The bottom line: I found this book a very interesting read. I learned a lot from the book through the examples and detailed discussion of Object Oriented principals. I think that the unique approach used by the Head First series keeps the reader's interest and presents the material in several ways. The examples used throughout the book were interesting and did a good job of demonstrating the various principals. There is also a very complete appendix which gives a good overview of Object Oriented programming. This appendix was a great review of OO principals and could also serve as a quick introduction. I'll be reading more Head First books in the future.

1 comment:

Evan said...

I have a important question for you. Can these object oriented concepts used in javasciprts as well. I know the java is a pure object oriented language, but javascripts are client-side scripting. Still they both follow programming rules. So is it possible>

Regards,
Creately