Saturday, August 17, 2013

Learning Java 4th ed by Niemeyer: Book review

Learning JavaLearning Java by Patrick Niemeyer
My rating: 3 of 5 stars

I remember using an earlier edition of this book to learn Java many years ago. I even used Java for writing simulations as part of my thesis. Since then, since I generally do scientific and technical computing, I have generally used Python and R linked with C, C++, and Fortran libraries instead of Java. But I have used languages on the Java Virtual Machine (Jython and Clojure) and I probably need a refresher on how the JVM works. This book does give a good overview of all of the scaffolding that goes along with programming in Java, but its focus on the language proper and web and GUI programming in particular leaves me wondering how to get real things done with it.

The first part of the book is what seems to be the standard first chapter of almost all programming books nowadays, a argument of why to use Java. While some things like the safety aspects of the JVM ring true, when he talks about the various dynamic languages he gets some basic facts wrong and mis-characterizes how these languages are used in practice. It would have been better if he did not include these sections at all because he frankly started loosing creditability here. (coming from Python, the general line is that Python is at its best as part of a two language solution, and Java is on the list of likely languages to pair Python with along with C, C++, and Fortran.)

Next are several chapters on setting up your machine to develop and run Java. And several chapters are required. I found many things that I often have to spend several hours looking up whenever I start or deploy a JVM based project so I'm glad that someone realized that this really needs to be in the beginning of an introductory Java book. Things like IDE's, setting up classpath and other environmental variables, and the whole java toolchain. While I applaud that this is required, it somewhat gives a lie to the idea that Java is a simple write one run everywhere tool.

The rest is a tour of the Java language. Data types, statements and expressions, exceptions, assertions, classes and objects. I was specially interested in the discussions on Generics and Threads, as I had not used them before. It could be that I'm spoiled by how Python handles the equivalent of Generics, and both Python and R multi-core libraries, but this seemed very detailed and complex (not helped by Java seeming to require that everything be declared in duplicate).

Despite the title, this felt like more of a reference than a tutorial. Having several chapters on setting up the scaffolding that is needed for every Java project is something that some places seem to gloss over as easy (especially if the IDE does it for you), but makes this book a handy reference. But in the advertise role of learning how to use Java, I'm still skeptical.

Disclaimer: I received a free electronic copy of this book through the OReilly Blogger program.

View all my reviews I review for the O'Reilly Blogger Review Program
Post a Comment