In software engineering, the active record pattern is an architectural pattern found in software that stores its data in relational databases. It was named by Martin Fowler in his 2003 book Patterns of Enterprise Application Architecture. The interface of an object conforming to this pattern would include functions such as Insert, Update, and Delete, plus properties that correspond more or less directly to the columns in the underlying database table.
Active record is an approach to accessing data in a database. A database table or view is wrapped into a class. Thus, an object instance is tied to a single row in the table. After creation of an object, a new row is added to the table upon save. Any object loaded gets its information from the database. When an object is updated the corresponding row in the table is also updated. The wrapper class implements accessor methods or properties for each column in the table or view.
This pattern is commonly used by object persistence tools, and in object-relational mapping (ORM). Typically, foreign key relationships will be exposed as an object instance of the appropriate type via a property.
Read more about Active Record Pattern: Implementations
Famous quotes containing the words active, record and/or pattern:
“True contentment is a thing as active as agriculture. It is the power of getting out of any situation all that there is in it. It is arduous and it is rare.”
—Gilbert Keith Chesterton (18741936)
“Society is the stage on which manners are shown; novels are the literature. Novels are the journal or record of manners; and the new importance of these books derives from the fact, that the novelist begins to penetrate the surface, and treat this part of life more worthily.”
—Ralph Waldo Emerson (18031882)
“Put out the light, and then put out the light.
If I quench thee, thou flaming minister,
I can again thy former light restore
Should I repent me; but once put out thy light,
Thou cunningst pattern of excelling nature,
I know not where is that Promethean heat
That can thy light relume.”
—William Shakespeare (15641616)