Domain Driven Design; Can ValueObject contains invariants or specifications?

gervais.b

I'm starting to play with Domain Driven Design and have a question about ValueObjects :

Can they contains invariants or other specifications ?

Consider an immutable ValueObject :

ValueObject (

  prop integer: Int
  prop string: String

  // Value and copy constructor

  // Observers for integer and string

  // Equality methods on integer and string value

)

Can I add some invariants such that integer > 0 & < 42. Or do they have to be simple transfer without any logic ?

I hope they can but need a confirmation.

MikeSW

A value object (VO) encapsulates a value and its business requirements . This is its purpose: to model a business concept (with its constraints) which happens to be a simple (not always single) value.

A VO is not a Data transfer object (DTO) precisely because it defines a business concept that is valid only in the containing bounded context, while a DTO is meant to cross boundaries.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Domain Driven Design: Can Infrastructure or Repositories use Domain objects?

From Dev

Domain Driven Design: Can Infrastructure or Repositories use Domain objects?

From Dev

Layers in Domain Driven Design

From Dev

Domain Driven Design - Domain or Security

From Dev

DDD (Domain Driven Design) Can I use inheritance ?

From Dev

Domain driven design can value objects reference / embed an entity

From Dev

Access Control in Domain Driven Design

From Dev

Domain Driven Design and batch processing

From Dev

Implementing Domain Driven Design Cost

From Dev

Implementing Domain Driven Design Cost

From Dev

Domain Driven Design Bounded Context Domain Objects

From Dev

Domain Driven Design: infrastructure concern or domain concern?

From Dev

Domain Driven Design: infrastructure concern or domain concern?

From Dev

Domain Driven Design. Entity type design

From Dev

Implementing Paging and Sorting with Domain Driven Design

From Dev

Implementing Domain-Driven Design and Transactions

From Dev

Domain driven design repository implementation in infrastructure layer

From Dev

Domain Driven Design in Node.js Application

From Dev

Fetching associated aggregates in Domain driven Design

From Dev

Domain Driven Design - CQRS + ES usage

From Dev

Where is the call to persistence in the domain driven design

From Dev

Implementing Domain Driven Design Book Confusion

From Dev

Domain Driven Design (DDD) and database generated reports

From Dev

Domain-Driven-Design Entities and Value Objects

From Dev

Proper way to get aggregates in Domain Driven Design

From Dev

Domain Driven Design Auto Incremented Entity Key

From Dev

Fetching associated aggregates in Domain driven Design

From Dev

Where to find Domain Driven Design consultants?

From Dev

How to add scheduled jobs in domain driven design

Related Related

  1. 1

    Domain Driven Design: Can Infrastructure or Repositories use Domain objects?

  2. 2

    Domain Driven Design: Can Infrastructure or Repositories use Domain objects?

  3. 3

    Layers in Domain Driven Design

  4. 4

    Domain Driven Design - Domain or Security

  5. 5

    DDD (Domain Driven Design) Can I use inheritance ?

  6. 6

    Domain driven design can value objects reference / embed an entity

  7. 7

    Access Control in Domain Driven Design

  8. 8

    Domain Driven Design and batch processing

  9. 9

    Implementing Domain Driven Design Cost

  10. 10

    Implementing Domain Driven Design Cost

  11. 11

    Domain Driven Design Bounded Context Domain Objects

  12. 12

    Domain Driven Design: infrastructure concern or domain concern?

  13. 13

    Domain Driven Design: infrastructure concern or domain concern?

  14. 14

    Domain Driven Design. Entity type design

  15. 15

    Implementing Paging and Sorting with Domain Driven Design

  16. 16

    Implementing Domain-Driven Design and Transactions

  17. 17

    Domain driven design repository implementation in infrastructure layer

  18. 18

    Domain Driven Design in Node.js Application

  19. 19

    Fetching associated aggregates in Domain driven Design

  20. 20

    Domain Driven Design - CQRS + ES usage

  21. 21

    Where is the call to persistence in the domain driven design

  22. 22

    Implementing Domain Driven Design Book Confusion

  23. 23

    Domain Driven Design (DDD) and database generated reports

  24. 24

    Domain-Driven-Design Entities and Value Objects

  25. 25

    Proper way to get aggregates in Domain Driven Design

  26. 26

    Domain Driven Design Auto Incremented Entity Key

  27. 27

    Fetching associated aggregates in Domain driven Design

  28. 28

    Where to find Domain Driven Design consultants?

  29. 29

    How to add scheduled jobs in domain driven design

HotTag

Archive