How to Build a Good One Value Object (Domain-Driven Design)

Carlos Bueno
The Startup
Published in
3 min readJul 26, 2020

--

I’m gonna write some posts on the topic of Domain Driven Design. Over the years, I’ve come to some conclusions on how to apply DDD practices in general that I hope you will find helpful. I’ll try to distill my background with it to several points which I’ll illustrate with examples. Let’s start it.

I was wondering why is so painful to many developers build a Value Object, I have seen a lot of application built using DDD approach, but in almost all cases Primitive obsession is in everywhere.

If you don’t know what is a Primitive obsession I recommend that you read the article Functional C#: Primitive obsession written by Vladimir Khorikov.

In this article, we’ll focus on Domain and learn How to build a good one Entity avoiding Primitive obsession using Value Object. Also, We’ll use DomainDrivenDesing.Core, it’s my Framework with some basics pieces of stuff of DDD that will help us in this journey.

This is how a Payment entity would be made in an ordinary way using primitives:

--

--

Carlos Bueno
The Startup

Carlos Bueno: RPG enthusiast, Big Bang Theory fan, functional programming devotee, and software engineer at Proximus Luxembourg. #CodeAndRoll