Coder Social home page Coder Social logo

Comments (3)

TheProgrammer92 avatar TheProgrammer92 commented on June 23, 2024

Je viens de le constater aussi
quelqu'un a un éclaircissement à propos ?
@6eoffre7
t'as pu ?

from apip-ddd.

6eoffre7 avatar 6eoffre7 commented on June 23, 2024

Salut @TheProgrammer92
Je viens de voir un de leur commentaire sur une de leur vidéos :
image
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.

chalasr avatar chalasr commented on June 23, 2024

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)

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.