Java(TM) Puzzlers : Traps, Pitfalls, and Corner Cases
| |||||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||||||
| Sort customer reviews by: | |||||||||||||||||||||||||||||
|
Show All Reviews on Page
Hide All Reviews on Page
| |||||||||||||||||||||||||||||
| Java(TM) Puzzlers : Traps, Pitfalls, and Corner Cases | |||||||||||||||||||||||||||||
|
Based on Bloch and Gafter's standing room only Java Puzzlers talk at JavaOne, the heart of the book comprises over 100 Java programming language puzzlers: brainteasers that challenge the intellect while alerting programmers to the traps, pitfalls, and corner cases that lurk in the nether regions of the Java platform. All of the puzzles from the authors' popular JavaOne presentations are included, as are many puzzles never before seen in public. There are two major types of puzzles in the book. Most of the puzzles take the form of short programs that appear to do something but actually do something else. Readers will be encouraged to predict the behavior of the program before running it. After running the program, readers will be encouraged to figure out why it behaved as it did before consulting the solution. In a second type of puzzle, the reader will be asked to write a short program that performs some specific task. Most of the solutions will contain a "moral," a rule the reader can follow to avoid the problematic behavior demonstrated in the puzzle. The puzzles are grouped into chapters based on the primary platform features they exercise and to maximize readability, fun, and pedagogical effectiveness. |
|||||||||||||||||||||||||||||
| Reader Reviews 1 - 30 of 30 | |||||||||||||||||||||||||||||
| Review Date |
Review Rating(5 High) |
Review Helpful to: |
Customer Review | Reviewer Info |
Permanent Link |
||||||||||||||||||||||||
| Reader Reviews Below Sorted by Newest First | |||||||||||||||||||||||||||||
| 10-17-08 | 5 | (NA) |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
Don't buy this book if you other chores to do. You won't be able to put it down! Both fun and challenging. A one-of-a-kind book for Java lovers.
(Review Data Last Updated: 2008-11-30 07:43:42 EST)
|
|||||||||||||||||||||||||||||
| 07-14-08 | 5 | (NA) |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
This is an amusing and at the same time amazing book that helps avoiding some very dark corners you might not have been aware of when programming in Java. I used FindBugs to test for some of the pitfalls described in the book in some codebases we had and did I find errors! Go get yourself a copy.
(Review Data Last Updated: 2008-10-22 06:14:00 EST)
|
|||||||||||||||||||||||||||||
| 07-05-08 | 5 | (NA) |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
This book presents several problems that maybe even expert Java developers never thougt about. Some of them are only curious corner cases, others present tricky behaviours of the language that every developer must be aware of to avoid unwanted behaviours. I warmly suggest this book as a complement to "Effective Java", by the same author.
(Review Data Last Updated: 2008-07-15 07:18:40 EST)
|
|||||||||||||||||||||||||||||
| 01-13-08 | 5 | 1\1 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
Completing the puzzles in this book will increase your knowledge of the Java language spec. This book was written by 2 of the world's foremost Java experts.
(Review Data Last Updated: 2008-04-01 22:31:08 EST)
|
|||||||||||||||||||||||||||||
| 01-12-08 | 5 | 1\2 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
Completing the puzzles in this book will increase your knowledge of the Java language spec. This book was written by 2 of the world's foremost Java experts.
(Review Data Last Updated: 2008-06-22 04:48:56 EST)
|
|||||||||||||||||||||||||||||
| 12-26-07 | 5 | (NA) |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
This book was so much fun to read but more importantly it surprised me a couple of times ... which is what i expected when i got it ...
Cutting it short, if you are looking for some puzzlers ( some real ones ) get this book, at least you'll have some fun ... Regards Vyas, Anirudh (Review Data Last Updated: 2008-01-13 22:59:52 EST)
|
|||||||||||||||||||||||||||||
| 06-27-07 | 2 | 1\2 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
You really have to be a language weenie to care about many of these. If you're looking to become a better programmer, or simply to be entertained, this probably isn't the right book.
(Review Data Last Updated: 2007-12-26 14:36:30 EST)
|
|||||||||||||||||||||||||||||
| 01-17-07 | 5 | (NA) |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
The book is very friendly and readable.
Some of the examples are real unique and in most cases you are not going to meet them but it's fun to read, use your mind and check you knowledge. (Review Data Last Updated: 2007-07-01 13:26:02 EST)
|
|||||||||||||||||||||||||||||
| 01-16-07 | 5 | (NA) |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
The book is very friendly and readable.
Some of the examples are real unique and in most cases you are not going to meet them but it's fun to read, use your mind and check you knowledge. (Review Data Last Updated: 2007-04-11 09:38:34 EST)
|
|||||||||||||||||||||||||||||
| 06-30-06 | 5 | 2\3 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
Disclaimer: the fact that I have known and worked with Josh on and off for around 10 years now has little bearing on my review of this book.
Anyone who believes they are a Java master should read this book, it is well written, captivating, informative and full of useful information! In short it's a must have (along with Effective Java) for your Java bookshelf (Review Data Last Updated: 2007-07-01 13:26:02 EST)
|
|||||||||||||||||||||||||||||
| 06-29-06 | 5 | 2\3 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
Disclaimer: the fact that I have known and worked with Josh on and off for around 10 years now has little bearing on my review of this book.
Anyone who believes they are a Java master should read this book, it is well written, captivating, informative and full of useful information! In short it's a must have (along with Effective Java) for your Java bookshelf (Review Data Last Updated: 2007-01-16 14:36:09 EST)
|
|||||||||||||||||||||||||||||
| 06-07-06 | 5 | 3\4 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
This is really another excellent book I've seen on Java. Authors try to model/abstract real-world senarios into some "silly trivia" puzzles. You may say they are "Not puzzles, just silly trivia", but if you are experienced Java developer, you will figure out what they really mean and then smile on them. I have to say I was lost in some of those puzzles before in my real-world programming history...
It's not easy to address real-world problems in such a generic way. This book really makes the complication simple. Great job! (Review Data Last Updated: 2007-07-01 13:26:02 EST)
|
|||||||||||||||||||||||||||||
| 06-06-06 | 5 | 1\2 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
This is really another excellent book I've seen on Java. Authors try to model/abstract real-world senarios into some "silly trivia" puzzles. You may say they are "Not puzzles, just silly trivia", but if you are experienced Java developer, you will figure out what they really mean and then smile on them. I have to say I was lost in some of those puzzles before in my real-world programming history...
It's not easy to address real-world problems in such a generic way. This book really makes the complication simple. Great job! (Review Data Last Updated: 2006-11-13 14:41:37 EST)
|
|||||||||||||||||||||||||||||
| 05-26-06 | 5 | 18\18 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
This book is filled with brainteasers about the Java programming language and its core libraries. Anyone with a working knowledge of Java can understand these puzzles, but many of them are tough enough to challenge even the most experienced programmer. Puzzlers are grouped according to the features they use, but you cannot assume that the trick to a puzzle is related to its chapter heading.
Most of the puzzles exploit counterintuitive or obscure behaviors that can lead to bugs. Every platform has them, but Java has far fewer than other platforms of comparable power. The goal of the book is to entertain the reader with puzzles while teaching you to avoid the underlying traps and pitfalls. By working through the puzzles, you become less likely to fall prey to these dangers in your own code and more likely to spot them the code of others over which you have maintenance priveleges. This book is meant to be read while you have access to a computer that has a Java development environment installed, ideally JDK 5.0, which is the latest release at the time I am writing this. That is because some of the puzzles rely on pitfalls in this particular release of Java. Most of the puzzles take the form of a short program that appears to do one thing but actually does something else. It's the reader's job to figure out what each program does. It would be best if you first study the program/puzzle and determine what you think it will do. Next, run the program and see if its expected behavior matches its actual behavior. Try to fix the program if you believe it is "broken". Finally, read the solution and see if it matches your answer. What is really great about this book is that it sticks to pitfalls in the core language and doesn't delve into any of the add-on API's or J2EE. You'll be surprised that so many pitfalls can be conjured up in the core language. Amazon does not show the table of contents, so I do that here along with a brief description of the type of puzzles in each chapter. 1. Introduction 2. Expressive Puzzles - The puzzles in this chapter are simple but not necessarily easy and involve only expression evaluation. My personal favorite : the statement "System.out.println(2.00 - 1.10);" displays 0.8999999999999999 instead of .9. There is a solution, but it is not pretty and showcases a pretty bad weakness in the Java language. 3. Puzzlers with Character - This chapter contains puzzles that concern strings, characters, and other textual data. This section contains several puzzles involving unicode characters, and one is a cautionary tale for language designers in character overloading. Example: System.out.print('H' + 'a'); prints the number 169 not the word "Ha" as you might imagine. 4. Loopy Puzzlers - All the puzzles in this chapter concern loops, such as coming up with declarations that turn simple loops into infinite ones. 5. Exceptional Puzzlers - The puzzles in this chapter concern exceptions and the closely related Try-finally statement. Most exhibit odd behavior such that simple changes in the program cause completely different types of exception handling to occur. 6. Classy Puzzlers - This chapter contains puzzlers that concern the use of classes and their instances, methods, and fields. 7. Library Puzzlers - The puzzles in this chapter concern basic library-related topics, such as Object methods, collections, Date, and Calendar. One particularly interesting puzzler illustrates that, in Java, integer literals beginning with a "0" are interpreted as octal values. This obscure construct is a holdover from the C programming language and the 1970s, when octal was much more commonly used than today. Thus "012" is seen by Java as 10 base 10. 8. Classier Puzzlers - The puzzles in this chapter concern inheritance, overriding, and other forms of name reuse. 9. More Library Puzzlers - The puzzles in this chapter feature more advanced library topics, such as threading, reflection, and I/O. Here you will learn, for example, that "write(int)" is the only Java output method that does not flush a PrintStream on which automatic flushing is enabled. Thus you must explicitly invoke "flush" on its stream to print any message, making the "write" method seem unfriendly and outright pointless. 10. Advanced Puzzlers - The puzzles in this chapter concern advanced topics, such as nested classes, generics, serialization, and binary compatibility. A. Catalog of Traps and Pitfalls - This chapter contains a concise taxonomy of traps and pitfalls in the Java platform. Each entry in the catalog is divided into three parts - A short description of the pitfall, how to avoid the trap, and pointers to additional information on the trap. B. Notes on the Illusions - This appendix contains brief descriptions of the graphical illusions that appear throughout the book. The descriptions are grouped loosely by category. Within each category, the order is roughly chronological. This book is very good practice for anybody who enjoys programming in the Java language, but it will probably appeal the most to the geekiest among us of which I proudly count myself. (Review Data Last Updated: 2007-07-01 13:26:02 EST)
|
|||||||||||||||||||||||||||||
| 05-26-06 | 5 | 3\3 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
This book is filled with brainteasers about the Java programming language and its core libraries. Anyone with a working knowledge of Java can understand these puzzles, but many of them are tough enough to challenge even the most experienced programmer. Puzzlers are grouped according to the features they use, but you cannot assume that the trick to a puzzle is related to its chapter heading.
Most of the puzzles exploit counterintuitive or obscure behaviors that can lead to bugs. Every platform has them, but Java has far fewer than other platforms of comparable power. The goal of the book is to entertain the reader with puzzles while teaching you to avoid the underlying traps and pitfalls. By working through the puzzles, you become less likely to fall prey to these dangers in your own code and more likely to spot them the code of others over which you have maintenance priveleges. This book is meant to be read while you have access to a computer that has a Java development environment installed, ideally JDK 5.0, which is the latest release at the time I am writing this. That is because some of the puzzles rely on pitfalls in this particular release of Java. Most of the puzzles take the form of a short program that appears to do one thing but actually does something else. It's the reader's job to figure out what each program does. It would be best if you first study the program/puzzle and determine what you think it will do. Next, run the program and see if its expected behavior matches its actual behavior. Try to fix the program if you believe it is "broken". Finally, read the solution and see if it matches your answer. What is really great about this book is that it sticks to pitfalls in the core language and doesn't delve into any of the add-on API's or J2EE. You'll be surprised that so many pitfalls can be conjured up in the core language. Amazon does not show the table of contents, so I do that here along with a brief description of the type of puzzles in each chapter. 1. Introduction 2. Expressive Puzzles - The puzzles in this chapter are simple but not necessarily easy and involve only expression evaluation. My personal favorite : the statement "System.out.println(2.00 - 1.10);" displays 0.8999999999999999 instead of .9. There is a solution, but it is not pretty and showcases a pretty bad weakness in the Java language. 3. Puzzlers with Character - This chapter contains puzzles that concern strings, characters, and other textual data. This section contains several puzzles involving unicode characters, and one is a cautionary tale for language designers in character overloading. Example: System.out.print('H' + 'a'); prints the number 169 not the word "Ha" as you might imagine. 4. Loopy Puzzlers - All the puzzles in this chapter concern loops, such as coming up with declarations that turn simple loops into infinite ones. 5. Exceptional Puzzlers - The puzzles in this chapter concern exceptions and the closely related Try-finally statement. Most exhibit odd behavior such that simple changes in the program cause completely different types of exception handling to occur. 6. Classy Puzzlers - This chapter contains puzzlers that concern the use of classes and their instances, methods, and fields. 7. Library Puzzlers - The puzzles in this chapter concern basic library-related topics, such as Object methods, collections, Date, and Calendar. One particularly interesting puzzler illustrates that, in Java, integer literals beginning with a "0" are interpreted as octal values. This obscure construct is a holdover from the C programming language and the 1970s, when octal was much more commonly used than today. Thus "012" is seen by Java as 10 base 10. 8. Classier Puzzlers - The puzzles in this chapter concern inheritance, overriding, and other forms of name reuse. 9. More Library Puzzlers - The puzzles in this chapter feature more advanced library topics, such as threading, reflection, and I/O. Here you will learn, for example, that "write(int)" is the only Java output method that does not flush a PrintStream on which automatic flushing is enabled. Thus you must explicitly invoke "flush" on its stream to print any message, making the "write" method seem unfriendly and outright pointless. 10. Advanced Puzzlers - The puzzles in this chapter concern advanced topics, such as nested classes, generics, serialization, and binary compatibility. A. Catalog of Traps and Pitfalls - This chapter contains a concise taxonomy of traps and pitfalls in the Java platform. Each entry in the catalog is divided into three parts - A short description of the pitfall, how to avoid the trap, and pointers to additional information on the trap. B. Notes on the Illusions - This appendix contains brief descriptions of the graphical illusions that appear throughout the book. The descriptions are grouped loosely by category. Within each category, the order is roughly chronological. This book is very good practice for anybody who enjoys programming in the Java language, but it will probably appeal the most to the geekiest among us of which I proudly count myself. (Review Data Last Updated: 2006-06-15 13:02:40 EST)
|
|||||||||||||||||||||||||||||
| 05-04-06 | 5 | 4\4 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
After I bought the book, my girlfriend took one look at it and promptly declared it "the geekiest book EVER." But then she reluctantly had to admit that at least the optical illusions were cool.
It seems a strange subject on which to have a book, but actually, some of these make great interview questions (shh, don't tell anyone)! Admittedly, some of them are obscure edge cases, but some of them are great for testing core Java competency. And some of the more difficult ones are useful "pick your brain" questions for insight into how people think. Some of my coworkers and I have a "puzzle du jour" where we read the next item from the book and attempt to guess it. A great team-building exercise! (Review Data Last Updated: 2007-07-01 13:26:02 EST)
|
|||||||||||||||||||||||||||||
| 05-03-06 | 5 | 4\4 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
After I bought the book, my girlfriend took one look at it and promptly declared it "the geekiest book EVER." But then she reluctantly had to admit that at least the optical illusions were cool.
It seems a strange subject on which to have a book, but actually, some of these make great interview questions (shh, don't tell anyone)! Admittedly, some of them are obscure edge cases, but some of them are great for testing core Java competency. And some of the more difficult ones are useful "pick your brain" questions for insight into how people think. Some of my coworkers and I have a "puzzle du jour" where we read the next item from the book and attempt to guess it. A great team-building exercise! (Review Data Last Updated: 2006-11-13 14:41:37 EST)
|
|||||||||||||||||||||||||||||
| 03-20-06 | 1 | 9\24 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
This is not a fun puzzle book--it's just a bunch of strange Java programs that produce unexpected output because of, in the authors' opinions, problems with the Java language. There was one puzzle in the entire book the I fealt was fun to work out and provided real-world insight into programming and testing. The vast majority of the code samples are so bad to start out with that it doesn't matter what they produce--anyone that writes them in a production app should be fired.
The rest were all weird edge conditions, not fun puzzles to solve. With every example the authors talk about how Java could have been written better so these samples wouldn't produce such unexpected results. Really it's more of an advertisement for .NET than anything else because many of the weirdest samples would produce exceptions in .NET whereas in Java they just do strange things. (Review Data Last Updated: 2006-11-13 14:41:37 EST)
|
|||||||||||||||||||||||||||||
| 03-19-06 | 5 | 4\4 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
I have been working with Java since 1997 and after all that time I thought I new Java. I also managed to earn few Java certifications. So I was quite confident I could cut good code that would run as expected.
That was until I read (...)Java Puzzlers (...)written by Joshua Bloch and Neal Gafter. Boy, I was wrong! There were so many examples of Java code that I expected to produce different results. I strongly recommend reading this book. It will give you an insight into the core of Java classes, objects, primitive types, libraries, and more... Serious geek fun! Moreover I recently visited Javalobby website and found an interactive (...)Yet More Java Puzzlers (...)talk slideshow that illustrates eight more Java puzzlers that were presented on JavaPolis 2005 conference. If you don't have the book yet, have a look at the free Sample Chapter (...)or Yet More Java Puzzlers for a hint of Java flavour. It's goof fun, plus you learn something from it. (Review Data Last Updated: 2006-11-13 14:41:37 EST)
|
|||||||||||||||||||||||||||||
| 12-25-05 | 5 | 3\6 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
Trick or treat? This entertaining book will give you a treat, and in the bargain, teach you a few tricks. It is the equivalent of Dungeons and Dragons for Java aficionados -- discoveries and thrills in every puzzle. Take my word for it and turn to the first page!
(Review Data Last Updated: 2006-07-07 09:42:52 EST)
|
|||||||||||||||||||||||||||||
| 12-11-05 | 5 | 2\5 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
Whether you're a Java expert or a novice, this book contains excellent material to get you thinking more carefully. Very entertaining.
(Review Data Last Updated: 2006-07-07 09:42:52 EST)
|
|||||||||||||||||||||||||||||
| 12-07-05 | 3 | 4\8 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
I must confess, I am a bit tempted by the overwhelming superlative reviews... Don't get me wrong, I think extremely high of Joshua Bloch and the excellent "Effective Java" (5 stars). While this "puzzlers" collection was interesting and educational overall, I found them a bit ... childish. When the "catch" is the fact that "l" looks like 1, and in fact, I will not divulge the puzzle ... Personally I remain, as inferred by now, a great fan of "Effective Java". One more personal preference, I found "Appendix A- Catalog of Traps and Pitfalls" very helpful and I used it, before reading the puzzles, to address various topics.
(Review Data Last Updated: 2006-07-07 09:42:53 EST)
|
|||||||||||||||||||||||||||||
| 11-22-05 | 5 | 30\30 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
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. (Review Data Last Updated: 2006-07-07 09:42:54 EST)
|
|||||||||||||||||||||||||||||
| 11-19-05 | 5 | 9\10 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
This is the type of book I'd like to see more of in the marketplace... Java Puzzlers - Traps, Pitfalls, and Corner Cases by Joshua Bloch and Neal Gafter. Extremely well-done...
Contents: Introduction; Expressive Puzzlers; Puzzlers with Character; Loopy Puzzlers; Exceptional Puzzlers; Classy Puzzlers; Library Puzzlers; Classier Puzzlers; More Library Puzzlers; Advanced Puzzlers; Catalog of Traps and Pitfalls; Notes on the Illusions; References; Index What Bloch and Gafter have done here is provide the Java coder with some educational opportunities unlike others. They've taken code blocks that look like they should do one thing, but actually do something entirely different. It's the job of the reader to figure out what they *really* do, why they behave that way, and how you'd change the code to get the result you were probably after. The material covers the gamut of normal Java scenarios, including string concatenation, looping, class definitions, and others. The code is available for download from a website, so you don't have to type in anything to get started. And of course, they *do* provide answers... :) Couple all this great material with a humorous writing style and fun optical illusions, and you've got a book that works very well. The reason I like this book so much is that most programming language books stick to the core material. We all know there are exceptions and quirks, but you normally don't find out about those unless you find a magazine article series that someone has written. Even then, you're getting one or two gems every month, and it's hard to keep the momentum. Having 95 of these puzzlers all in one place means that you can dive in and start wracking your brain at your own pace. I'd like to see this type of book for many other languages... Most definitely recommended if you're a Java coder with any level of experience. You'll be forced to question things you've assumed in the past, and you'll come away a much better developer... (Review Data Last Updated: 2006-06-28 13:03:46 EST)
|
|||||||||||||||||||||||||||||
| 11-18-05 | 5 | 9\11 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
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. (Review Data Last Updated: 2006-06-06 12:40:25 EST)
|
|||||||||||||||||||||||||||||
| 09-13-05 | 4 | 4\4 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
Well known Java author Bloch has joined with Gafter to produce a fun and educational offering. They reckon that you know Java. Which version is not especially crucial, though the text suggests 1.5. Using 1.3 or even 1.2 would still let you do most of the puzzles.
What they provide is to probe Java for nuances usually neglected in texts that are explaining Java to a newcomer. A good way to use this book is to read each puzzle and then refrain forcibly from turning the page to the solution. Yes, the text is carefully arranged so that a page must indeed be turned to get at the latter. Grit your teeth and think carefully about the puzzle. No sweat, no gain. (Review Data Last Updated: 2006-05-26 11:37:14 EST)
|
|||||||||||||||||||||||||||||
| 09-11-05 | 5 | 3\4 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
This is one of the most intellectually challenging programming books that I have ever read. The authors have collected a set of 95 unusual programming problems in the Java language. None is more than a few lines of code and while I was familiar with some of them, the majority was completely new to me.
The puzzles are placed in ten categories, each of which is the title of a chapter. They are: *) Expressive puzzlers - problems that arise based on the mistaken evaluation of expressions. *) Puzzles with character - problems that involve how characters are represented in Java. *) Loopy puzzlers - problems that involve the different types of loops in Java. *) Exceptional puzzlers - problems that involve the use of exceptions. *) Class puzzlers - puzzlers that arise when working with classes. *) Library puzzlers - puzzlers that involve methods in the libraries. *) Classier puzzlers - puzzlers involving inheritance, overriding and other forms of reuse. *) More library puzzlers - puzzlers that involve more advanced library methods. *) Advanced puzzlers - puzzlers involving advanced topics such as nested classes, generics and serialization. The solutions to some of the puzzles astonished me, although all were understandable. For example, there is no guarantee that the Math.abs method will return a non-negative number. If the argument is Integer.MIN_VALUE or Long.MIN_VALUE it will return the negative argument. The reason is that in the 2's complement representation for these numbers, there is no positive counterpart. Each puzzle begins with a segment of code accompanied by questions about the code. This is followed by a detailed explanation of what the code does and why. While I concede that some of the puzzles involve obscure and unlikely possibilities, they are situations that all Java programmers should be aware of. I strongly recommend that all Java programmers read this book. (Review Data Last Updated: 2006-05-03 10:11:51 EST)
|
|||||||||||||||||||||||||||||
| 08-30-05 | 5 | 4\4 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
This is a fun book that's educational, too! The purpose is to help the reader learn about traps you can fall into coding in Java through the use of code puzzles. There are 95 puzzlers with each puzzle and associated solution discussion running two to three pages each. Appendix A provides a quick summary of the various traps identified in the book and the puzzlers in which they appeared. Appendix B describes the optical illusions scattered throughout the book.
In general each puzzler has a very short description of what the program appears to do and the program itself. It is your job to figure out what the program actually does and more importantly why. The following page is a discussion of why the program actually does what it does. Important points and traps to avoid are bolded in the discussion. Note that some of the puzzlers depend on you having Java 1.5. You could zip through a number of the puzzlers pretty quickly - but don't. Bloch and Gafter want you to think about and be aware of the language features and APIs you are using along with having fun. Read the description and the code, determine what the code does, run the code, and then, in most cases, rethink your analysis. Then read the solution and think about what the authors are saying. Go read the sections of the Java Language Specification or other references mentioned in the solution. I enjoyed the writing style of Java Puzzlers and prefer books that have short sections in the style of Effective Java or Practical Java. My one minor complaint is that while you have to turn the page to see the solution to the puzzle you are working you can see the solution for the previous puzzle. This implies that you work the puzzles in order or have great willpower so you don't read the interesting information contained in the previous solution. That is surely a greater test than many of the puzzlers! Full Disclosure: I received a free copy of this book for review. (Review Data Last Updated: 2006-03-20 13:30:17 EST)
|
|||||||||||||||||||||||||||||
| 08-11-05 | 5 | 4\4 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
Java Puzzlers is a wonderful book that demonstrates how easy it is to fall into one of the numerous traps or pits that the Java language has strewn about. Even expert level Java developers make many of the mistakes that Bloch and Gafter show you how to avoid in Java Puzzlers.
The book contains about 90 brief programs. The authors ask you to read each snippet, think through it, and determine what the output of each program should be. Each program is always carefully positioned on the bottom right hand side, so that you can't see the solution beginning on the next page. The code snippets don't just represent cute little problems that you come across when deliberately attempting to code poorly or with obscurity (like the code examples you might see in a Java certification exam). Most examples look like code you might see (and that I see quite often) in a typical app, code that on the surface looks like it should work just fine. Bloch and Gafter explain the cause for each interesting result. They then tell you "don't do that," and patiently explain how to improve your approach so as to produce the correct code. I really enjoyed Java Puzzlers, and along with Bloch's Effective Java (and of course Agile Java), it's one of the few Java books I can universally recommend. It will definitely make you a better professional programmer if you take its lessons to heart. As someone who's developed in Java for almost 10 years and written a couple books on it, I can guarantee you that you'll learn quite a bit from this book. I certainly did. The book is a fun and quick read, and for me it contained some very interesting "wow" moments. The optical illusions (and the brief discussion of them in the back of the book) add to the attractiveness of Java Puzzlers. Most of the coding errors demonstrated in Java Puzzlers should never see the light of production day. Unfortunately, many of them do. My only suggestion for the book would've been to include a bit of emphasis on how comprehensive unit testing would help eliminate these defects as soon as they're introduced. But if you want to learn how to do that, you can always check out Agile Java. (Review Data Last Updated: 2005-11-09 15:33:15 EST)
|
|||||||||||||||||||||||||||||
| 07-15-05 | 5 | 11\11 |
| Reviewer | Permalink | ||||||||||||||||||||||||
|
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. (Review Data Last Updated: 2005-11-09 15:33:16 EST)
|
|||||||||||||||||||||||||||||
| Reader Reviews 1 - 30 of 30 | |||||||||||||||||||||||||||||
| All Books | Arts | Biography | Click Here For An A-Z Index Of All 213 Best-Seller Subjects | Business | Children's | Comics | ||||||
| Computers | Cooking | Engineering | Entertainment | Health | History | Home | Horror | Humor | Law | Fiction | Medicine | Mystery |
| Nonfiction | Outdoors | Parenting | Professional | Reference | Religion | Romance | Science | Sci-Fi | Sports | Teens | Travel | |