Skip to content
Scan a barcode
Scan
Paperback Java Puzzlers: Traps, Pitfalls, and Corner Cases Book

ISBN: 032133678X

ISBN13: 9780321336781

Java Puzzlers: Traps, Pitfalls, and Corner Cases

Select Format

Select Condition ThriftBooks Help Icon

Recommended

Format: Paperback

Condition: Very Good

$7.29
Save $42.70!
List Price $49.99
Almost Gone, Only 1 Left!

Book Overview

"Every programming language has its quirks. This lively book reveals oddities of the Java programming language through entertaining and thought-provoking programming puzzles."

--Guy Steele, Sun Fellow and coauthor of The Java(TM) Language Specification

"I laughed, I cried, I threw up (my hands in admiration)."

--Tim Peierls, president, Prior Artisans LLC, and member of the JSR 166 Expert Group

How...

Customer Reviews

4 ratings

Ooh. Ow. Ouch. Eek. Argh. ... Aha.

My wife popped this book open after dinner. Big mistake -- we had planned to spend the night watching Firefly on DVD. She read the first puzzle. We went to the blackboard (yes, we're so geeky and our NY apartment's so small that there's a blackboard in the dining nook). Between us, we had half a dozen possible answers about what a three-line program was going to do. We found at least four boundary conditions and were pretty sure about two of them. For the record, the first puzzle she opened to involved the compound XOR assignment statement x^=y^=x^=y. They're not all that bit-fiddly; some of the other puzzles include class and method mazes, integer or double arithmetic oddities, unexpected exception/initialization interactions, string/charset twistiness, etc. I thought I'd be good at this kind of puzzle. As an academic, I wrote about programming languages. I read Bloch's "Effective Java" book. Twice. I follow its advice religously and make my coworkers read it. I've read most of the source code for String, StringBuffer and the collections framework and I/O streams. I just came off a week-long coding project where I did exclusively bit-level I/O with all the shifts and masks you could ask for. I was wrong. I got about 1/5 of the puzzles right if I give myself partial credit for diagnosing the boundary condition in the question and having the right answer be in my top two or three guesses. Unless you've written the bit fiddling parts of a JVM implementation, or are the kind of person who can remember minute details of the specification, you'll most likely suffer. And love it. Then you can relate the puzzles at gatherings of geeks and look on with a smug grin as they twist in the wind. These would be perfect interview questions for a sadistic HR person. Overall, this book's a jaw-dropping, eye-opening, brain-melting overview of the kind of boundary conditions you can run into with very simple constructions. Most of the puzzles seem to involve implicit conversions done by the JVM, some involve 1.5 features, some involve class inheritance, others exceptions. Almost all of the puzzles contain links to the boundary-condition definition in the Java language spec. I'll do better next time. Really.

Geek fun!

First, let's get this out of the way: you're not as smart as you think you are. Seriously. You don't know everything about Java. It's possible, however, that these authors do. "Java Puzzlers" shows you more tricky corners of the Java language than you ever expected could exist. Not odd behaviors of obscure API classes, not failings of a particular implementation, but known consequences of the language specification itself. Each puzzler, written in an engaging and often humorous style, gives you a chance to figure things out for yourself before lowering the boom to let you know that, once again... you're wrong. If you read this book and take its message to heart, you'll learn to avoid the dark alleys of Java, making sure your programs will never inadvertently become puzzlers for you or those who come after you.

Most Excellent

Many C and C++ books exist that discuss traps and pit falls with each language. Now Java has such a book. This book is fun to read and will challenge even the best Java programmers. Be sure to get the source code from www.javapuzzlers.com. Study each puzzle and try figure out what it does or does not do. Then run the example code and see if you were right. If you weren't right, then try to figure out why you guessed wrong and figure out how to fix the program. Then turn the page and read the solution. Working through the puzzlers is not only fun, but it will definitely make you a much better Java programmer and a better troubleshooter.

Wonderful stretches for your Java-soaked brain

I've been passing this book around my office, describing it alternately as "C Traps and Pitfalls on steroids" or "The most fun that can be had with the Java Language Specification with your clothes on." Thus far, it has not failed to frustrate, educate, enlighten, and amuse each reader, usually in that order. I can't think of any better way to become more familiar with the ins, outs, and warts of the Java language: the puzzles, memorable and clever as they are, stick with you. The writing is fluid, friendly, and full of wit, from the names of the puzzles (like "The Lock Mess Monster" or "Dyslexic Monotheism") to the commentary on the finer points. Even the layout shows thought, with the answers out of plain sight behind the next page. If your brain burns out on the puzzles, check out the optical illusions in between. (Note: do not, during a car ride, show them to anyone who is prone to motion sickness. I learned this the hard way, so you don't have to.) I strongly recommend this book if you spend any time in or around Java code. I've had to deal with many of the pitfalls it highlights, and boy, would it have been more pleasant if I'd already read this book.
Copyright © 2024 Thriftbooks.com Terms of Use | Privacy Policy | Do Not Sell/Share My Personal Information | Cookie Policy | Cookie Preferences | Accessibility Statement
ThriftBooks® and the ThriftBooks® logo are registered trademarks of Thrift Books Global, LLC
GoDaddy Verified and Secured