The Transparency of Value Objects

Rafael A. George Duval
1 min readAug 6, 2022

Value Objects

Objects that are equal due to the value of their properties are called value objects.

Values should be easy to construct; therefore, every programming language provides a mechanism to build values straightforwardly.

Value objects are immutable. Values are Language Agnostic

For example, building an integer from a string in Ruby looks like the following:

Every single primitive type is a value. Thus, values should expose their meaning in a system’s context.

Values expose meaning

Values in a system can be used to measure things because they represent meaning. Thus, they need to compare with each other.

Objects that are equal due to the value of their properties are called value objects.[¹]

Values should be transferable.

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 its’ serial or parallel.[²]

Every value in your system is a potential message, a possible message between two processes.[²]

Values are Context Bound[³]

— —

[¹]: Martin Fowler (2016): ValueObject (https://www.martinfowler.com/bliki/ValueObject.html)

[²]: Gary Bernhardt (2021): Ruby Conf 12 — Boundaries by Gary Bernhardt (https://youtube.com/watch?v=yTkzNHF6rMs)

[³]: Defining Bounded Contexts

--

--

Rafael A. George Duval

✍🏼 Indie writer, chief editor of https://snippetsoftext.substack.com/ | 💻 Software Engineer | 📊 Tech Leadership