GithubHelp home page GithubHelp logo

jeket / ddd-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ketan-gote/ddd-example

0.0 1.0 0.0 70 KB

Domain Driven Design. Examples focuses on key concept of ddd like Entities, Aggregate root, Repository, Value Objects & ACL.

Java 100.00%

ddd-example's Introduction

Domain Driven Design

DDD example focus on Core concept of DDD like

  • Entities
  • Aggregates
  • Repository
  • Value Objects
  • ACL(Anti Corruption Layer)

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:

  • Measures, quantity or describe the things in domain.
  • Identity is based on composition of values.
  • Immutable
  • Compared using all values
  • No Side affect

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

  • The anti-corruption layer may add latency to calls made between the two systems.
  • The anti-corruption layer adds an additional service that must be managed and maintained.
  • Consider how your anti-corruption layer will scale.
  • Consider whether you need more than one anti-corruption layer. You may want to decompose functionality into multiple services using different technologies or languages, or there may be other reasons to partition the anti-corruption layer.
  • Consider how the anti-corruption layer will be managed in relation with your other applications or services. How will it be integrated into your monitoring, release, and configuration processes?
  • Make sure transaction and data consistency are maintained and can be monitored.
  • Consider whether the anti-corruption layer needs to handle all communication between different subsystems, or just a subset of features.
  • If the anti-corruption layer is part of an application migration strategy, consider whether it will be permanent, or will be retired after all legacy functionality has been migrated.

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!

ddd-example's People

Contributors

ketan-gote avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.