Book Review: Core Java Volume 1 - Fundamentals
From where I'm perched in the 21st century, it is difficult to fathom that once upon a time Java titles were in scarce supply. But such was the state back in the earliest days of Java when all to be had was a modicum of treasures published by a few Sun engineers such as "Hooked on Java" by Arthur Van Hoff et.al. and "The Java Handbook" by Patrick Naughton.
Those books certainly filled a void, but coming in at just three or four hundred pages each they necessarily made quantum assumptions about what you knew about programming and in particular about object oriented programming.
Then March of 1996 brought forth "Core Java" a 600 page single-volume treatise by Cay Horstmann and Gary Cornell that made no assumptions and taught the reader Java from the ground up, in a clear and readable style reminiscent of the early programming classics by Brian Kernighan and Patrick Henry Winston.
Fast-forward 17 years; Horstmann and Cornell have released Core Java (9th Edition). This is a two-volume tome weighing in at 974 pages for Volume I (Fundamentals) and 1128 for Volume II (Advanced Features). In it you will find everything you ever wanted to know about Java 7, the latest release of the Java Development Kit (JDK), including collections, generics, concurrency, and all of the Java embellishments introduced since the first edition of the JDK.
The writing style is as clear and readable as ever, and is replete with examples that are basic but not trivial. It is evident that a great deal of thought went into creating those examples, which are sufficiently detailed to provide a meaningful reference. The book is scattered with frequent "C++ Note" annotations that are intended to guide the C++ programmer on the corresponding Java idiom.
(Click on the image to enlarge it)
Volume I kicks off with a brief history of Java and the highest level requirements of the language designers (robust, portable, multithreaded, etc.) That is followed by a concise getting started guide including instructions for downloading and installing the Java programming environment including the JDK and the Eclipse IDE. There are some solid coding samples in this section so you can test your setup with some visual applets.
Next comes an introduction to the most basic data types as well as syntax, programming structures, and control flow. This includes a nice explanation of BigNumber, BigDecimal and BigInteger.
With all of the basics out of the way, the book breaks into a lucid discussion of object oriented (OO) programming. Programmers coming from a procedural background such as C generally find the transition to OO comes with a difficult learning curve. Core Java does a great job leveling that curve. The discussion starts simply with some basic UML, intuitive examples and a discussion of classes and objects in Java. It then segues nicely into the Java flavor of OO, including class files and constructors. The chapter closes with some "Class Design Hints"; a set of best practices for creating good, readable, and reusable code.
Following the OO discussion the next few chapters build on the Java realization with discussions on inheritance, interfaces, and inner classes.
The next four chapters contain a 300 page development of graphics programming, including the major Swing components, fonts, working with colors, handling mouse and keyboard events, layout managers, applets, and strategies for deployment such as the browser, Java Web Start, and JAR files. I was disappointed that the book made no more than a mention of JavaFX, which is now built into the core Java libraries and functions as a Swing extension.
Returning from that colorful departure, the next chapter discusses exception handling, which transitions naturally into debugging tips, logging, and using a debugger. That is followed by a chapter on generics programming. Even hard-core Java programmers have trouble with that topic but the discussion was developed with lucid precision. The book also covers the new diamond notation introduced in Java 7 as part of "Project Coin". The book then segues into a discussion of Java Collections and Maps, including some algorithms, and a brief overview of some of the older Collections and Maps such as HashTable, Vector, and Enumeration.
The book concludes with a 108-page chapter on Multithreading from the ground up. The chapter starts with "What are Threads", continues with "Thread States" including a nifty state diagram, transitions through "Synchronization" and a discussion on race-conditions. That is followed by some discussion of the java.util.concurrent components introduced since Java 5. Then an introduction to Executors and thread pooling, "synchronizer" components, and an excellent discussion of the SwingWorker concept using threads to ensure the Swing UI remains springy and responsive.
I think it was a good decision to include the chapter on multithreading, which in previous editions was left to volume II. Concurrency is essential to all non-trivial Java code, and should not be thought of as an advanced feature. However I was sorry to see that the chapter on streams and readers, also a fundamental topic, was excised from volume I and will now appear in volume II when it is released in March.
Java has grown since it was first introduced back in 1995, not only in terms of expressiveness but also regarding the surrounding ecosystem. Core Java is long but thorough. It is easy to read and perfect for new programmers, programmers coming from other languages, and even advanced Java programmers who would like to keep a consistently clear reference on a variety of topics in core java close at hand.
About the Book Author
Cay S. Horstmann is author of 'Scala for the Impatient' (Addison-Wesley, 2012), and coauthor of 'Core JavaServer Faces', 3rd Ed. (Prentice Hall, 2010) He is professor of computer science at San Jose State University, a Java Champion, and a frequent speaker at developer conferences.
Dmytro Svarytsevych Oct 30, 2014