HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML

Learn Debugging Skills, by James McGovern

In my travels I've run across lots of bad Java code (some of which I've written myself). Usually it's due to unrealistic project deadlines, bad estimates for how long something will take, no architecture in place, and developers' not really understanding the subtleties of the language.

Many people have learned Java by reading those 1,000-page books where you cut and paste code from the accompanying CD. Usually this teaches you how to get simple things working but doesn't help you learn Java. This book is the solution to all these problems.

The author, who has years of experience teaching computer science, emphasizes the importance of learning debugging skills. Industry research has shown that people who learn these skills first, master computer languages significantly faster. For the beginning developer, this helps you avoid picking up bad coding habits.

The book is 13 chapters, 460 pages, and reasonably priced at $39.99 ($31.99 on Amazon). Unlike many of the other Java books on the market, even the appendix provides useful information and is not filler. The text contains useful tips and advanced troubleshooting techniques for tracking down bugs. It also provides guidance on how to avoid scope creep and reduce deadline pressures by using proper estimation techniques.

Chapter 1 begins with a profound statement: "No amount of testing finds all bugs." There's no such thing as perfect code. With this in mind, the author guides you to use prioritization for finding and fixing bugs. Chapter 2 explains why bugs exist, which on the surface seems obvious (the other developers aren't always clueless). The author suggests that developers write documentation before writing code. The documentation will turn into a programming specification that can be reviewed by the business community, which in turn will help relieve pressure and buy you more time to develop properly.

Chapter 3 goes into actually practicing creating bugs so you'll be familiar with the outcomes such as exceptions or "not a number." Chapter 4 talks about risk factor analysis and provides great insight into figuring out how long something will take to develop. Chapter 5 discusses the usage of IDEs and brings up some very good recommendations. You'll learn how to use macros to reduce defective code. The author even points out how to use Microsoft Word as your IDE and integrate spell checking and error correction facilities.

I liked Chapters 6-8 the best. Chapter 6 covers the 80/20 rule, which says that 80% of your bugs are most likely to appear in 20% of your code. He notes additional tools for tracking down bugs that are syntactic in nature, and even suggests using LINT tools for finding them. For those who are not familiar with LINT tools, they're parsers that identify potential syntax errors in code that will compile but may lead to problems. Its origin comes from the C/C++ world. For instance, a LINT tool will flag the following code as a potential error: String abc = "\0123"; it will say you may have tried to incorrectly specify an Octal value. Other checks would include whether a loop should start with 0 or 1, using = in place of ==, memory leaks, thread conflicts, and Boolean checks.

Chapter 7 talks about best practices, which will further help you develop good coding habits. Chapter 8 discusses automated debugging and using debugging tools such as Sitraka Software's JProbe.

Chapter 9 covers what the author calls "Grand Debugging Strategies," which will give you insight on how to avoid regression errors. Chapter 10 covers black box testing. Black box testing checks a particular class's functionality by determining if its public interface performs according to specification without regard to implementation details.

Chapter 11 is obligatory reading for anyone developing threaded applications. You'll learn when and where to make your methods synchronized to avoid corrupted state. Synchronized methods carry a heavy performance penalty in Java and usually execute at 25% of the speed relative to a nonsynchronized method. You'll learn how to make your applications faster.

The last two chapters are final thoughts about political correctness as well as conducting other forms of testing, such as stress and fault insertion. There's plenty of humor in both of these chapters as they even give you an idea on how to get your users to think they did something wrong when hitting a bug in an application.

Overall, this is a high-quality, easy-to-read book that promotes learning. I recommend it for both beginning as well as advanced Java developers. In fact, I'd suggest every project manager buy a copy of this book for his or her team members and make it mandatory reading. This book definitely rates five stars.

Author Bio
James McGovern is an enterprise architect for Hartford Technology Services Company, L.L.C., an information technology consulting and services firm dedicated to helping businesses gain competitive advantage through the use of technology. He's a coauthor of multiple books on Java and a member of several Internet advisory boards.
[email protected]

All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.