Home

Awesome

NoBodyToBuild

Imagine a team of gasp body builders that has to appoint a team member as the new chairman. The rules are:

SampleA1/A2/B1/B2 demonstrate appointing a member as the chairman using an application service that orchestrates the collaboration of a Team object and a TeamMember object.

SampleC/E demonstrate the use of application and domain service, but this time putting the rule in the domain service and indirectly exposing more state on the Team/TeamMember object.

SampleD recognizes the temporal nature of the chairmanship and turns it into an explicit concept, using the collaboration of a Team object and a TeamMember object as factory.

At no point is state exposed. The choice boils down to Query methods (CQS style), Double Dispatch methods (Tell Don't Ask style), or Guard methods.

The questions are, regardless of this example being absurdly trivial,

Feel free to fork, add your own preferred approach, play domain expert and tweak where you see fit.

P.S. Yes, I didn't write tests. Yes, those would have given valuable feedback as well. This is exploration without tests.