Content deleted Content added
Reverted 1 edit by 85.48.185.137 (talk): This person's blog is not a reliable source, removing per WP:UNDUE |
Adding better references Tag: Reverted |
||
Line 1:
In [[software engineering]], the '''active record pattern''' is considered an [[Architectural pattern (computer science)|architectural pattern]] by some people and as an [[anti-pattern]] by some others recently.<ref>[https://www.educative.io/courses/sql-antipatterns-database-programming/BnN0MrXV3DJ Antipattern: The Model Is an Active Record]</ref><ref>[https://softwareengineering.stackexchange.com/questions/119352/does-the-activerecord-pattern-follow-encourage-the-solid-design-principles Does the ActiveRecord pattern follow/encourage the SOLID design principles?]</ref><ref>[https://calpaterson.com/activerecord.html The troublesome "Active Record" pattern]</ref><ref>[https://www.yegor256.com/2016/07/26/active-record.html ActiveRecord Is Even Worse Than ORM]</ref> It is found in software that stores in-memory object data in [[relational database]]s. It was named by [[Martin Fowler (software engineer)|Martin Fowler]] in his 2003 book ''Patterns of Enterprise Application Architecture''.<ref>[https://martinfowler.com/eaaCatalog/activeRecord.html P of EAA Catalog - Active Record]</ref><ref>{{cite book |last=Fowler |first=Martin |title=Patterns of enterprise application architecture |publisher=Addison-Wesley |year=2003 |isbn=978-0-321-12742-6 |url=https://books.google.com/books?id=FyWZt5DdvFkC&q=active+record&pg=PT187 }}</ref> 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.
The active record pattern is an approach to accessing data in a [[database]]. A [[database table]] or [[View (database)|view]] is wrapped into a [[class (computer science)|class]]. Thus, an [[object (computer science)|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]] [[Method (computer programming)|methods]] or properties for each column in the table or view.
|