3 ms·
> The way is see ValueObjects is as the most convenient tool when working with a very well-defined space. My main problem with OOP in general is that people tr
by ajuc 4y ago
> The way is see ValueObjects is as the most convenient tool when working with a very well-defined space.
My main problem with OOP in general is that people try to write programs in ill-defined spaces without defining them first. OOP promises it will be fine: just hide everything behind black boxes and nobody needs to know what actually happens on zeroes and ones level. But it's a lie - somebody needs to make a conscious decision on what happens on data level. It needs to be well defined or you'll get a huge object-oriented ball of spaghetti code. Which if you ask me is even worse than procedural spaghetti code (cause it's harder to refactor).
So once you define your data space well - value objects are usually a good idea, even for complex types with variable-length containers inside.
The main exception is when you need in-place modification for performance reasons, but it's rare in business code.