DbFinderPlugin: The ORM isn't important anymore

Today I tried the DbFinderPlugin for the first time. I am truely impressed. Using this plugin, it is not necessary anymore to really care about which ORM you pick for your project. It's the thought behind symfony 1.1 taken into the symfony ORM-selection.

One of the most important changes in symfony 1.1 was the creation of the symfony platform, the core of symfony had it's classes completely refactored into a fully decoupled set of classes that could easily be picked or overruled when required. It meant total independence of those classes whenever you would choose to do that. An excellent path to go for symfony, as it gives more control to the developer.

With the ORM, that was not fully possible. You would still have to write your code ORM-specific. For Propel, you'd use the Criteria object to build your query, and for Doctrine, you'd use the (slightly more beautiful) chaining of methods to build a query. But if you'd written code for one, you could not easily change to the other. Even moving from Propel 1.2 to Propel 1.3 would offer some challenges.

Enter the DbFinderPlugin, a plugin written by Francois Zaninotto. This seems to be the ultimate solution in writing code that is portable between the different ORM's. When used consistently throughout a project, switching to another ORM should be as simple as installing and configuring the new ORM plugin, configuring your databases.yml, and that's it. DbFinderPlugin will take care of the rest.

I see two very important advantages for the usage of this plugin:

  • Plugin development - Using DbFinderPlugin, it's now very easy to write plugins that don't care about the ORM you are using. The community will benefit a lot from this, as all plugin authors that use this plugin will now write plugins that are compatible with all ORMs. And the plugin authors will benefit a lot from this as well, since it will make their life a lot easier in writing plugins for all ORMs
  • Project development - You don't really need to think about which ORM you need to use up front. You just start with the default Propel with DbFinderPlugin. Then, as the project advances, you can decide what you prefer: Propel or Doctrine. Or you make a choice at the start of your project, but halfway a technical requirement makes you reconsider that choice: switching should now be very easy. No need to rewrite all your queries anymore.
The only possible downside at this point is that Doctrine is not fully supported yet. Propel 1.2 and Propel 1.3 are fully supported already though, so at least switching to the speed and efficiency of Propel 1.3 is already possible. As Doctrine-support is completed, I see a bright future for this plugin and symfony development in general.
Add comment

Comments

gravatar Anonymous: So you are telling me to use a wrapper over a wrapper? Come on be serious a bit, doctrine and propel are very different from one another however both have considerable speed impact. How fast or how much slower do your code runs with that extra DbFinder? Do you have benchmarks available by any chance?
August 13, 2008
gravatar yoda: So you are telling me to use a wrapper (db finder) over wrapper (orm) over wrapper (db abstraction). Hack no! Whats wrong with mysql_query?
August 14, 2008
gravatar left: Yes, I am saying you should use a wrapper around a wrapper around a wrapper. Why? Well:

- maintainability: The DbFinder code is very easy to maintain. New developers will have a very easy time getting into this code.
- portability: It is very easy to switch from one ORM to the other when using DbFinder. Just a matter of configuration.
- extendability: If DbFinder is doing things slightly different from how you want it, just extend it to do what you want.

I don't have benchmarks about this, but really, the focus on optimizing such stuff is negated by the strong caching system that symfony has. If you cache well, the actual queries don't need to be run on every request.

And what is wrong with mysql_query() you ask? Well, for one, by hardcoding the usage of that, you're locking yourself into using mysql. even switching from mysql to mysqli would take quite an amount of time, because you have to go through the code to change the function calls everywhere. With an ORM it is a matter of configuration. 2 seconds are needed to switch your application from using one type of database to the other.
August 14, 2008
gravatar Raphael: Many thanks, left, and I completely agree to your arguments.
With respect to optimisation of performance, my personal experience on developing complex IT applications is that first one needs to cope with the functionality, and then one has the overview to check at which spots optimisation makes sense, or provides the most performance increase in relation to the effort needed for that. But I think optimisation is a separate topic on it's own.
Regarding the idea of becoming completely independent from ORMs and their versions, there remains the schema.yml issue. Doctrine and Propel have individual syntaxes, or am I wrong (working only with Propel yet)?
Cheers R.

August 14, 2008
gravatar Evert: I got an alternative for the class, and called it DbPluginFinder.

Since I heard of this plugin, I realized it was a good idea to write a wrapper around these two to provide some compatibility.

Henceforth the way to go is DbPluginFinderFinder, a wrapper around a wrapper around a wrapper. :evil:

Whatever happened to getting the job done :)

Sorry for my sarcasm, but I think this closes in on utter non-sense. I personally haven't been in a situation where I needed to switch the RDBMS at all, and when you get to a scalability point where you might need to, your worries are bigger than re-writing a couple of queries.

Then there's the situation where you'd want to distribute an app and have it run on different setups. Valid situation. But if you get to a point where you cannot even dictate the ORM thats going to be used..

Well we're still talking PHP (keep it simple!!)
August 14, 2008
gravatar master's writing: Good job done about the post, thank you!

May 5, 2011
gravatar craigslist omaha: i agree with you ORM is not important now but this plugin is useful and working.i like your post you do good effort to make it more valuable.
thanks for sharing.
July 7, 2011
gravatar online dating: Your website is great. When is the next post comming on this topic.I'm happy I found this blog, hope you can come to exchange my website I am a novice!
October 14, 2011
gravatar sarasota spray foam insulation: THe plugin is so amazing to use. You cannot go wrong with using this. The options are endless for this.
October 28, 2011
gravatar molecular imaging: You cannot go wrong with this plugin at all. The creators have done such a great job with it. I see so many people using this. It is such a must have.
October 29, 2011
gravatar custom papers: Great ideas discussed here. Thanks a lot.
December 5, 2011
gravatar lvdesbe: i agree with you ORM is not important now but this plugin is useful and working.i like your post you do good effort to make it more valuable.
thanks for sharing.

December 23, 2011
gravatar Medical Colleges in Punjab: Interesting topic what you have shared with us. Your writing skill is really very appreciative. I love when you share your views through the best articles.Keep sharing and posting articles like these.This article has helped me a lot.Keep posting this stuff.

January 19, 2012
gravatar modern bedroom furniture:
Hi buddy, your blog's design is simple and clean and i like it. Your blog posts are superb.Please keep them coming. Greets!!!
January 26, 2012
gravatar coach outlet online: If you buy Coach items at the
coach outlet online

store, the goods will be sent out within 24 hours after confirming your payment and arrive to your door within 7 work days.No one can deny the shopping at the
coach factory outlet

is satisfactory. For the low prices and good quality.
January 29, 2012
gravatar coach outlet: coach outlet

handbags You can not just save your cash but also your time inside a convenient way to obtain the exact same bags product and do not be concerned the shippment of one's products.The
coach outlet store online

are utilized for formal event in company area that will display your excellent taste.Not only does a briefcase make is easier to carry things.
January 29, 2012
gravatar Brisbane Airport Accommodation: Great job talking about the topic of ORM. Will look forward to more of your posts. I rarely come across truly dedicated blog writers such as you. Keep up the good work.

January 30, 2012
gravatar Upholstery Cleaning Brisbane: It is so useful to me about the topic of ORM. Thanks for sharing. I will see next time,looking for your next article..

January 30, 2012
gravatar Driving lessons Ryde: I have read your blog but I have no any knowledge about ORM. So please tell me about it.
January 31, 2012
gravatar Plastic Manufacturers: This is the best information I have learned about DbFinderPlugin. I will visit this website for future updates.
January 31, 2012
gravatar Work Platform: Great resources Guy! Thanks for the information and additional resources in your blog about ORM.
January 31, 2012
gravatar discount uggs boots: I am typically to running a blog and i really respect your content. The article has really peaks my interest. :(
February 1, 2012
gravatar Acupuncture Brisbane: Some of your details on ORM is very in-depth and have helped me understand it very well.

February 1, 2012
gravatar Christchurch property management: This is such an excellent article about ORM. I will reference this page on my blog.

February 1, 2012
gravatar michael kors outlet: Good luck to the Author! all the best.

February 2, 2012
gravatar Awnings Brisbane: What is the full form of ORM?
February 3, 2012
gravatar IT Support Farmworth: These kind of post are always inspiring and I prefer to read quality content so I happy to find many good point here in the post
February 3, 2012

Php5_zce_logo

Upcoming events

I will be speaking 06-02-2012: D-Day
I will be speaking 17-02-2012: Techademy Trainingday February
I will be speaking 23-02-2012: Zend Webinar: Git for Subversion Users

Tags

1337 2008 2010 2011 4developers access modifiers accessibility AdaLovelaceDay09 advent agavi agile alfred amsterdam apache api apple article articles atk atkMetaNode audioscrobbler automation azure backwards compatibility barcelona barcodes bash bbc bbq beatstad belgium best practices bittorrent blogging blogs boards of canada book books bughuntday bundle caching cake cal evans calendar career cat cerf certificate cfp clear cms cologne common sense communities community components conference conferences contest continuous integration contribute contribution crisis css custom d-day datetime DbFinderPlugin decorator decorators deployment devdays development directoryindex docblox doctrine documentation download dpc dpc09 dpc10 dpc11 DPC2008 dreamhost drupal dv7 eclipse ed editors efficiency enterprise errors event events expertise ezcomponents facebook finland flickr fork framework frameworks freelance freeze frontend fun game games geoip germany getting real git github gnome-do google google calendar googletalk graceful degradation hack hackers hidden gem hiphop howto hp HR html http i386 ibuildings icann ide ideasofmarch idm imovie indy ingewikkeld integration international php conference internet interview ipad IPC ipc ipc08 ipc10 ipc11se iterm2 javascript jenkins jenkins-php job job openings jobeet john peel joomla joomladays kiva kubuntu launcher launchy left on the web libraries library lighttpd lime linktuesday linux live london loudblog m2ts mac magazines malware mambo marjolein mediterra meeting meme meta methodology micro-financing microframework microsoft migration movie music mysql namespace namespaces netbeans netherlands newsfire nllgg nos odmarco open source opinion ORM osx paradiso paris partnership pavilion pear pecl performance personal pfc10 pfc11 pfcongres pfcongrez pfz photo php php5.3 phpabstract phpazure phpBB phpbb phpbelgium phpbenelux phpbnl10 phpday phpdoc phpdocumentor phpgg phpitalia phpnw phpnw08 phpnw11 phpstorm phptek phptek09 phpuk2009 phpUnderControl phpunit php|architect php|tek podcast politics portability postcrossing presentation presentations private projects protected prototype PSR-0 public python qa qr codes re2c recruiting refactoring review rewrite ruby on rails san francisco schedule scifi script security sensio seven things sfdaycgn sflive2011 shell scripting silex simplexml slides smfony software sogeti solar sound speakers spl ssh standard standards star trek static steer strings stylesheets subversion symfony symfony live Symfony2 symfonycamp symfonyday symfonylive symfonyUnderControlPlugin talk talks techademy technology techportal tek09 telecommuting terratec terrorism testfest testing textmate textpattern the right tool timeout tips tld todo tomas tools training twig uncon unet usability usergroup validation vhost video vim vinyl virus warp webinar weblogging webservices wiki windows winphp women wordpress work workshop world world of warcraft wpi writing wunderlist xml xpath xsd yara year youtube zc11 ZCE zemanta zend zend framework zend server zend studio zendcon Zend_Form zite
© 2004 - 2012 Stefan Koopmanschap + Powered by Symfony, photos powered by Flickr, links powered by Delicious, Shanghai smilies by Iconbuffet. Feeds: rss / atom. Left on the Web v4.4.0.1