GithubHelp home page GithubHelp logo

vranac / tactical-ddd-workshop-code Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeroenvdgulik/tactical-ddd-workshop-code

0.0 1.0 0.0 36 KB

Code base for the Tactical DDD workshop

License: MIT License

Smarty 0.15% Shell 6.86% PHP 92.99%

tactical-ddd-workshop-code's Introduction

Tactical DDD workshop

Getting started

You don't need much to run the code in this project: just PHP 7 and composer. This project comes with a set up for Vagrant using Ansible for provisioning, so if you don't want to or can't install these dependencies on your machine, just run:

vagrant up
vagrant ssh
cd /vagrant

Run the unit tests:

vendor/bin/phpunit

Or run the sandbox script:

php sandbox.php

Entities

  • Identity
    • User provided
    • Application generated
    • Persistence mechanism generated
    • Repository encapsulates identity generation
    • Surrogate identity
  • Mutability & individuality
  • Validation & consistency

Checklist

  • Does the object need to be retrieved from a repository by its unique identity?
  • Does the object need to track changes?
  • Are two instances equivalent if they have the same identity?

Value objects

  • Characteristics:

    • Descriptive
    • Immutable
    • Often composite, a conceptual whole
    • Replaceable
    • Comparable
    • Side-effect free behaviors
  • Is it irrelevant which exact instance of the object is used?

  • Can the object be replaced instead of modified?

  • Are two objects of the same type equal if their properties contain equal values?

Aggregates

  • Consistency boundary

  • Transactional consistency

  • Eventual consistency

    When examining the use case (or story), ask whether it's the job of the user executing the use case to make the data consistent.
    
  • Rules of thumb

    • Small aggregates
    • Reference aggregates by identity
    • Use eventual consistency
  • Implementation

    • Root entity with unique identity
    • Favor value object parts
    • Use Law of Demeter and Tell, Don't Ask
    • Optimistic concurrency
    • Avoid dependency injection

Repositories

  • Collection or persistence oriented
  • Persistence implementations
    • Unit of Work, changeset calculation
    • Event-sourcing
  • Reconstitution
  • Querying

Domain events

  • Immutable
  • Relation with commands
  • Authoritative
  • Sufficient data

tactical-ddd-workshop-code's People

Contributors

matthiasnoback avatar

Watchers

 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.