Hi Chad, See below:
On Sun, Aug 15, 2010 at 2:42 PM, Chad Sollis <[email protected]> wrote: > hey all, > > Matt's post a few days ago has me thinking, as I have looked at various ORM > projects for PHP. It seems like the few always referenced are Doctrine, > Propel, and Redbean, (and I'm sure matt's NORM will be there soon ;). > > However, i know there is a time and place for various technologies, as I have > begun to dive into learning Doctrine, it seems intensely over complicated, > and has significant performance problems (from a handful of websites I've > found). > > Would someone (or many of you) help me understand where the benefits are in > the added development time and learning, that cant be obtained by decent DB > abstraction. > > I get the DB agnostic angle... looking for additional prospectives and > insights... > > Many Thanks. > > ~Chad I tend to agree with Lonnie and a lot of his points. For me the main reason for using an ORM is not the abstraction part which I can get that with any decent data layer. The most important thing for me is that having an ORM helps to create a domain model and to move to more of an OOP way of solving problems. As an example, you can more easily write code like this: foreach ($client->getProcessors() as $proc) { $proc->checkUser( $newMessage->getUser() ); } The point of that contrived example is that when you have objects for each of your entities in a domain, you can create relationships and methods on those classes that better convey the *intent* of what you are doing. That's a benefit of *domain model*, which is easier to achieve when you have an ORM. You also tend to end up with methods that are useful in other places and that are easier to unit test. When (and only if) you run into performance problems and *only after you've identified where the problem is using a profiler*, you can easily replace the contents of methods to be more efficient (maybe raw sql if necessary). That way you're not doing misguided premature optimization that is costly in readability and often done in the wrong place. http://martinfowler.com/eaaCatalog/domainModel.html By the way I also created an ORM (i guess is a right-of-passage of sorts): http://www.outlet-orm.org/ Alvaro _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
