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
Asked
Active
Viewed 986 times
1
-
Your defining flaw of the anemic domain model is not right. The automagical aspect is secondary. The issue with the ADM is that it has no business logic, ie no methods, which an active record class could be guilty of, but it isn't an implicit part of the pattern's definition. An active record could have methods that process the data beyond database storage and retrieval. – Anthony Mar 14 '14 at 12:06
1 Answers
3
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.

dkatzel
- 31,188
- 3
- 63
- 67