Aggregate Pattern
The Aggregate is one of the main patterns in Domain Driven Design (DDD), introduced by Eric Evans. As you may already deduce, it aggregates – but what exactly? An Aggregate is a cluster of domain...
The Aggregate is one of the main patterns in Domain Driven Design (DDD), introduced by Eric Evans. As you may already deduce, it aggregates – but what exactly? An Aggregate is a cluster of domain...
Introduction When we hear refactoring we often think about legacy code, and the other way around. What is legacy then? Well, in our context I would say that it is a code where we feel fear of chan...
Introduction Both @Mock and @MockBean create mock objects, but they operate in fundamentally different contexts. @Mock is a pure Mockito annotation that works without Spring, while @MockBean is a ...
Refactoring in a Business Context I have often encountered opinions that claim businesses (by businesses, I mean companies) don’t allow programming teams to refactor or spend time polishing code. ...
In real life and in programming, objects have relationships between each other. Three of them get mixed up constantly: composition, aggregation, and association. They all describe how objects relat...
Try adding 0.1 and 0.2 in Java: System.out.println(0.1 + 0.2); // 0.30000000000000004 The result is not 0.3. This is not a Java bug. It is how IEEE 754 floating-point arithmetic works: double an...
Boolean conditions in code tend to accumulate negations. A method might check !a && !b && !c, and after staring at it for a moment you realize it means “none of these are true.” De ...
The Builder is a creational design pattern that lets you construct complex objects step by step, producing different types and representations of an object using the same construction code. The Pr...
equals() method The equals() method is one of the fundamental methods available in the Object class. Due to the fact that every object in Java has this class in its inheritance hierarchy, we can c...
Imagine you have a list of Student objects and you need to sort them by age. Later, a new requirement comes in: sort them by name instead. Then another: sort by student number. Java provides two in...