2 ms·
Django's ORM still implements the active record pattern,just like this module. I really think it is an anti-pattern especially in domain driven design. Since i
by aikah 12y ago
Django's ORM still implements the active record pattern,just like this module.
I really think it is an anti-pattern especially in domain driven design. Since it basically couples domain models to a persistence library. The repository /model manager pattern is a better alternative as it doesn't care where objects come from and how they are created (used in Hibernate,EF,Doctrine,... ) ,and keeps the persistence layer and domain models totally decoupled.
Granted that it is way harder to implement it in javascript+async environment, since async operations are not implicit in JS,which breaks any possible encapsulation to begin with, but it's not impossible.
- goblin89 12y agoThanks for pointing out that active record is a generic pattern. I didn't know that (and judging by angular-restmod's README its author may not know it too). You say active record is anti-pattern, but can't it be combined with managers? For example, in Django, model's save() method eventually delegates to the manager and anything concerning actual DB happens down the line. Angular-restmod doesn't do that, though. I checked its code and it just uses $http directly.