Frage

based on this answer, I found that the same idea behind the anemic domain model is in active record! in active record pattern database fields are the same as domain properties (correct me if I'm wrong), so based on the answer I previously mentioned we have the same in anemic model (It's easy to generate automagically from database tables) , so what is the difference between these two approach? thanks

War es hilfreich?

Lösung

Here is the official one sentence definition of Active Record from Martin Fowler's Patterns of Enterprise Application Architecture:

"An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data." (emphasis mine)

Notice that last part of the definition that I bolded. Since Active Record should add additional domain logic to the class, it is not anemic.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top