News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Russell Walker:
Active Record vs Data Mapper for Persistence
October 18, 2013 @ 10:19:13

Russell Walker has a new post today comparing two popular methods for abstracting out database access and working with your data - the Active Record and Data Mapper patterns for data persistence.

These two design patterns are explained in Martin Fowler's book 'Patterns of Enterprise Application Architecture', and represent ways of handling data persistence in object oriented programming.

He gives simple code examples of both - one showing a basic "save" call with Active Record and the other showing the saving of a "Foo" entity using similar logic. Along with these examples, he also includes a few points about the major advantages and disadvantages related to the pattern. He also talks some about "service objects", the go-between that the data mapper pattern uses to combine business logic and the mapper object. He ends the post by making some suggestions about which to use, depending on the need of course.

0 comments voice your opinion now!
activerecord datamapper persistence database interface designpattern

Link: http://russellscottwalker.blogspot.co.uk/2013/10/active-record-vs-data-mapper.html

blog comments powered by Disqus

Similar Posts

HowTo Forge: Installing The PHP-MSSQL Module On CentOS 5.0

Matthew Turland's Blog: Database Testing with PHPUnit and MySQL

Arnold Daniels' Blog: PHP != Ruby (and why PHP needs more advanced OO stuff)

Greg Beaver's Blog: Statistics are back up for pear.php.net

Job Posting: agámi Systems, Inc Seeks UI Engineer (Sunnyvale, CA)


Community Events











Don't see your event here?
Let us know!


hhvm install language application component framework unittest package release introduction composer code podcast opinion symfony2 overview hack threedevsandamaybe security facebook

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework