Active Records

Welcome Ramadhan! I’m sorry if I ever hurt your feeling, anybody?

Anyway, Active Records. Apa sebenarnya active record dalam dunia web? Kebanyakan dari kita mungkin mengetahuinya dari Codeigniter. Tapi saya sendiri tahu ini pertama kali dari Doctrine. Object Relational Model. Tapi rupanya istilah active record pada framework PHP Codeigniter justru bukan yang dimaksud dengan active record yang sesungguhnya. Well, wiki bilang gini :

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.[1] 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 implementsaccessormethods or properties for each column in the table or view.

Beberapa pattern active record terdapat pada beberapa language/script berikut :

  • Some PHP framework : Kohana, CakePHP, Yii, dll (nggak termasuk CI)
  • Microsoft .NET
  • library ORMnya Ruby, yang dipakai juga di frameworknya : Rails
  • Java with its ODBC nya

The framework CodeIgniter has a query builder it calls “ActiveRecord”, but which doesn’t implement the Active Record pattern. Instead it implements what the user guide refers to as a modified version of the pattern. The Active Record functionality in CodeIgniter can be achieved by using either CodeIgniter DataMapper library or CodeIgniter Gas ORM library.

So, jangan bilang pernah memakai active record kalau kalian cuma pernah pakai codeigniter.

Kucing nggak puasa



Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:


You are commenting using your account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )


Connecting to %s