Have you refactored from an ActiveRecord to a DataMapper pattern? What conditions prompted the switch? I’m primarily interested in web based applications, but would like to know the challenges that accompany such a move in any environment.
Have you refactored from an ActiveRecord to a DataMapper pattern? What conditions prompted the
Share
I really do like the ActiveRecord pattern for its simplicity. However, I have been moving away from it for larger web apps. I find that as an ActiveRecord based project becomes more complex the ActiveRecord objects become large and laden with too much code.
By introducing a Repository pattern (essentially a Data Mapper) the domain model classes become simpler and the data mapping / data access logic is kept separate.
Also, it is quite difficult (impossible?) to mock ActiveRecord objects because of their user of static methods.