my recent reads..

Atomic Accidents: A History of Nuclear Meltdowns and Disasters; From the Ozark Mountains to Fukushima
Power Sources and Supplies: World Class Designs
Red Storm Rising
Locked On
Analog Circuits Cookbook
The Teeth Of The Tiger
Sharpe's Gold
Without Remorse
Practical Oscillator Handbook
Red Rabbit

Tuesday, June 02, 2009

Java Puzzlers. Be Afraid of the Dark.


Apparently, Joshua Block and Neal Gafter started the "Java Puzzlers" idea at Oracle Open World 2001. I wish I was there.

Subsequently, they've turned it into a book
, and a website.

If you program in Java, you must read this book. It covers the kind of traps in your code you wouldn't even imagine could be there.

I can guarantee you have written at least one of these issues into your code. And QA never caught it. And it is out in the wild RIGHT NOW. Arrgh!!

These days, I think (and hope) that most professional developers are relatively atuned to coding security issues and the rise of opinionated testing methodologies (Unit testing, TDD, BDD etc).

But this book is a real eye-opener to the range of issues that you wouldn't even think worthy of a unit test case.
public static boolean isOdd(int i) {
return i % 2 == 1;
}
Seems like a reasonable test for odd numbers? Except it is wrong a quarter of the time.

And that is just puzzle #1.

The book takes you through issues with strings, loops, classes, libraries, all the way to puzzle #95, where you learn why you shouldn't program like your brother.

Get a flavour from this presentation on Scribd from JavaOne 2007... Java Puzzlers me java puzzlers from javaone 2007

4 comments:

Jason M. Adams said...

i agree with you -- this book is outstanding if you're a java developer. even if you're not a java dev, but have learned java at some point, going through these puzzles helps you think about the pitfalls that can be lurking in any language.

Unknown said...

You're absolutely right Jason, thanks for adding that point.

Anonymous said...

thanks for sharing this site. various kinds of ebooks are available here
http://feboook.blogspot.com

Anonymous said...

I was looking and reading other articles about Java Puzzlers. Be Afraid of the Dark, and yours is the one with the most interesting, accurate and useful information.

Thanks for sharing and have a nice day.
buy viagra