Active Record

Intent: An object that wraps a record data structure in an external resource, such as a row in a database table, and adds some domain logic to that object.

See RubyOnRails implementation: http://ar.rubyonrails.com/

See DotNet implementation: http://www.castleproject.org/activerecord/

See PhpLanguage: implementation http://nmariz.estadias.com/archives/31/


Often one uses a database browser, such as Toad, to create and test queries. It may even be a DBA. If one then has to take these and convert them into an OOP notation, one is both wasting time on translation, risking translating it wrong, and making it harder to do the reverse: put the query back into the DB browser to change and analyze it or convert it into a Stored Procedure. It's the Double Shuffle.

For new, clean databases, it may not make much difference, but for databases that have been around a while and have built up historical oddities, it can be important to work with them in a DB browser.

Maybe this belongs in ObjectRelationalMapping? -- JeremyAube?


See also DataMapper, TransactionScript, TableModule, DataDictionary, HelpersInsteadOfWrappers
CategoryPattern

EditText of this page (last edited March 10, 2013) or FindPage with title or text search