ketan-gote / ddd-example

Domain Driven Design. Examples focuses on key concept of ddd like Entities, Aggregate root, Repository, Value Objects & ACL.
104 stars 35 forks source link
acl aggregate-root ddd-example ddd-patterns domain-driven-design entities repository value-object

Domain Driven Design

DDD example focus on Core concept of DDD like

DDD

Entities

Entities are objects in the domain model that have a unique identity that does not change throughout the state changes of the software. Entities encapsulate both state and behavior. An example of entity could be a Order object that represents and maintains state about a specific order, and implements different operations (add items, add shipping address, add payment details etc) that can be carried out on that order.

Aggregates

A cluster of associated objects that are treated as a unit for the purpose of data changes. External references are restricted to one member of the AGGREGATE, designated as the root. A set of consistency rules applies within the AGGREGATE’S boundaries.

Repository

Repositories are responsible for retrieving and storing aggregate roots, typically using an Object/Relational Mapping (O/RM) framework.

Value objects

Value objects are objects in the domain model that are used to describe certain aspects of a domain. They do not have a unique identity and are immutable. An example of value object could be a Order Monetory Value.

Properties of value objects:

ACL(Anti Corruption Layer)

Implement a façade or adapter layer between different subsystems that don't share the same semantics. This layer translates requests that one subsystem makes to the other subsystem. Use this pattern to ensure that an application's design is not limited by dependencies on outside subsystems.

Issues and considerations

Order Example focus on some of the key aspects of DDD such as. Aggregate, Entities, Value Object, Repository

License

Licensed under the Apache 2.0 License.

Enjoy!