Author: Kathy Sierra & Bert Bates
Publisher: O'Reilly, 2nd Edition, 2005
Aimed at: Sophisticated beginners
Pros: Use of object-oriented philosophy
Cons: Doesn't get to Swing and the UI until late chapters
Reviewed by: Alex Armstrong
This is a Head First book and you'll either love or hate the distinctive format.
This comment needs to be included at the start of each and every Head First review. The books are all a riot of layout, pictures, bad jokes, quizzes, asides and various other devices to make learning easier. They either work for you or they don't. If they don't move on to a review of another Java book.
If they do then you have a lot to interest you. Head First books aren't all the same, despite the fact that they use the same stock photos and formats. Some of them succeed better than others and mostly the reason is the level of the approach and the logic of the approach. Even in the chaotic world of a Head First book it does matter what order you choose to introduce ideas in.
In this particular case the order is fairly sensible but there are some peculiarities. The first thing to say is that this takes a command line approach to introducing Java - you don't get to a User Interface for quite some time. It also doesn't use an IDE and you are expected to work out how to get to the point where you can enter, edit and run a Java program mostly on your own.
The approach is also very object oriented. This is a quality that I like but you might not. If you are a complete beginner then you will probably find the emphasis on object-oriented design is just getting in the way of you learning the basics. Chapter 2 is called "A Trip to Objectville" and it covers the basic idea of objects versus procedural programming. Chapter 3 explains variables but not in the most simple terms, we are already tackling the distinction between primitive and reference. Chapter 4 is on methods and again we have a good helping of object-oriented philosophy - encapsulation and setters and getters.
Chapter 5 is where the basic ideas of procedural programming are introduced with for loops being used to build methods. Then Chapter 6 jumps in with using the Java library before returning in Chapter 7 to object oriented theory with a description of the idea of object inheritance via the is-a and has-a relationship. Chapter 8 continues with a look at polymorphism. This is a difficult subject but it is well explained as long as you are confident you understand everything up to this point. It is still tough going, however, if it is the first time you have met the idea. In practice you can be programming for some time before you actually meet a need to implement polymorphism. This is because most programmers are consumers of objects rather than object creators.
Chapter 9 gets into object lifetimes with constructors, destructors, superclasses and so on. Chapter 10 returns to using object with a look at the Math class and all its methods. Chapter 11 deals with the difficult and possibly unnecessary at this stage subject of exceptions and exception handling.
Finally in Chapter 12 and 13 we reach a basic tutorial on creating a GUI i.e. using Swing to place buttons etc on a form. All of this is done without the help of an IDE or a form designer. This approach make the very easy very hard work.
From this point the book rushes to a conclusion with a look at object serialization and file handling and, in Chapter 15, a mixed bag of topics is introduced as part of an examination of "making a connection". This covers networking, sockets, TCP etc and concurrency - threading, locking, synchronisation ans so on. In Chapter 16 we take a look at he more fundamental issue of data structures - generics, HashMaps and so on. Chapter 17 deals with deployment i.e JAR and JWS. And the book is brought to a close with a look at distributed computing via Remote Invocation and Jini. This confirms the fact that the topics covered aren't really designed for the complete beginner.
Overall this is a good book as long as you are sophisticated enough to deal with the very heavy emphasis on object-oriented philosophy. If you want an approach that deals with the practicalities of the language and adds the philosophy and methodology later then you need a different book. I happen to like the approach, but I have to admit that it might make Java seem more difficult than it needs to for the complete beginner.
So recommended but with some reservations.