0

I am using Domain-driven-design for a project and as I am modeling the Aggregates I came across a scenario where one of its attributes has restricted input of only certain types. I know I would code this as an enum but aggregrate modeling is supposed to be above the implementation details.

How do I represent what would be an enum in the aggregate model ? This is my approach so far :

enter image description here

is this the correct way to represent this?

john
  • 1,057
  • 1
  • 17
  • 28
  • 1
    Would [this](https://stackoverflow.com/questions/412944/uml-class-diagram-enum) not suffice? Perhaps I am misunderstanding what you are asking. A value object is not typically an enumeration although you could see it as such but then you could probably still use the `enumeration` stereotype. – Eben Roux Jun 18 '19 at 07:53
  • Enumeration is already group of value objects of the same type. Unless your colors will have more data / behavior than just name, you don't need complex value objects for them – Alex Buyny Jun 19 '19 at 01:51

1 Answers1

0

based on your class diagram you don't need an aggregate root. At least not yet. Without the Aggregate root, you'd have just an entity that's has a property color that's an enum.

If you feel like you need the aggregate root for whatever the reason, you would need to figure out where the UL places the enum property. Which entity (managed by the root) should own this value.

Louis
  • 1,194
  • 1
  • 10
  • 15