In search of the best Java book for beginners

A comparative review of 7 intro-programming language books

Until, say, 1996, I wouldn't have blamed any teacher still using Pascal as the main teaching prop in an introductory computer science curriculum (often code-named CS 101 or CS1). The obvious alternative (C++) was quite rightly considered by many teachers to be a pedagogical minefield. Today, however, there is no excuse: If you're not using Java to give your students their first taste of programming, then you are leaving the door wide open to be rightfully accused of not giving your students the best possible computer science education.

In the past year, a small minority of teachers found themselves unsatisfied by "just" pushing the teaching envelope in their respective classrooms (that is, by ditching Pascal and the legacy of its generation's procedural programming style, and adopting Java and its modern object-oriented programming style). These pioneering few went a step further by writing teaching texts for complete beginners, betting the whole shop on Java.

This month's book review takes a look at seven books that share the goal of teaching complete non-programmers how to program, and to do so with Java. (Notice that these books are quite distinct from those books designed to teach Java to programmers who've never used Java before. These books are for students who've never programmed with any computer language before.)

The titles reviewed are:

Below is a comparison table to provide you with a bird's-eye view of each title's main characteristics.

Java For StudentsJava GentlyJava -- An Object First ApproachIntroduction to Programming Using Java -- An Object- Oriented Approach


Oriented Programming in Java

Java How To ProgramComputing Concepts with Java Essentials
Price (U.S.$)8.006.954.007.959.998.007.95
Pages, Chapters (Appendices)586, 29 (8)508, 15 (2)394, 17 (3)783, 14 (4)953, 16 (2)1063, 18 (6)624, 14 (3)
IndexPoorPoorV. PoorYesYesV. GoodYes
CD-ROMNoNoNoNoYesNo *Yes **
Listings density (lines/page)48565348585050
Object-oriented early?NoYesYesYesYesNoNo
Applets(A) or applications(B)?ABBAA&BA&BA&B
Graphics early?YesNoNoNoNoNoYes
Support classes?NoYesNoNoNoNoYes
Keywords highlighted?NoNoYesNoNoNoNo
Suitable for hobbyist?NoNoNoNoYesNoNo
Overall score6/104/102/107/108/106/108/10

* The book doesn't come with a CD-ROM, but Prentice Hall sells a different product that combines the book with an interactive CD-ROM. See the book's review below for details. ** Strictly speaking yes, but the CD-ROM content is unrelated to the book's content!

In the absence of tools to calculate the true cost-per-bit equivalent of a book, the "Listings density" row gives you an idea of how dense or "aerated" the program listings are. Low lines and/or page values usually mean unreadable listings and a high page-fill factor, so the higher this value, the better.

The "Object-oriented early?" row indicates how modern the text is. Modern texts tackle object-orientation first, while conservative texts start by exploring procedural programming concepts. Although conservative texts need not be problematic, per se, you are advised to consider first texts that submerge you in the modern computer-science world view of object-oriented software.

The "Applets or applications?" row indicates which type of Java programs the authors primarily use. Java applets tend to be regarded as more fun (or "cool") by new students, so there's a lot to be said for texts that use lots of applets, especially early on.

The "Graphics early?" row indicates whether the author(s) let the student use graphics programming early on. Letting students see their programs "live" by way of dynamic, graphical output (instead of comparatively boring, plain text output) is a proven approach to get students interested in a programming course.

The "Support classes?" row indicates whether the authors attempt to shield students from Java's few student-unfriendly facets, by interposing some support classes (a text-formatting class, for example) between example programs and the raw Java classes.

The "Keywords highlighted?" row indicates whether the text enhances its program listings by highlighting keywords (and maybe other grammatical elements, such as program comments). Since even software veterans appreciate such highlighting (on the screen, as well as on paper), you can bet that such highlighting could significantly help students new to programming comprehend their first batch of examples.

The "Suitable for hobbyist?" row indicates whether the text takes the reader through all the necessary steps to fully install and configure a working Java software development environment. Most texts leave significant gaps in this area, presumably relying on a real-life teacher to be at hand to help with such initial tasks.

Java For Students by Bell & Parr (Prentice Hall)

Java For Students immediately distinguishes itself from its competition by using applets from the beginning (p. 14). Its "Hello World" program (the de facto program that most teachers use to introduce programming) is therefore the following seven-liner:

import java.awt.*; import java.applet.Applet;  public class Greeting extends Applet {     public void paint (Graphics g) {  g.drawString ("Hello"), 50, 50);     } } 

This applet-centric approach means the authors incur the cost of having to introduce a modicum of HTML to create a Web page for this applet, but the long-term return on this investment is considerable: From p. 22 onward (Chapter 3, "Introductory Graphics"), the authors are free to employ the pedagogically more productive use of graphics programming as a means to bring software to life. Chapter 8, "Repetition -- while, for and do," for example, relies on rendering graphical output to illustrate the use of program loops.

I'm a strong believer that effective teachers first hook their students, in this case by bringing them into contact with interactive and fun material, before diving into the more rigorous and abstract world of object-orientation, software development rules and regulations, and so on.

Bell and Parr's early use of graphics seems to mirror this philosophy. Unfortunately, the bulk of the book is otherwise quite conservative in its teaching approach. The book introduces the core concepts of objects, messages, and classes in a fairly shallow way with Chapter 9, "Objects and classes." By that point, the student already has seen "Variables and calculations" (Chapter 4), "Methods and parameters" (Chapter 5), "Events" (Chapter 6), "Decisions -- if and switch" (Chapter 7) and the above-mentioned "Repetition -- while, for and do" (Chapter 8). More elementary OO concepts are deferred even further, to Chapter 21, "OO Design." Clearly, this is not the object-first approach used by some other books in this review.

Some of the tail-end chapters are far from conservative though. These chapters deal with program style, testing, debugging, and the use of packages in nontrivial programming projects. Multithreading (which isn't exactly a simple topic for beginners) also is discussed. In addition to the expected chapter summary, chapters typically end with some added-value sections such as "Grammar spot," "Programming pitfalls," "New language elements," "Exercises," and "Answers to self-test questions." The pitfall notes especially will be of value to total beginners.

Lastly, a warning: The book claims on both covers to be "1.2 compliant." Ignoring the issue and question of what it would mean for any book to be "1.2 compliant," it was very clear from the book's content that it was written using little more than the simplest of 1.1 Java features (mainly event-handling using listeners).

Java Gently by Judy Bishop (Addison-Wesley)

It's not every day that one can give the thumbs down to an Addison-Wesley book. For many years I've admired Addison-Wesley for its consistently above-average quality output. Bishop's Java Gently is an exception, as it leaves a lot to be desired.

Foremost, and most surprising, it is pedagogically weak, while the text itself falls short of the usually high standard expected from this pillar of computer science publishing. Some pedagogical decisions underlying this book, such as sticking to text-only applications for the first two-thirds of the book, or covering advanced topics of dubious value to new students (inner classes, remote method invocation), are not lethally flawed. Some other introductory programming books (that use Java as a teaching vehicle) share these characteristics while still hitting their educational targets. What is a lethal flaw for Java Gently is being a text that often comes across as plain messy and (ironically) hurried, sprinkled with factual errors or explanations that obscure more than elucidate.

The first 50 pages of an introductory book present its author with his or her first (only) opportunity to hook students. Fail to do so and you lose them. As a teacher attempting to introduce complete programming virgins to the highly technical world of software construction, it is advised to carefully work out a teaching trajectory that avoids all contact with the many potential obstacles to understanding and learning that litter the landscape. In Java Gently's first two chapters of Part I ("Introduction" and "Simple programs"), the strategy for crossing the minefield seems to be to shut one's eyes and run in a straight line. I don't see how any new student can process these two crucial first chapters and emerge without having been thoroughly confused.

As a salient example, Bishop's explanation of OO basics (Section 2.2 "Fundamentals of object-oriented programming") is so poor, at least in comparison to other authors' similar sections, that it will give the innocent reader a very shaky foundation indeed. For the record (only), the rest of Part I ("Fundamentals") is comprised of chapters 3 to 7: "Structuring," "Changing the state," "Controlling the flow," "Arrays and tables" and "Formatting." Part II, called simply "Power," comprises chapters 8 to 16: "Objects at work," "Abstraction and inheritance," "Graphical user interfaces," "Event-driven programming," "Applets in action," "Multi-threading," "Networking" and "Algorithms and data structures."

There's only one thing that I really liked about this book -- something other books would do well to copy: the consistent and explicit stage of testing presented programs. Often, this amounts to little more than showing and discussing the example's output, but at least it's a beginning that instills in students the knowledge that software development involves more than simply designing and writing a program.

Java -- An Object First Approach by Fintan Culwin (Prentice Hall)

This book was a surprising disappointment, especially since Culwin is an active Java evangelist in the educational community in the UK and Ireland. The front cover of Java -- An Object First Approach includes a buyer-luring "Includes UML" splash, yet when I flip through the entire collection of diagrams the book contains, I can only see non-UML diagrams (JSP and OMT styles!). And this despite the additional back-cover assurances: "To support [object-oriented design and development], Unified Modelling Language (UML) notation is used consistently from the outset..." ! Yeah, right. Doesn't look as if the twenty-first century will be a sales spiel-free era.

This book confirms the consumer heuristic that front- or back-cover "economies with the truth" usually do not bode well for the content sandwiched between the covers. It's a shame copyright laws don't allow me to simply paste, right here, the first four pages of this title's first chapter, "Two initial applications," because that's all it would take to show that this book is a pedagogical disaster area. (Luckily, the book is online, so you can actually double-check my claim via the URL and link in the Resources section of this article.)

Without even trying to explain what a computer, a programming language, a program, source code, program execution, a Java environment, and a host of other technical concepts, are, the author presents an 18-line long "Hello World" program. What follows is the clumsiest dissection of an introductory program I have ever read, and one that is sure to conjure in the reader more questions than answers. In those first couple of pages of the book, some book-wide characteristics are quickly established. The author uses nonstandard terms for established technical terms (calling Java methods "actions," for example) and regularly defines new concepts clumsily and inaccurately. This problem occurs right up to, and including, the glossary at the end of the book. (For example, object is incorrectly defined as: "Class instances and instances of primitive types.")

1 2 3 Page 1
Page 1 of 3