Comments (2)
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iddd_samples_net.