Giter Site home page Giter Site logo

Comments (2)

VaughnVernon avatar VaughnVernon commented on June 28, 2024 1

Sure we can do that, but that's not composition. I don't mind using a set of static methods for this, yet the static methods in a helper class is not composition. In some ways inheritance is cleaner because it says that "I as an entity" or "I as a value object am concerned with asserting parameters to me an my state." It makes the statement that I as the object care about this. Still, I don't mind it myself if there is a good reason to make AssertionConcern a set of static method.

Since "Composition Over Inheritance" is not applicable in your suggestion, what is your good reason?

from iddd_samples_net.

Frikki avatar Frikki commented on June 28, 2024

I think that the static methods in a helper class approach solves a problem of multiple inheritance. For example, entities could be subclasses of a self-validator base class, but that would prevent them from also being subclasses of the AssertionConcern class, unless either would be a subclass of the other. However, you could quickly end up building classes with too much functionality.

What about injecting the AssertionConcern class into the entities?

from iddd_samples_net.

Related Issues (8)

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.