Git Product home page Git Product logo

calculation-example's People

Contributors

yvoyer avatar

Watchers

 avatar  avatar

calculation-example's Issues

DDD factory methods vs. CQRS handlers

Actually @yvoyer I don't understand this part enough yet.

In my example:
https://gist.github.com/yvoyer/a778ac744ddf10012864#file-dormercalculation-php
you suggested to use a factory method to add my a price - see lines 44 to 47.

ATM I have a similar scenario. A Customer ( <=> DormerCalculation) has an Order ( <=> DormerCalculationPrice).

In my first attempt the Handler created the Order. The constructor of the Order required the Customer.

After a while I thought about your example and read the "Factory method on aggregate root" chapter in the red book. In the example a Forum adds a Post / Discussion via factory method.
The advantage is too check if the forum wasn't already closed.

My problem is not so much deciding on which technique to choose. It's more about the terminology.

AFAIU "factory methods" are a Domain-Driven Design approach.
But using commands and handlers originally come from the CQRS approach.

Now does the CQRS appraoch recommend to move away the "factory methods" from the Domain Model and put the logic into the Handler - the way I tried in my first attempt?

Curious about your answer!

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.