Tag: clean code
-

Code Review: Text-based Monopoly in Java
Originally posted on Code Review Stack Exchange on 07.09.2021. Question asked by user “DexMax” and licensed under CC BY-SA 4.0. Answer provided by me and licensed under CC BY-SA 4.0. Original Question My Code Review Originally posted in 2021 as an answer on Code Review Stack Exchange. Kudos for this…
-

StringBuilder Cargo Cult
This post is based on an answer I posted on Stack Overflow. The code example was submitted as part of the question by Bruno Rozendo under CC BY-SA 3.0.Note: The context is the StringBuilder class in Java. Code examples are in Java. The accepted answer already explains how to do…
-

Clean Code is Not a Style Guide
The term is sometimes used to refer to a specific and opinionated way of writing code, the one described in the popular book “Clean Code” by Robert C. Martin. That book is now over 15 years old, and it contains some good advice along with lots of debatable, dogmatic and…
-

The Purpose of Getters and Setters
First of all, I don’t advocate for getters and setters at all. Don’t use them (especially setters) if you find an alternative. There usually is a better design. I won’t go into that here. I want to focus on a bigger, very common problem: Many of the people who use…
-

Taste Your Own Soup
Imagine this scenario: A restaurant cook learned from their grandmother the secret of her tasty soup. “Always put a tablespoon of salt in your soup”. And so they follow the advice, every day, no exception – and the customer reviews are, well, not great. “Disgusting”, says a food critic in…
-

Code Review: Common Beginner Mistakes
After a long time, I once again did a few code reviews on Code Review Stack Exchange. One of them (a beginner’s implementation of a rock-paper-scissors game) stuck out, since it contained many of the typical rookie mistakes I see in code from newcomers (although, some of them even in…
