Last active
August 29, 2015 14:04
-
-
Save janx/d8dc98870373d06c9e8d to your computer and use it in GitHub Desktop.
Description of ActiveRecord pattern from <Patterns of Enterprise Application Architecture>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In simple applications the Domain Model (116) is an uncomplicated structure that actually corresponds pretty | |
closely to the database structure, with one domain class per database table. Such domain objects often have | |
only moderately complex business logic. In this case it makes sense to have each domain object be | |
responsible for loading and saving from the database, which is Active Record (160) (see Figure 3.3). Another | |
way to think of the Active Record (160) is that you start with a Row Data Gateway (152) and then add domain | |
logic to the class, particularly when you see repetitive code in multiple Transaction Scripts (110). | |
... | |
As the domain logic gets more complicated and you begin moving toward a rich Domain Model (116), the simple | |
approach of an Active Record (160) starts to break down. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment