What do you think?
Rate this book


Write code that's clean, concise, and to the point: code that others will read with pleasure and reuse. Comparing your code to that of expert programmers is a great way to improve your coding skills. Get hands-on advice to level up your coding style through small and understandable examples that compare flawed code to an improved solution. Discover handy tips and tricks, as well as common bugs an experienced Java programmer needs to know. Make your way from a Java novice to a master craftsman.
This book is a useful companion for anyone learning to write clean Java code. The authors introduce you to the fundamentals of becoming a software craftsman, by comparing pieces of problematic code with an improved version, to help you to develop a sense for clean code. This unique before-and-after approach teaches you to create clean Java code.
Learn to keep your booleans in check, dodge formatting bugs, get rid of magic numbers, and use the right style of iteration. Write informative comments when needed, but avoid them when they are not. Improve the understandability of your code for others by following conventions and naming your objects accurately. Make your programs more robust with intelligent exception handling and learn to assert that everything works as expected using JUnit5 as your testing framework. Impress your peers with an elegant functional programming style and clear-cut object-oriented class design.
Writing excellent code isn't just about implementing the functionality. It's about the small important details that make your code more readable, maintainable, flexible, robust, and faster. Java by Comparison teaches you to spot these details and trains you to become a better programmer.
What You Need:
You need a Java 8 compiler, a text editor, and a fresh mind.That's it.
357 pages, Kindle Edition
Published March 22, 2018
Dieses Buch wagt sich an eine grosse Herausforderung: Wie kann man das über Jahre angeeignete Expertenwissen in einfacher Form Programmier-Anfängern zugänglich machen?
Die Autoren nutzen dazu 70 Beispiele, in denen ein funktionierender erster Wurf einer wartbaren und durchdachten Lösung gegenübergestellt wird. Die Unterschiede lassen sich ohne grossen Aufwand direkt erkennen. In der Druckversion ist die Ausgangslage jeweils auf der linken Seite beschrieben und das Resultat sowie die Verbesserungen befinden sich auf der rechten Seite – dadurch hat man immer beides im Blick. Dies macht es nicht nur einfach die Veränderungen zu sehen, sondern man bekommt genügend Kontext mitgeliefert, um den Unterschied zwischen beiden Lösungen auch zu verstehen.
Besonders gefallen hat mir der Teil aufräumen. Was als langweilige Pflichtaufgabe aussieht entpuppt sich als äusserst wertvolle Aktivität um den eigenen Code zu verbessern. Vereinfachte boolesche Ausdrücke, die Verhinderung von Negierung und der Verdeutlichung der eigentlichen Aufgabe sind Grundvoraussetzungen für wartbaren Code.
Die durchwegs aus der Praxis stammenden Beispiele werden gut und verständlich vermittelt. Daher ist dieses Buch aus meiner Sicht für alle Entwickler geeignet, die an wartbarem Code interessiert sind und sich verbessern wollen. Obwohl für Java geschrieben funktionieren fast alle Beispiele auch für .Net.