Design Patterns · Senior · Question 29 of 75

What distinguishes a Value Object?

Explanation

Money(100, 'USD') equals another Money(100, 'USD'), and operations return new objects. Validation in one place rules out a "negative amount" throughout the code. In TS, branded types with factories are close to this.

Further reading

Problem with a question

Design Patterns · Senior · question 29

Test yourself

Take the Design Patterns · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz