Replies: 2 comments
-
Domain Type traitsHere we will go over all the traits, and as a didactic sample, we are going to build something with the trait we are reviewing and aggregate on each one of them If the trait in review modifies a class,. we will write the implementation again, with the differences 1.
|
Beta Was this translation helpful? Give feedback.
-
|
Hi, I'm glad that you are so engaged with the project, but I'm really not happy with the approach you are taking with this. I made it clear the first time you tried to commit a change the domain system that I wasn't sure that that was the correct approach. And I'm still not happy with what you're doing. Trying to force the situation by harvesting opinion rather than discussing with myself is not a good approach (as well as saying "we" like its something that is sanctioned by me, is really not a good look). Just to be clear the best way to get buy-in for any feature, is to discuss it with me first via this forum; not to bulldoze the process by constantly submitting PRs, closing them, reopening and closing them reopening them. Causing lots of email notifications for the users of this repo. The core idea of the domain system was to be a very light and a very specific set of interfaces for some very precise definitions. The direction you're taking it is not precise and it is too opinionated and this library is not about reflecting those opinions on others' domains. I am not even sure whether I'm going to keep the domain types in the final release as I think I explained to you before. So building on top of something that I'm not even sure is going to be in the final release is really not a good idea. So I'm going to be closing your PRS. I'm gonna be closing this thread. Because it's not for this repo. May I suggest that you create yourself a new nuget package and publish it yourself with all of the reasoning and documentation you like (please don't prefix the package with 'LanguageExt.' as I'm trying to get ownership of the prefix at the moment). If you send me the link, i'll add it to the wiki. I'm sorry if this seeks harsh, it'd be much less painful if you'd just started a discussion. So please consider that in the future. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
RFC: Domain Traits expansion in LanguageExt — DomainType, Factories, Rules, Units of Measure, and realistic samples
Hi everyone 👋
We are opening this discussion to gather feedback on a significant expansion of domain modelling support in LanguageExt. If you are affine to Domain Driven Design, you know the important that domain concepts have. They are ment to live as real types, with explicit invariants, always valid, etc.
Language-Ext already has a minimal set of domain traits. And I found them useful, but they can be better. Most of this work is product of using those existing domain traits. By segreggating interfaces and/or expanding them on the higher-kind world, this proposal introduces a richer vocabulary for expressing those concepts while staying within C# and LanguageExt.
General mental model
The core idea is to separate separate domain models in 3 pounts that are often mixed together.
1. What is this value?
This is answered by
DomainType<SELF>family of traits. They are representation of domain concepts, but as typed classes, structs or record. Examples:Each one represents a domain idea, not just a wrapper over a primitive.
2. How is a valid value created?
This is answered by
DomainFactory<SELF, TYPE, FROM>family of traits. They are the way that a primitive or another type is taken and mapped to a valid value,Factories construct values in a explicit, controlled and faillable way. through
Fin<T>and ```FinT<M, T>.3. What must be true for it to be valid?
This is answered by
Rule<SELF, TYPE>trait family. With rules you explicitly can create invariants, and even can create generalized invariants that you can reuse in different entities, aggregate roots or use cases in code.They are a way to create reusable and composable set of pre-conditions, instead of scattering logic around clases
Conceptual flow
The 3 points come together in this sample flow:
System boundaries can remain flexible, but once values enter the domain, the rest of the code can operate on meaningful validated values.
What is new?
To show the new traits, I'll add commets, so this isn't too big to start
Beta Was this translation helpful? Give feedback.
All reactions