Author: Patrick Niemeyer & Dan Leuck
Audience: Programmers already familiar with Java
Reviewer: Alex Armstrong
Learning Java - obviously a book for someone who wants to learn Java. Don't be too quick to leap to that conclusion!
This is a big book on Java, which isn't unreasonable given the age and maturity of the language and its environment. Its title, "Learning Java", seems to suggest that it is aimed at teaching you Java and presumably from scratch. However, the book isn't structured in any way that helps a beginner. Even if you are an experienced programmer in another language, you might find the order of presentation less than helpful. About the only reader it could possibly suit is a Java expert who wants to be reminded of what they already knew.
Chapter 1, for example, starts off with a look at the history of the language and a comparison of Java to other languages. This might be interesting as an article, but if you have bought a 1000 page book that promises to teach you Java then presumably you are committed to the language and just want to get on and use it. There are also lots of comparisons with C++ as you progress through the book - C# is a much better language to compare Java with but this isn't mentioned. The chapter then goes on about dynamic memory management, class loaders and various other ideas that make no sense unless you know something about Java.
Chapter 2 seems more promising because it presents a first application. The book uses the Eclipse IDE for all of its examples, so before we get to "Hello World" we have to install and configure Eclipse. Next we have the usual Hello World - first as a console application and then extended to a Swing application. This is fine but at this stage the beginner has no clear idea of what is going on and the use of JFrame and JLabel is going to be confusing. Much better to stick with the console app at this stage. Even so we do have a lightening explanation of class, packages, inheritance and so on. All of which are going to have to be explained again in a proper context later in the book. By the end of the chapter we have even started to use the paintComponent method - this is advanced stuff for a beginner and even for a programmer moving from another language. So, who is this book aimed at? Before the chapter finishes we have multiple versions of Hello World getting ever more complicated an mentions of threading, synchronization, events and interfaces.
One of the problems is that the book introduces Eclipse and makes use of it, but the explanations aren't enough to make you even an intermediate user of Eclipse.
From here we move back to look at the inner workings of the JDK. A brief look at doing things from the command line and then we are into JAR files. We haven't had any introduction to the basics of Java apart from a few random items on the way to building ever more sophisticated Hello World apps but now we are looking into how Java packages complete apps.
At last Chapter 4 is called The Java Language, now we start to find out about the language. But no, after introducing text encoding we meet the humble comment but because Javadoc is based on a modified comment we now have to look at Javadoc. All of the topics covered are important and should be in a book on Java but in the case of this book they seem to placed based on word association rather than a logical presentation. At around page 100 we finally start to encounter the basics of Java. At this point the presentation becomes more like a syntax manual than a book trying to help you to learn the ideas of the language. There is an enumeration of the primitive data types and then the basic control structures - but then we have a chunk on exceptions. Exceptions are important but you don't have to introduce them just after you have explained the if statement or the primitive data types. Following exceptions we have arrays - it really is difficult to fathom the logic of this organization.
Chapter 5 moves on to objects and it follows the same general pattern of introducing the basics in a very dry "manual" style and occasionally going off onto more minor or more advanced topics - weak and soft references for example. The ideas are expanded in Chapters 6 and 7 with a look at inheritance - didn't we do this in chapter 1 - and how to use objects.
The next chapter is on generics, then we have threading and working with text. Chapter 11 looks a the core utilities which is a tour of the library - math, date and time, collections and so on. Chapter 12 deals with I/O and file handling.
From here the book goes off into applied Java in various areas. Chapter 13 is on network programming, 14 web programming, 15 web services. Then we take a look at Swing in chapters 16,17, 18 and 19. Chapter 20 explains 2D graphics and 21 deals with working with various image formats.
The final few chapters seem to attempt to put in things that might be relevant or perhaps noticed if they were left out. Chapter 22 is on JavaBeans, Chapter 23 on Applets and the final chapter is on XML - SAX, DOM, XPath etc.. Useful if you need to use XML.
There are parts of this book that provide useful explanations of topics. What is really wrong is the order of presentation early in the book. To get a grasp of Java you would have to read it several times so that you could acquire the knowledge necessary to understand the contents the earlier chapters.
The one thing that is clear is that this is not a book for the complete beginner, it doesn't teach you to program and it isn't a book if you don't already know Java. There are simply better books for both types of reader.
It might suit you if you have a lot of experience and know some Java want something to fill in the detail you may have missed. Even so it could still be better organized.