Software Design
Hexagonal Architecture With Spring Boot
A practical, hands-on guide to building a Spring Boot application with Hexagonal Architecture. The article walks through separating business logic and infrastructure into modules, implementing ports and adapters, and testing the system with fast acceptance, integration, and end-to-end tests.
Hexagonal Architecture Explained
Hexagonal architecture, introduced by Alistair Cockburn, separates business logic from infrastructure using ports and adapters. This article explores the limitations of traditional layered architecture, explains how hexagonal architecture applies dependency inversion, and shows how to implement and test applications in isolation for better maintainability, flexibility, and long term code quality.
Code Quality Checks
Code quality often deteriorates over time, especially in legacy projects, slowing development and introducing bugs. Using code reviews, static analysis, and dynamic analysis helps detect issues early, while fast feedback loops prevent problems from accumulating. Combining these practices with continuous monitoring ensures cleaner, more maintainable code.
Code Smell: Dead code
This post explains why unused or unreachable parts of a project are a common warning sign in aging systems. It outlines how changing requirements and incomplete cleanups create unnecessary leftovers. The article focuses on practical ways to remove this clutter and keep projects lean and maintainable.
Code Smell: Large Class
This post examines why overly large classes make code harder to understand, maintain, and test. It outlines strategies for splitting classes, creating subclasses, or defining interfaces to clarify responsibilities. Refactoring in this way promotes better design, easier testing, and greater code reuse.
Avoiding Unnecessary Null Checks
Null checks are a common source of bugs and clutter in code. This article explores ways to avoid returning or passing nulls, including using the Null Object pattern, throwing exceptions, and designing objects that encapsulate behavior. By eliminating nulls, you simplify code, reduce errors, and encourage cleaner design.
Misconceptions About Code Reuse
Reusing code is important, but inheritance and static utility classes are often misapplied. Inheritance should focus on modeling hierarchies, not sharing methods, while utility classes can violate object-oriented principles. This article explains how to use composition and meaningful class responsibilities to create cleaner, more flexible, and maintainable code.
How to Prevent Legacy Code From Emerging
Legacy code does not appear out of nowhere. It often grows from small shortcuts, missing tests, and neglected refactoring. This article explains how developers unintentionally create messy, unmaintainable code and offers practical strategies to prevent it. By maintaining code, refactoring while adding features, and writing tests, you can keep your codebase clean and easier to work with over time.
Code Smell: Code comments
This post argues that frequent or explanatory comments often indicate overly complex implementation. Instead of relying on comments, developers should simplify structure, clarify intent through naming, and break down complex logic. It also outlines when comments remain appropriate and valuable.
Code Smell: Primitive Obsession
This post explains how overusing primitive data types to model domain concepts can weaken structure and create hidden complexity. It outlines strategies to replace grouped data with dedicated objects, strengthen typing, and reduce repetition. Refactoring in this way improves clarity, keeps related behavior together, and makes the system easier to maintain.