lundi 23 mai 2016

non anemic code leads to vanishing control classes

I have spent a lot of time lately reading about good OO design practice including topics like (avoiding the) AnemicDomainModel. The implication is that classes should be living, intelligent things that can manage their own state and behavior. I am also a fan of Adam Bein , after watching his videos that advocate the ECB design pattern I concluded this would be a good fit for the application I am writing. The problem I am facing is that if I design my entity beans in such a way that they have rich behavior it becomes very hard to figure out what part the control classes should play since most of the function is in the entity class. The business logic becomes almost simple enough to consider placing in the boundary "service" class, however this violates a fundamental principle of ECB that Entities should not communicate with the boundary. I have been advised that I am "over thinking" this and having Managers and Controllers is not such a bad thing after all. Has anyone successfully combined ECB with non-anemic code and if so what advice can you offer?

Aucun commentaire:

Enregistrer un commentaire