Java by Comparison
Become a Java Craftsman in 70 Examples
by Simon Harrer, Jrg Lenhard, Linus Dietz
Version: P1.0 (March 2018)
Copyright 2018 The Pragmatic Programmers, LLC. This book is licensed to the individual who purchased it. We don't copy-protect it because that would limit your ability to use it for your own purposes. Please don't break this trustyou can use this across all of your devices but please do not share this copy with other members of your team, with friends, or via file sharing services. Thanks.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g device are trademarks of The Pragmatic Programmers, LLC.
Every precaution was taken in the preparation of this book. However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein.
About the Pragmatic Bookshelf
The Pragmatic Bookshelf is an agile publishing company. Were here because we want to improve the lives of developers. We do this by creating timely, practical titles, written by programmers for programmers.
Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun. For more information, as well as the latest Pragmatic titles, please visit us at http://pragprog.com.
Our ebooks do not contain any Digital Restrictions Management, and have always been DRM-free. We pioneered the beta book concept, where you can purchase and read a book while its still being written, and provide feedback to the author to help make a better book for everyone. Free resources for all purchasers include source code downloads (if applicable), errata and discussion forums, all available on the book's home page at pragprog.com. Were here to make your life easier.
New Book Announcements
Want to keep up on our latest titles and announcements, and occasional special offers? Just create an account on pragprog.com (an email address and a password is all it takes) and select the checkbox to receive newsletters. You can also follow us on twitter as @pragprog.
About Ebook Formats
If you buy directly from pragprog.com, you get ebooks in all available formats for one price. You can synch your ebooks amongst all your devices (including iPhone/iPad, Android, laptops, etc.) via Dropbox. You get free updates for the life of the edition. And, of course, you can always come back and re-download your books when needed. Ebooks bought from the Amazon Kindle store are subject to Amazon's polices. Limitations in Amazon's file format may cause ebooks to display differently on different devices. For more information, please see our FAQ at pragprog.com/frequently-asked-questions/ebooks. To learn more about this book and access the free resources, go to https://pragprog.com/book/javacomp, the book's homepage.
Thanks for your continued support,
Andy Hunt
The Pragmatic Programmers
The team that produced this book includes: Andy Hunt (Publisher) Janet Furlow (VP of Operations) Brian MacDonald (Managing Editor) Jacquelyn Carter (Supervising Editor) Andrea Stewart (Development Editor) Liz Welch (Copy Editor) Potomac Indexing, LLC (Indexing) Gilson Graphics (Layout)
For customer support, please contact .
For international rights, please contact .
Table of Contents
Copyright 2018, The Pragmatic Bookshelf.
Early praise for Java by Comparison
This is the book Ive been waiting for since starting with intermediate Java programming courses. Without dwelling for too long on the basics, Java by Comparison leads you step by step to new insights on good coding practice. Instructive examples compare the dos and donts and make it easy for beginners to get the key points. Here, the book shines and shows its based on long-term classroom experience. Luckily, the book can be read as a textbook but is also useful as a reference. Im looking forward to using it in my classrooms. Are you sure your style is perfect? Get it!
Dr. Guido Wirtz |
Professor for CS/Head of Distributed Systems Group, University of Bamberg |
I wish Java by Comparison had been there when I was getting started with programming, Its like a mentor, looking over your shoulder, and patiently helping you get your programming skills up to the next level.
Achim Weimert |
CTO, wOndary LTD |
Java by Comparison is a wonderful read for all those who want to level up their Java skills. It contains the essence of Effective Java and Clean Code, updated with JUnit 5 and Java 8.
Johannes Schwalb |
Java Architect, uniVersa Versicherungen |
The definitive guide for students to bridge the gap between the novice and the intermediate level.
Dr. Oliver Kopp |
Postdoc, University of Stuttgart |
Java by Comparison is a well-crafted quick read with good, succinct examples updated with the latest Java 8 styling. Highly recommended for Java developers a few years into their career.
Ashish Bhatia |
Software Engineer |
I think Java by Comparison hits a sweet spot between providing useful content and not trying to be too much. It is an easier and more directly applicable read for junior developers than Effective Java (the best Java book). Experienced developers will be seen nodding in agreement and likely learn a couple things along the ride. This will be required readingfor developers.
Sebastian Larsson |
Competence Team Lead, Cybercom Sweden |
To become a software craftsman, you need to practice, practice, practice. Java by Comparison can accompany you during those practices. With the comparison approach, bad code to better code, it can serve as a reference during your practice hours.
Zulfikar Dharmawan |
Software Engineer |
Java by Comparison presents a number of examples on how to improve your coding skills and serves as a shortcut for beginners or intermediate programmers to become experienced programmers. The book in a sense provides a lower-level version of design patterns focusing on code structure rather than on higher-level constructs.
Dr. Martin Blom |
Associate Professor, Karlstad University |
Java by Comparison is a great read if you are looking to take your Java knowledge up another notch. I wish I could have read this book or something similar when I first started with Java; it explains a lot of topics easily that I had to learn the hard way. It is a must-read if you want to go from a good programmer to a great one.
Ramaninder Singh Jhajj |
Big Data Engineer, Betsson Group |
Well organized and full of examples, Java by Comparison can help you whether you are a student or a developer with years of experience.
Emanuele Origgi |
Android Software Engineer, Funambol Inc. |