Active Record Pattern

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:

    If church prelates, past or present, had even an inkling of physiology they’d realise that what they term this inner ugliness creates and nourishes the hearing ear, the seeing eye, the active mind, and energetic body of man and woman, in the same way that dirt and dung at the roots give the plant its delicate leaves and the full-blown rose.
    Sean O’Casey (1884–1964)

    We are at war with the most dangerous enemy that has ever faced mankind in his long climb from the swamp to the stars, and it has been said if we lose that war, and in so doing lose this way of freedom of ours, history will record with the greatest astonishment that those who had the most to lose did the least to prevent its happening.
    Ronald Reagan (b. 1911)

    Why it was that upon this beautiful feminine tissue, sensitive as gossamer, and practically blank as snow as yet, there should have been traced such a coarse pattern as it was doomed to receive; why so often the coarse appropriates the finer thus, the wrong man the woman, the wrong women the man, many years of analytical philosophy have failed to explain to our sense of order.
    Thomas Hardy (1840–1928)