Philipp Hauer's Blog

Engineering Management, Java Ecosystem, Kotlin, Sociology of Software Development

Clean Code

The Wall of Coding Wisdoms in Our Office

Posted on Feb 20, 2020

The Wall of Coding Wisdoms in Our Office

There are some principles in software development that I always try to keep in mind. They guide me when I’m in danger of heading in the wrong direction. That’s why I printed those principles and hung them on a wall in our office. In this post, I share this subjective set of quotes with you. There is also a PDF for download available.

Modern Best Practices for Testing in Java

Posted on Sep 9, 2019

Modern Best Practices for Testing in Java

Maintainable and readable test code is crucial to establish a good test coverage which in turn enables implementing new features and performing refactorings without the fear of breaking something. This post contains many best practices that I collected over the years of writing unit tests and integration tests in Java. It involves modern technologies like JUnit5, AssertJ, Testcontainers, and Kotlin. Some recommendations might be obvious to you, but some might conflict with what you’ve read in books about software development and testing.

Sealed Classes Instead of Exceptions in Kotlin

Posted on Feb 5, 2019

Sealed Classes Instead of Exceptions in Kotlin

Exceptions are a common mean to handle errors. However, they have some drawbacks when it comes to compiler support, safety and traceability. Fortunately, we can leverage Kotlin’s sealed classes to create result objects that solve the mentioned problems. This way, we get great compiler support and the code becomes clean, less error-prone, easy to grasp and predictable.

Code Review Guidelines for Humans

Posted on Jul 31, 2018

Code Review Guidelines for Humans

Code reviews are powerful means to improve the code quality, establish best practices and to spread knowledge. However, code reviews can come to nothing or harm interpersonal relations when they are done wrong. Hence, it’s important to pay attention to the human aspects of code reviews. Code reviews require a certain mindset and phrasing techniques to be successful. This post provides both the author and the reviewer with a compass for navigating through a constructive, effective and respectful code review.

Clean Code with Kotlin

Posted on Jun 25, 2017

Clean Code with Kotlin

With Kotlin we can write code that is easy to understand, short, expressive and safe. Sounds like clean code, doesn’t it? In this post, I go through some recommendations and principles of clean code and consider if Kotlin can help to fulfill this rules or not. Moreover, I show restrictions and points, where we should be careful. At the end, I discuss if Kotlin leads to “a dark or a bright path”.

Idiomatic Kotlin. Best Practices.

Posted on Mar 28, 2017

Idiomatic Kotlin. Best Practices.

In order to take full advantage of Kotlin, we have to revisit some best practices we got used to in Java. Many of them can be replaced with better alternatives that are provided by Kotlin. Let’s see how we can write idiomatic Kotlin code and do things the Kotlin way.

Checked Exceptions are Evil

Posted on Mar 28, 2015

Checked Exceptions are Evil

Java has checked exceptions and is out on a limb. Is there a reason, why other languages like C++, Objective-C, C#, Kotlin, Scala don’t support this concept? What is the problem about checked exceptions and what can we do instead? And most important: What do water wings and checked exceptions have in common? This article gives the answer to all of these questions and shows why unchecked exceptions are the better choice.