Hot Best Seller

Effective Java

Availability: Ready to download

Since this Jolt-award winning classic was last updated in 2008 (shortly after Java 6 was released), Java has changed dramatically. The principal enhancement in Java 8 was the addition of functional programming constructs to Java's object-oriented roots. Java 7, 8, and 9 also introduced language features, such as the try-with-resources statement, the diamond operator for ge Since this Jolt-award winning classic was last updated in 2008 (shortly after Java 6 was released), Java has changed dramatically. The principal enhancement in Java 8 was the addition of functional programming constructs to Java's object-oriented roots. Java 7, 8, and 9 also introduced language features, such as the try-with-resources statement, the diamond operator for generic types, default and static methods in interfaces, the @SafeVarargs annotation, and modules. New library features include pervasive use of functional interfaces and streams, the java.time package for manipulating dates and times, and numerous minor enhancements such as convenience factory methods for collections. In this new edition of Effective Java, Bloch updates the work to take advantage of these new language and library features, and provides specific best practices for their use. Java's increased support for multiple paradigms increases the need for best-practices advice, and this book delivers. As in previous editions, each chapter consists of several "items," each presented in the form of a short, standalone essay that provides specific advice, insight into Java platform subtleties, and updated code examples. The comprehensive descriptions and explanations for each item illuminate what to do, what not to do, and why. Coverage includes: Updated techniques and best practices on classic topics, including objects, classes, methods, libraries, and generics How to avoid the traps and pitfalls of commonly misunderstood subtleties of the platform Focus on the language and its most fundamental libraries, such as java.lang and java.util


Compare

Since this Jolt-award winning classic was last updated in 2008 (shortly after Java 6 was released), Java has changed dramatically. The principal enhancement in Java 8 was the addition of functional programming constructs to Java's object-oriented roots. Java 7, 8, and 9 also introduced language features, such as the try-with-resources statement, the diamond operator for ge Since this Jolt-award winning classic was last updated in 2008 (shortly after Java 6 was released), Java has changed dramatically. The principal enhancement in Java 8 was the addition of functional programming constructs to Java's object-oriented roots. Java 7, 8, and 9 also introduced language features, such as the try-with-resources statement, the diamond operator for generic types, default and static methods in interfaces, the @SafeVarargs annotation, and modules. New library features include pervasive use of functional interfaces and streams, the java.time package for manipulating dates and times, and numerous minor enhancements such as convenience factory methods for collections. In this new edition of Effective Java, Bloch updates the work to take advantage of these new language and library features, and provides specific best practices for their use. Java's increased support for multiple paradigms increases the need for best-practices advice, and this book delivers. As in previous editions, each chapter consists of several "items," each presented in the form of a short, standalone essay that provides specific advice, insight into Java platform subtleties, and updated code examples. The comprehensive descriptions and explanations for each item illuminate what to do, what not to do, and why. Coverage includes: Updated techniques and best practices on classic topics, including objects, classes, methods, libraries, and generics How to avoid the traps and pitfalls of commonly misunderstood subtleties of the platform Focus on the language and its most fundamental libraries, such as java.lang and java.util

30 review for Effective Java

  1. 5 out of 5

    Eric

    This is the single best book I have seen or read about Java to date. Bloch, who has been involved in the development of the latest versions of the Java language and specification, does not teach how to write Java code; he teaches how to write GOOD Java code. This is a MUST READ for anyone who plans to write more than a little bit of Java code. But not only that, it is fairly easy to read and rather interesting. I had a few second thoughts after writing the review above, so I thought I'd better add This is the single best book I have seen or read about Java to date. Bloch, who has been involved in the development of the latest versions of the Java language and specification, does not teach how to write Java code; he teaches how to write GOOD Java code. This is a MUST READ for anyone who plans to write more than a little bit of Java code. But not only that, it is fairly easy to read and rather interesting. I had a few second thoughts after writing the review above, so I thought I'd better add two things. First, make sure you get the most recent edition of the book as there have been substantial changes. Second, this is not a beginner's book - you won't find "HelloWorld" here. Learn the Java basics first.

  2. 4 out of 5

    Andrew

    Score: 3.5/5 Effective Java: even the title is concise and to-the-point, like the rest of the book's writing. This is not a book for beginners, but rather a book on general software design concepts, particularly with respect to Java itself. The book is organized into a few dozen "items", most of which follow this format: 1) "Here's a suggestion. You should probably follow it." 2) "Here's an example of following it, here's an example of why not following it is bad, and here's an example of when you Score: 3.5/5 Effective Java: even the title is concise and to-the-point, like the rest of the book's writing. This is not a book for beginners, but rather a book on general software design concepts, particularly with respect to Java itself. The book is organized into a few dozen "items", most of which follow this format: 1) "Here's a suggestion. You should probably follow it." 2) "Here's an example of following it, here's an example of why not following it is bad, and here's an example of when you can ignore this suggestion." and then you've read that item. The good examples are good, and there's a lot to learn about writing software in general. He starts off with a solid defense of static factory methods (Item 1), offers patterns for successfully avoiding multithreading issues (Item 48) and serialization issues (Item 54), and even has sound general programming advice (Item 30: "Know and use the libraries", or Item 37: "Optimize judiciously"). Some of the suggestions seem to hinge on the assumption that the code you write is well-thought-out, such as Item 13: "Minimize the accessibility of classes and members." On the one hand, a well-designed module will be self-contained, easily usable via its publicly exposed methods, and will be more maintainable because of limited scope. On the other hand, how much code duplication occurs because a module's fields are private when they could be protected, or because certain parts of its implementation aren't exposed that should otherwise be reused? When faced with a compromise between writing extra code and entertaining the possibility of a client using your code in a way differently than you intended, Bloch always chooses writing extra code. The classic "favor composition over inheritance" (Item 14) is a great example of this, with his InstrumentedSet example marred by an unruly horde of "forwarding methods". Bloch never questions the language itself, but instead sometimes uses its design "decisions" as justification for suggestions. From Item 35, "Prefer interfaces to reflection", after providing a code example of using reflection (emphasis added): You can see two disadvantages of reflection in the example. First, the example is capable of generating three run-time errors, all of which would have been compile-time errors if reflective instantiation were not used. Second, it takes twenty lines of tedious code to generate an instance of the class from its name, whereas a constructor invocation would fit neatly on a single line. I understand that this book is about how to code in Java, but using the inconvenience of writing meta-code in Java as a reason to not write it (especially after how willing he is to add plenty of forwarding methods), instead of commenting on the language's design or pointing out in how many languages you could write the example in one line, is inexcusable. Bloch seems endlessly concerned with a potential "attacker" of your code (Item 3: "enforce noninstantiability with a private constructor", or Item 24: "make defensive copies when needed")---though not as much against "people maliciously accessing your servers" concern as "clients using your library in ways you did not intend them to." This has, of course, always been a dispute between Java programmers and Python/Perl/Ruby/JS developers in terms of how "open" libraries should be to manipulation if you need them to do something just slightly different than intended. I do find it amusing, however, given the existence of Java's reflection API---if someone wanted to "maliciously" misuse your API, the language won't stop them, but will just make it more difficult. I'm reminded of the ending from Steve Yegge's "Wikileaks to Leak 5000 Open Source Java Projects With All That Private/Final Bullshit Removed": "[This is what] Java developers who release Open Source […] code are saying: 'Here, I worked hard on this. I hope you like it. But use it exactly how I tell you to use it, because fuck you, it's my code. I'll decide who's the goddamn grown-up around here." This book deserves its reputation for being good at what it does: teaches you to write better Java. But the context is still Java, with all of its strengths and weaknesses. For better or worse, Bloch is writing about Java as it is, and not as it could be, and his assumptions about the reader's quality of judgment make you wonder how much code duplication he has inadvertently caused.

  3. 5 out of 5

    Christian Brumm

    Effective Java is THE BOOK you want to read first when you start writing Java code professionally (for a living). In the style of Scott Meyer's C++ books, Joshua Bloch - the head behind several modern Java libraries - presents the essential tricks of the trade and best practises when it comes to Java programming. This is essential when you want to write highly maintainable, efficient modern Java code. The second edition puts a lot of emphasis on all the new language features that came with Java 5 Effective Java is THE BOOK you want to read first when you start writing Java code professionally (for a living). In the style of Scott Meyer's C++ books, Joshua Bloch - the head behind several modern Java libraries - presents the essential tricks of the trade and best practises when it comes to Java programming. This is essential when you want to write highly maintainable, efficient modern Java code. The second edition puts a lot of emphasis on all the new language features that came with Java 5 and especially how they made past best practises obsolete. This is exactly what you don't get by reading general Java programming books or tips online - most of which is old and just not the best implementation possible. Implementation issues are treated from the perspective of API maintainability. This aims for very high quality standards (e.g. libraries) but is nevertheless interesting for every Java programmer. We are all writing APIs of some sort - in the extreme case just for ourselves. This book can safe you a lot of future headaches!

  4. 4 out of 5

    Miloš Milivojević

    Well, I've been staring at the screen and trying to rate this book for at least 20 minutes, all the while changing my mind every other minute or so. Writing a review for it is making me equally conflicted but at least in the review I'm not limited to only two options (3 or 4 stars, if anyone's wondering). First thing to say is that Joshua Bloch is a competent enough author - a bit dry but always to the point, clear, precise and thorough. And he really knows his Java - so much so that I regret not Well, I've been staring at the screen and trying to rate this book for at least 20 minutes, all the while changing my mind every other minute or so. Writing a review for it is making me equally conflicted but at least in the review I'm not limited to only two options (3 or 4 stars, if anyone's wondering). First thing to say is that Joshua Bloch is a competent enough author - a bit dry but always to the point, clear, precise and thorough. And he really knows his Java - so much so that I regret not having read this book (well, the previous edition at least) some 10 years ago when I was just starting out - it's definitely more useful to beginners and I could have learned a ton! The items themselves present the reader with sound advice but the choice of the items is what I take issue with: * some items read like they were written ~15 years ago for C++ folks moving to Java (enums and bitmaps, native code warnings) * others read like they were written to highlight old anti-patterns that probably very few devs use in this day and age (finalizers, clone, Serializables, wait/notify, yield...) * a few have disproportionate amount of space devoted to them given their importance (see previous point and add to it toString, hashCode & equals and probably a few others) * lots of them (by author's own admission) are more applicable of you're writing a library or framework intended for wide audiences/public use and seem needlessly defensive Summed up, the criticism amounts to this - while all the items included within are valid, the book would have had more to offer and reader to gain from cutting some of them short (or throwing them out completely) and replacing them with more practically useful items. What about I/O? Don't tell me there's nothing to say. And where are CompletableFutures, asynchronous and non-blocking programming? More from java.util.concurrency and Java's standard library in general? Or maybe I'm just a splendid curmudgeon in the making...

  5. 4 out of 5

    Rafi

    I read this book as a recommended reading for the Java developers at Google. I found many "items" described in this book quite useful in real-life coding. Sometimes the author has gone a little too far to describe a single item, but overall the book is very well written.

  6. 4 out of 5

    Ashkan Entezari

    An amazing book about Java and its different features. If you are a Java programmer, you will benefit a lot and learn a lot by reading this book. Whenever you want to pick up this book, make sure you take the latest edition as it changes a lot to accommodate new updates in the language and its libraries. I have summarized the entire book (3rd edition) here! This includes a summary of each item with its code examples in a way that is more concise and understandable. An amazing book about Java and its different features. If you are a Java programmer, you will benefit a lot and learn a lot by reading this book. Whenever you want to pick up this book, make sure you take the latest edition as it changes a lot to accommodate new updates in the language and its libraries. I have summarized the entire book (3rd edition) here! This includes a summary of each item with its code examples in a way that is more concise and understandable.

  7. 5 out of 5

    Anton Petrov

    By far the best programming book I have ever read to date.

  8. 5 out of 5

    Andrijana

    Some items were a little bit advanced for me as a beginner. Not so much in a sense that they were hard to understand, but they seemed so far away from me to even think about them at the first place or grasp their importance. But, I'm pretty sure that as my programming career continues I'll pick up this book as a reference and be able to appreciate it more.

  9. 4 out of 5

    Jonathan Zanella

    I started reading it to improve my knowledge of java and it was exactly what I found. The books is separated in 78 items with begin and end, so reading an item who is 2 to 3 pages long, you end with a new approach to something. It is really an enjoyable experience :)

  10. 5 out of 5

    Rodrigo Almeida

    The introduction and middle of the book are awesome, with incredible new informations about Java. After, there are some chapters very boring, for example, about the JavaDoc. Even if the book still very good.

  11. 5 out of 5

    Michael

    Although it is a bit outdated, 90% of the book contains great advise for any Java programmer. If you have not read this then you do not know how to program Java. -m

  12. 5 out of 5

    Rob

    Recommended for anyone who is doing full time professional Java development. Bloch well-codifies a lot of the otherwise cargo-culted tribal knowledge and conventions that are out there, as well as shedding light on many of the weird cases that we run into everyday. And/but/so then there's a bunch of items that are NOT a part of my everyday ... though I'm sure that's just a matter of circumstance, and for someone out there: they are. It gets pretty technical in places and by necessity can get into Recommended for anyone who is doing full time professional Java development. Bloch well-codifies a lot of the otherwise cargo-culted tribal knowledge and conventions that are out there, as well as shedding light on many of the weird cases that we run into everyday. And/but/so then there's a bunch of items that are NOT a part of my everyday ... though I'm sure that's just a matter of circumstance, and for someone out there: they are. It gets pretty technical in places and by necessity can get into the weeds, but most of the content should be accessible to journeyman developers, as well as committed novices.

  13. 5 out of 5

    Farplaneguide

    I found this book by asking a simple question, which books are mandatory reading to learn about Java. Once I finished it I realized it also answered another question, "which books are recommended reading for any software developer". Often times when trying to learn a new language or improve knowledge on a familiar one, it feels like most available literature is aimed at students learning to code or at experienced developers trying to improve some highly technical knowledge. The books that I find I found this book by asking a simple question, which books are mandatory reading to learn about Java. Once I finished it I realized it also answered another question, "which books are recommended reading for any software developer". Often times when trying to learn a new language or improve knowledge on a familiar one, it feels like most available literature is aimed at students learning to code or at experienced developers trying to improve some highly technical knowledge. The books that I find the best are the ones that are about learning from experience. That's how this books feels, not as a glossary on how to code in Java, but instead as a personal blog of an experienced developer going through learned lessons and past mistakes.

  14. 4 out of 5

    Giovani Facchini

    This is an amazing book for Java developers and it shows that Joshua really knows his stuff. It clarifies and shows in deep details the internals of Java and how it should be used in order for you to be more effective. It is a great reading and I strongly recommend it. It is important to notice that as this book shows 90 recommendations, it is hard for the reader to remember everything, so you should use it as a reference book when you are going to implement something. Personally, I have printed This is an amazing book for Java developers and it shows that Joshua really knows his stuff. It clarifies and shows in deep details the internals of Java and how it should be used in order for you to be more effective. It is a great reading and I strongly recommend it. It is important to notice that as this book shows 90 recommendations, it is hard for the reader to remember everything, so you should use it as a reference book when you are going to implement something. Personally, I have printed the chapter titles, so I remember to study the specific recommendation when I am creating something new. The author was responsible for architecting and implementing many Java features and he exposes good and bad practices of many libraries that we use today, so we have a better understanding of what to use and not to use. In summary, read this book! :)

  15. 5 out of 5

    Nathan Ormond

    Very useful - will now make a great reference

  16. 4 out of 5

    Alexander

    Fantastic book that any Java developer should read at some point in their career (preferably earlier on)! Very well laid out and contains many invaluable principles/conventions with good explanations that, when followed, will improve the code you produce.

  17. 5 out of 5

    Erik Nilson

    The very best book about this topic. I learned lot from this book — thanks to authors.

  18. 5 out of 5

    Andrzej Szelemetko

    I have read the 3rd edition of this book, which is updated for Java 8. It’s a collection of 90 best practices for developers. Those practices cover a wide range of mostly used Java features, including generics, exceptions, concurrency, serialization, lambdas and many others. A lot of relevant code examples showing both the good and the bad code followed by a robust explanation. The focus is on developers who create APIs that others will use, however IMHO everyone writing in Java would benefit fr I have read the 3rd edition of this book, which is updated for Java 8. It’s a collection of 90 best practices for developers. Those practices cover a wide range of mostly used Java features, including generics, exceptions, concurrency, serialization, lambdas and many others. A lot of relevant code examples showing both the good and the bad code followed by a robust explanation. The focus is on developers who create APIs that others will use, however IMHO everyone writing in Java would benefit from this book. I wouldn’t recommend this book to beginners who are not yet fluent in various aspects of Java. The examples are complex and can be confusing for someone with little experience. I tried to read the previous version when I still had little experience. I have found the book too difficult and I gave up after just 30 pages. Having a couple more years of Java coding in my life I have tried again and this time it has been a blast. I have learned a lot and will use this book as reference throughout my career. Thanks to mr Bloch for this great book.

  19. 5 out of 5

    Francis

    This is a unique and very worthwhile work for experienced Java developers who want to take their Java skills to the next level. It assumes that the reader is fully comfortable programming in Java, and gives a collection of tips on how to exploit certain language features, how to avoid various pitfalls, and so forth. The book makes frequent reference to design patterns, but it is not a design patterns book. It is also distinct from a “software engineering” book, but rather concentrates on aspects This is a unique and very worthwhile work for experienced Java developers who want to take their Java skills to the next level. It assumes that the reader is fully comfortable programming in Java, and gives a collection of tips on how to exploit certain language features, how to avoid various pitfalls, and so forth. The book makes frequent reference to design patterns, but it is not a design patterns book. It is also distinct from a “software engineering” book, but rather concentrates on aspects of Java that are do (or do not) accomplish various software engineering goals. The author does not hesitate to point out inadequacies and inconsistencies in the Java language itself, often as cautionary tales to illustrate the consequences of insufficiently thought-out design decisions made early in the language’s life. I give Effective Java my highest recommendation.

  20. 4 out of 5

    Tomasz

    If most programmers consider Core Java to be the best book for beginners, they should think about “Effective Java” as the best book for intermediate and more advanced Java programmers. After this book my awareness about how good Java code should look like improved a lot. I learnt a lot of interesting and useful approaches to developing code in different situations. And, in spite of being heavily packed of knowledge, I can not say that reading this book was difficult. It was a nice lecture althoug If most programmers consider Core Java to be the best book for beginners, they should think about “Effective Java” as the best book for intermediate and more advanced Java programmers. After this book my awareness about how good Java code should look like improved a lot. I learnt a lot of interesting and useful approaches to developing code in different situations. And, in spite of being heavily packed of knowledge, I can not say that reading this book was difficult. It was a nice lecture although some topics are more complicated and forced me to slow down and analyse paragraphs one by one. More on my blog post.

  21. 5 out of 5

    John Chilton

    If you program Java, you must read this book. You won't learn any new syntax, language feature, library, or framework, but you will be a much better programmer as a result of reading this book. Its the best anything on Java I have read. I don't agree with 100% of the material in this book, but Joshua Bloch has a strong, clear opinions and he argues them well. This book is so good, I think you should read it even if you aren't a Java programmer but program C#, C++, or something else along those l If you program Java, you must read this book. You won't learn any new syntax, language feature, library, or framework, but you will be a much better programmer as a result of reading this book. Its the best anything on Java I have read. I don't agree with 100% of the material in this book, but Joshua Bloch has a strong, clear opinions and he argues them well. This book is so good, I think you should read it even if you aren't a Java programmer but program C#, C++, or something else along those lines. Even Ruby and Python programmers will probably get a lot out of this book.

  22. 5 out of 5

    Dimitko

    This book impressed me with the amount of practical use-cases of Java subtleties and intricacies -- for example, the proper implementation of "equals" method in classes. The author not only shows us some common misconceptions about the "low level" Java mechanics (not the native level, but the basics of the language and the Java API), but also gives us many examples from his rich carreer. It is my opinion that understanding the basics of Java (it turns out many of us don't) is the key to avoiding m This book impressed me with the amount of practical use-cases of Java subtleties and intricacies -- for example, the proper implementation of "equals" method in classes. The author not only shows us some common misconceptions about the "low level" Java mechanics (not the native level, but the basics of the language and the Java API), but also gives us many examples from his rich carreer. It is my opinion that understanding the basics of Java (it turns out many of us don't) is the key to avoiding mistakes which are subsequently very hard to track, and this book helps exactly with this.

  23. 4 out of 5

    Denis

    This book is simply brilliant. Updated to the most recent language specification it covers a lot of issues and caveats that almost every Java developer encounters every day. The author is the guy who has designed and implemented the Collections framework and he knows his subject very well. This book can and definitely will increase one's productivity dramatically. The only obvious prerequisite is that a reader should already know and have experience in Java. Otherwise it would be better to inves This book is simply brilliant. Updated to the most recent language specification it covers a lot of issues and caveats that almost every Java developer encounters every day. The author is the guy who has designed and implemented the Collections framework and he knows his subject very well. This book can and definitely will increase one's productivity dramatically. The only obvious prerequisite is that a reader should already know and have experience in Java. Otherwise it would be better to invest some time and learn the language itself.

  24. 4 out of 5

    Venkat Pedapati

    If you have already done a few years of programming in an object oriented programming language like Java, this book might make you very uncomfortable. More than saying what to do, this book stresses on what not to do in Java and you'll thank for it in the long term. The tips are organised into items each of few pages and can be read independently.

  25. 5 out of 5

    Cristian Stan

    The author of this book is a name you will often encounter in the javadoc of some very important and hard classes from JDK itself. Is a book that tries to offer a list of useful advices for every professional Java developer but takes the time to explain why not just the how. A lot of useful stuff can be learned.

  26. 4 out of 5

    Steve

    Much like the other editions, an excellent reference about how to write idiomatically correct Java. Useful for newer programmers as well as for those who have been programming for a while in Java. It won’t tell you all you need to know, but will help you avoid problems. I expect that this will have a valuable place on my desk as I code.

  27. 5 out of 5

    Ryanjustus

    Amazing book that I would recommend every Java developer have in his library. This book covers the best practices aspects of programming Java that are pretty hard to pick up without years and years of trial and error and seeing what works best.

  28. 4 out of 5

    Jeffrey

    Easy to read for a programming book. Great information about the best way to use java. Also contains many sections detailing how changes in java affect how you should implement your code. Excellent for Java developers keeping current on Java

  29. 5 out of 5

    Owen Lindsell

    Points out loads of really important pitfalls that you really should know if you want to write quality code. In a style that's informative and enjoyable.

  30. 4 out of 5

    Zach Danielson

    Liked the 1st Edition so much I paid for the updated and expanded 2nd Edition. My co-workers and I are known to quote from St. Bloch when arguing for better software design.

Add a review

Your email address will not be published. Required fields are marked *

Loading...
We use cookies to give you the best online experience. By using our website you agree to our use of cookies in accordance with our cookie policy.