scruffles.net subscribe
Wednesday, August 9, 2006

If you believe that ignorance is bliss, then you want to avoid 'Java Concurrency in Practice' by Brian Goetz. In fact you may want to try to avoid talking to anyone who has read it. I've only made it halfway through, and I feel like the little kid in 'The Sixth Sense' -- I see bugs everywhere. When I close my eyes, I see code I wrote six months ago - BUGS! When I open them I see them in the projects I'm working on, and the ones I maintain.

These aren't big, bugs that cause everything to stop working every time. Nope. These are those little strange ones. When you upgrade your server, and that app you haven't changed in 2 years suddenly starts spitting out an incorrect value every couple days.

And these aren't race conditions or deadlocks. Most programmer I've worked with have at least a basic understanding of how race conditions can occur (at least I like to think they do). The bugs I'm talking about are visibility bugs. Values hiding on the processors cache, that don't get flushed back to main memory (yes, it's java, but it still runs on a computer).

Java Concurrency in Practice does a very good job of explaining these kinds of issues and how to deal with them. I think it does a much better job than Doug Lea's book, which I'm sure is packed with knowledge, but isn't very accessible. In comparison, Java Concurrency in Practice is much more conversational. It's also (of course) much more up to date.

On a side note, I bought this book at the prompting of my IDE. IDEA kept highlighting threading issues in my code. Its explanations seemed very strict, and I wanted a better explanation of why it thought I should change my code. I thought for sure it was making assumptions and making an issue out of nothing. But since IDEA had always given me good advice in the past, I thought I'd look into it. Any decent IDE will teach you the language's syntax or api (via error highlighting and auto completion), but it takes a pretty damn good IDE to teach thread safty!

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home

Bryan