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). |
public static boolean isOdd(int i) {Seems like a reasonable test for odd numbers? Except it is wrong a quarter of the time.
return i % 2 == 1;
}
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...
4 comments:
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.
You're absolutely right Jason, thanks for adding that point.
thanks for sharing this site. various kinds of ebooks are available here
http://feboook.blogspot.com
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
Post a Comment