Don't End Up With an Anemic Domain Model #shorts

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Anemic Domain Modal, because behavior can be abstracted with interfaces and has multiple implementations

sultonbekrakhimov
Автор

Definitely the Rich Domain Model.✅
I want my model to contain behavior so it’s not scattered across services.

fieryscorpion
Автор

I make the most of both worlds.
I keep the model clean, only properties.
Then I create another class that holds extention methods for the behaviour for the model

taherassaid
Автор

I guess that’s called Active Model design pattern.

roku_on_it
Автор

I go with anemic as it’s easier (for me) to keep my entities simple and allow them to work simply with EF Core, then add behaviour as access interfaces in front of the entities. I can see pros and cons to both approaches

justgame
Автор

I'd start with rich domain model. It could be a bit harder to start, but as a result you'll get more control and more pronounced boundaries between parts of the system by using aggregate roots. Also I think, potentially it will improve maintainability and could prevent you form creating excessive and unsafe relations between entities in future

vBqDmlwE
Автор

I know I'm late, but in our team we put behaviour where we need it. Every service/projects needs some value from an object? Put it in the class. Something is only needed by 2 services? Make it service specific.

E.g you could handle certain output stuff with extension methods and keep this logic to your "UI project". Why would your data access need access to that?

gimmedatcake
Автор

Hi, I am using the anemic domain model, because of the PATCH operation from the WebApi. How would you translate a PATCH operation to a rich domain model ?

HugoFlux
Автор

i got introduced to rich and now i am wondering why i was doing anemic all along

deadcat
Автор

Anemic mi je bolji jer ima razdvojenije odgovornosti, mada i rich je super za manje projekte kapiram.

milanpantelic
Автор

Anemic design model is considered an anti-pattern while working with a rich domain.

software_developer
Автор

Still cant understand using same model as domain model and efcore entity. I hate this shit and i will hate forever

ThingsTK