A value object is a reusable, immutable object that does not only encapsulate a primitive value, but also its behaviour. Identifying and extracting those value objects improve the cohesion in our code, and avoids duplication. Suppose i created a new component that consumed an already existing value object, i would be able to reuse the values methods instead of implementing duplicated code by accident.
24 Nov 2019
•
refactoring-java
Comments