Comments (3)
Je viens de le constater aussi
quelqu'un a un éclaircissement à propos ?
@6eoffre7
t'as pu ?
from apip-ddd.
Salut @TheProgrammer92
Je viens de voir un de leur commentaire sur une de leur vidéos :
https://www.youtube.com/watch?v=SSQal3Msi9g&lc=UgxOmrohSSrZYisbr1l4AaABAg.9himfzO116a9hm4UcmVBb0
Peut être une piste => https://matthiasnoback.nl/2022/04/ddd-entities-and-orm-entities/
from apip-ddd.
Bonjour,
Merci pour le feedback, savoir que ce partage soit utile à d'autres est très appréciable.
Par contre je ne comprends pas pourquoi vous avez mis Doctrine dans le Domaine, alors que dans la conférence vous dite qu'il ne faut pas faire ça.
Comme indiqué dans le commentaire youtube, il s'agit effectivement d'un compromis principalement basé sur le critère suivant :
Point de vue purement technique, cette dépendance implique un couplage très faible.
Les Attributs utilisés étant purement déclaratifs, ils ne changent en rien le fonctionnement du code de l'entité en elle même. L'entité reste donc parfaitement utilisable même si Doctrine n'est pas installé.
Aussi Le domaine ici est relativement simple, surtout parce que c'est un projet de démonstration. Si celui ci était voué à se complexifier, le bénéfice apporté par la définition du mapping au niveau de l'entité en elle même serait moins important.
Le principal risque que présente cette pratique est que mettre la notion de persistence directement au niveau de l'entité peut impliquer que sa modélisation se retrouve orientée par la structure de données qui lui est liée, faisant passer au second plan l'intention métier.
Plus l'ORM est proche du domaine, plus il y a de chances d'avoir facilité à le modéliser en fonction des contraintes de l'ORM, avec pour conséquence de dénaturer celui ci de sorte à ce qu'il ne reflette plus le besoin métier auquel il répond.
C'est donc une décision à prendre consciencieusement, et à remettre en question autant que nécessaire au fur et à mesure que le système évolue.
En espérant avoir répondu à votre question.
(for non-french readers 🙂 )
Hey,
Thanks for the feedback, happy to know that our work is useful to others!
I don't understand why you put Doctrine in the Domain, when the conference tells you that you shouldn't do that.
As explained on youtube, this is indeed a tradeoff we made. The reasoning is that, from a purely technical point of view, this practice does not imply any strong coupling.
Attributes being purely declarative, it doesn't impact the model as the entity remains usable even if Doctrine is not installed.
Also here the domain is relatively simple, especially because it is a demo project.
If it were likely to become more complex, the benefit brought by putting the mapping on the entity itself would be way less significant.
The main risk with this approach is that putting the persistence concept at the entity level may make its modeling driven by the data structure linked to it, putting the business intention apart.
The closer the ORM is to the domain, the more are the chances to model according to the technical constraints of the ORM, with the consequence of distorting it so that it no longer reflects the business need it aims solve.
Therefore, whether to go that way or not should be decided consciously and challenged as the system evolves.
Hope it's more clear :)
Cheers!
from apip-ddd.
Related Issues (17)
- Update documentation to fit with the new architecture
- Upgrade to the last version of APIP 2.7.0-alpha.2 HOT 5
- Questions on best practice example HOT 3
- Cannot initialize readonly property AggregateRootId:: :$value from scope BookId HOT 7
- Best practices to work with relations in Api Platform 3 and DDD HOT 7
- Error during parsing: unrecognized protocol option 'experimental_http3' HOT 2
- Typo in shared services definition for kernel path HOT 2
- Add some tests
- Repository pattern HOT 8
- Stuck make install HOT 2
- Collection operations not ACID complient HOT 2
- Doctrine and Vendor in the Domain? HOT 1
- Wrong count with DoctrineRepository HOT 1
- MIT license in composer.json instead of proprietary HOT 1
- Add async commands HOT 2
- Question about hydra context HOT 1
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 apip-ddd.