Author: Rogers Cadenhead
Publisher: Sams, 2014
Audience: Java Beginners
Reviewer: Mike James
Java in 24 hours? A tempting offer, but Java is has grown into a complex language. This edition of this long standing book covers Java 8 and Android.
Covering Java 8 isn't such a problem for a beginners book because the areas where the language has evolved isn't in the simplest areas. As far as the core of Java goes, what you would teach to a complete beginner has stayed more or less the same for a very long time.
The first problem, and it is a problem for any book introducing, any language, is what IDE to use?
In fact with Java you could opt not to use any IDE at all apart from a text editor. In fact this book uses NetBeans and it probably should mention this more prominently on the cover - as for most it would probably be a plus point. You are told how to install and get started with NetBeans in detail in an appendix at the end. All you get in the body of the book is a short note on choosing an IDE and an instruction to install NetBeans.
This is a shame because personally I think NetBeans is a great way to learn Java. It is easy to use and, as important, it has a drag-and-drop interface designer which makes it suitable for the complete beginner. It is also free and open source.
The book starts very gently - perhaps even too gently. Hour 1 begins with a look at what programming is and even discusses how to choose a language. Hour 2 works you up to your first program, a hello world. This might be considered boring, but it really is the best way to get started. The example goes a little further than it needs to in that it introduces the class file and the idea of variables, all of which is gone over again later in the book. You also get to discover how to enter, run and debug a program using NetBeans.
After making a flying start we take a break in Hour 3 "Vacationing in Java" an examination of the wider Java ecosystem. It is a sort of "in praise of Java" combined with a "how lucky you are to have picked Java to learn". You could skip this or leave it for later.
Hour 4 more or less starts over with another first program, only this time it is a lot more technical. In this case we pass arguments to the console program, find out about the Java class library and encounter some slightly intimidating documentation just to make the point that you should really expect to fully understand it at this stage.
Then Hours 5 and 6 introduce enough basic data types and expressions to get us started. Here we learn about variables, different types of numbers, operators and strings.
Hour 7 and 8 are the part of the book that really make you into a programmer. This introduces the flow of control - if statements followed by loops. The tendency is to cover just about everything that is related, so as well as if statements we have the switch and the conditional operator. For the beginner it would be better to postpone the more advanced and less used facilities to a later chapter that went over the whole flow of control idea. Flow of control is the hardest thing that complete beginners have to learn and dumping the entire topic in two hours might make it harder than it needs to be. However the presentation makes it seem simple and it you can get your head around it and make it to Hour 9 your brain will never be the same again.
Loops and arrays go together like they were made for each other - of course they were. So after loops you have to deal with arrays and, again, hour 9 might be too complete a coverage of the basic idea of the complete beginner.For example why introduce multidimensional arrays and array sorting when the reader has only just been introduced to the idea of a simple one dimensional array?
Hour 10 is where we move from the purely algorithmic into the object-oriented world with "Creating your First Object". This isn't a bad way of introducing object but it does tend to go into irrelevant detail and over-generalizations. At the end of the hour you have created your first object, used it to create another via inheritance and created an instance or two. Perhaps this is too fast for many readers.
The next two hours are about building on object ideas. Hour 11 is about properties, methods and constructors but, along the way, it also goes into inner classes and it's difficult to see why. Hour 12 is about using supplied classes and using inheritance to build your own derived classes.
Hour 13 moves on to using the Swing and AWT class libraries - which would have been a really good introduction to objects and classes if presented earlier. Hours 14,15 and 16 form a basic introduction to working with user interfaces and at this point you are more or less assumed to be a Java programmer and what is being explained is the way you use the class libraries to build interfaces.
From this point on the book really deals with ad-hoc topics. Hour 17 is about data structures beyond the array - the array list and the hash map, 18 is about error handling and 19 is about threading.
Hour 20 introduces some Java specific material - inner classes and closures. Oddly the idea of a closure is introduced as if it was a synonym for lambda expression. It isn't as a lambda expression is essentially a short cut way of creating a function object and closure is about the function object's access to variables that are in its scope when it is created.
Hour 21 is on reading and writing files, 22 is on Web Services with JAX-WS, 23 on Java2D graphics and 24 is on creating Android Apps. As predicted the chapter on Android is no more than a getting started, taking you as far as a "hello world". The biggest problem with this is that it makes use of Eclipse and the Android tools for Eclipse. Google has dropped support for Eclipse and replaced it by a much easier to use IDE - Android Studio. Any introduction to Android that doesn't use Android Studio is wasting your time. Don't follow the instructions in hour 24 but download Android Studio and see if you can make sense of it.
The overall style of the book is very light but you might find that the author's slightly bizarre sense of humour wears thin by the time you reach the end. While the descriptions and introductions are quite good, the main problem is the tendency to include nearly everything the first time a topic is introduced. As a result the book works best for the beginner who has seen some programming ideas before but not too much otherwise you will find it too simple.
If you are a complete beginner then my advice is to concentrate on the first part of each chapter and revisit the material when you have had practice and time for it to sink in.
The final verdict has to be that this is a quite a good attempt at an introduction to Java, it could be better and it isn't ideal for the complete beginner but if you are prepared to work at it then you probably can use it to learn to program in Java - but it will take a lot longer than 24 one-hour sessions.