Legitimate Uses of the Antipattern
There’s nothing wrong with the Active Record design pattern per se. It’s a convenient pattern for simple CRUD operations. In most applications, you have some cases where you need only a simple data access object for simple operations on individual rows of a table. You can simplify these cases by defining the model as coincident with its DAO.
Another good use of Active Record is for prototyping code. When writing code quickly is more important than writing code that’s testable and maintainable, shortcuts are important. Showing a working prototype early and often is a great way to refine the project with active feedback. Anything you can do to speed up development of the prototype is helpful in these circumstances, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access