CodeIgniter Forums
DRM vs Active Records - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: DRM vs Active Records (/thread-38782.html)



DRM vs Active Records - El Forum - 02-18-2011

[eluser]Unknown[/eluser]
Hello, I have a fully functional application in Codeigniter. I am using Active Records. Should I move to DataMapper? What will be the difference? I am interested in speed mostly, would it be any change there?
Thanks


DRM vs Active Records - El Forum - 02-18-2011

[eluser]WanWizard[/eluser]
There's no do's or don'ts. You can not compare the two.

In the case of AR, you hand-craft your models, create your model methods, and in them access the database using CI's AR command set.
In the case of an ORM, you one have to hand-craft your custom methods, all generic methods to interact with the database are provided by the ORM.

Given the fact that most database interaction is pretty standard, it's my experience that using an ORM allows for much faster development, especially for bigger applications. But YMMV...

In terms of speed, every abstraction layer added will cost you some performance. Direct calls is fasted, then CI queries, then CI AR, then an ORM. You have to balance the cost of hardware (in case you would need a more powerful server) against the savings in development and maintenance of an application during it's livecycle.