Value Objects in Ruby To Define Boundaries Between Sub-Domains
Value Objects are immutable data structures that cannot be changed.
Although Ruby’s core library does not enforce immutability, we should move towards that ideal. Value Objects are language-agnostic, and each language has its way of implementing them.
In Ruby, a Struct bases equality on attributes rather than object identity:
We protect sub-domains from input by using values as boundaries.
Values in your system afford to shift process boundaries. In general, values in your system afford shifting boundaries between anything. The class arrangement, subsystem arrangement, between any external component and your internal domain. Independent of the communication mechanism, whether it is serial or parallel.
Every value in your system is a potential message, a possible message between two processes.
[¹]: Domain-Driven Design: Tackling Complexity in the Heart of Software