My Journey in Learning Domain-Driven-Design part4 (Value-objects)

What are value objects:

Value objects characteristics:

1- Measures, Quantifies, or Describes:

2- Immutable:

  • If the VALUE changes frequently
  • If object creation or deletion is expensive
  • If replacement (rather than modification) will disturb clustering
  • If there is not much sharing of VALUES, or if such sharing is forgone to improve clustering or for some other technical reason

3- Conceptual Whole:

FullName Value object with primitive type
FullName value object without primitive types

4- Value Equality:

5- Side-Effect-Free Behavior:

benefits of value objects:

1- Readability:

const PhoneNumbers: String[] = [...phoneNumbersStrings];
const phoneNumbers: PhoneNumbers[] = [...phoneNumbersValueObjects];

2- self-validation:

3- Reusability & Performance:






Software Developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Is Protocol-Oriented Programming in TypeScript Possible?

Coding setup

How to manage your notifications in Angular NGRX inside Effects as a side Actions

How to Build Your First Node Server

what is Javascript

Creating a Force Graph using React and d3

Working with Redux Store

JS and DataStructures Recursion

Automatically get typings from Prisma on KeystoneJS 6

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ahmed Ibrahim

Ahmed Ibrahim

Software Developer

More from Medium

Do you perform reviews?

Communication Best Practices — Giving and Receiving Feedback

Building a Modern Monolithic App

SOLID Principles for Better Development