Refactoring 023 - Replace Inheritance with Delegation
Transform your rigid inheritance into flexible delegations
Feb 16, 20253 min read65

Search for a command to run...
Articles tagged with #java
Transform your rigid inheritance into flexible delegations

Nested or Pseudo-Private Classes seem great for hiding implementation details. TL;DR: Don't use nested classes Problems Bijection fault to real world concepts. Lack of testability Lack of reuse Scopes and namespaces complexity Solutions Make...

It is nice to see a class implementing Interfaces. It is nicer to understand what it does

Exceptions are handy Gotos and flags. Let's abuse them. TL;DR: Do not use exceptions for flow control. Problems Readability Principle of least astonishment Violation. Solutions Use Exceptions just for unexpected situations. Exceptions handle ...
