Samstag, 11. Februar 2012


Buch-Tipp

Hardcore Java

Secrets of the Java Masters--Reviewed by Deepak Thomas

Speak, O Guru: What, then, is the True Path to Wizardhood

O Nobly Born: learn, and seek within thyself. Cultivate the cunning of the Serpent and the courage of the Tiger; sup deeply from the Wisdom of those who came before thee. Hack, and hack again;

Rather must you Become, and Become, and Become, until Hackers respect thy

Power, and other Wizards hail thee as a Brother or Sister in Wisdom, and you wake up and realize that the Mantle hath lain unknown upon thy Shoulders since you knew not when.

Excerpt from So You Want To Be A UNIX Wizard? (The Loginataka), by Eric S. Raymond, posted on comp.unix.questions

The typical fledgling Java programmer cuts her teeth on any of the hundreds of Java beginner books out in the market. From then on, the path to Java Gurudom seems to be fraught with uncertainties. Somewhere between fixing that pesky race-condition and dreaming up the perfect pattern, she realizes that her Googling skills have over time matched, if not exceeded her Java skills! Realization dawns that between books that introduced syntax and the Javadocs, there really is not much in terms of books for the intermediate programmer striving to achieve Java Gurudom. This book is precisely aimed at the aforementioned segment of programmers.

Do not expect the book to start from the scratch, i.e. syntax and ‘Hello World’s. In fact, this reviewer would recommend six months to one year of Java programming before you tackle this book. Having said that, the book is very approachable, written in a hands-on fashion; it just takes some programming experience with Java and thinking in terms of the language before you use this book. The book is peppered with coding tips and choc-full of well-commented code. It is one of those books that are aimed at presenting on a platter what would otherwise have been hard-won knowledge.

The first chapter starts off with a review of what should be common techniques in every Java programmer’s tool-kit. Handy techniques in the use of syntax and access are discussed; so are some of the common mistakes made by intermediate programmers. The second chapter takes this further by exploring the creative use of the final keyword to force potential logic errors into compiler errors.

Since Java passes references to objects by value, on one side this allows for flexibility, while on the other it leads to disastrous programming. Immutable objects, i.e. objects without write methods, come to the rescue. Chapter 3 deals with the art and science of putting immutable objects to good use. If you previously read about Vectors and Lists in passing and skimmed over HashMaps and Sets, Chapter 4 will reinforce your understanding and take you further by explaining the philosophy and practical applications of Java Collections. It is said that a well-designed class should practically have no if statements; while that might be a stretch, using exceptions rather than nested if statements is good Java coding practice; chapter 5 is devoted to the finer points of exception handling.

Somewhere between chapter 6 that discusses Nested Classes and chapter 8 on Data Modeling, things start to get a little uninspired. Nevertheless, these chapters are worth a read, if not for anything else, at least to understand familiar gotchas with these topics. Although not strictly necessary, readers of the Data Modeling chapter would benefit from a prior introduction to UML diagramming. The persistence topic should have received better coverage, particularly with regards to JDO and fast-emerging Hibernate. Chapter 9 on Reflection, while informational, suffers from a lack of valuable "where-to-use-when" scenarios. Chapter 10 is definitely uncharted territory for most books; it introduces and explains the concept of Proxies, invaluable when dealing with network protocols or cases when an object needs to stand in for another. References are arguably the least understood and therefore possibly the most under-utilized feature of Java; Chapter 11 takes on references with gusto with a whole section dedicated to practical situations. Finally Chapter 12 whets the reader’s appetite for more Java with a preview of things to come in Tiger, JDK 1.5.

Some readers may find certain sections of the content organized in no particular fashion. There are missed opportunities both in introducing and spending more time on some very relevant topics, particularly with regards to concurrent programming and programming patterns. A typical intermediate programmer would be interested in graduating from just writing code to writing code that performs well. While performance is addressed in the context of other topics, an introductory chapter focused on performance tips and tricks would have rounded out the book.

While it will not stop us from reaching for the Google bar or hanging around the JavaRanch Saloon, this book is definitely worth a read; if not for anything else, at least to provoke our thinking on some of the bigger programming issues that tend to get lost in the daily chaos of targets and deadlines. At the end of the day, no book is a magic bullet. As the seer said, hack away into the night and you shall wake up one fine day with the mantle of Gurudom on your shoulders. Good luck!

von Deepak Thomas
  • Autor/in: Robert Simmons, Jr.
  • Verlag: O’Reilly
  • Seiten: 344
  • Preis: $39.95 US, $57.95 CA, £28.50 UK €
  • ISBN: 0-596-00568-7