> -----Original Message-----
> From: Nathan Nobbe [mailto:quickshif...@gmail.com]
> Sent: Thursday, June 16, 2011 5:39 PM
> To: Daevid Vincent
> Cc: php-general@lists.php.net
> Subject: RE: [PHP] Doctrine madness!
> On Jun 16, 2011 5:31 PM, "Daevid Vincent" <dae...@daevid.com> wrote:
> >
> >
> >
> > > -----Original Message-----
> > > From: Eric Butera [mailto:eric.but...@gmail.com]
> > > Sent: Thursday, June 16, 2011 2:58 PM
> > > To: Daevid Vincent
> > > Cc: php-general@lists.php.net
> > > Subject: Re: [PHP] Doctrine madness!
> > >
> > > On Thu, Jun 16, 2011 at 5:37 PM, Daevid Vincent <dae...@daevid.com>
> wrote:
> > > >> -----Original Message-----
> > > >> From: Nathan Nobbe [mailto:quickshif...@gmail.com]
> > > >> Sent: Thursday, June 16, 2011 9:51 AM
> > > >> To: php-general@lists.php.net
> > > >> Subject: [PHP] Doctrine madness!
> > > >>
> > > >> Hi gang,
> > > >>
> > > >> If anyone out there has some experience w/ Doctrine now would be a
> great
> > > >> time to share it!
> > > >
> > > > Yeah, I've used Doctrine as part of Symfony. Both suck balls and are a
> > > perfect example of why you should NEVER use frameworks. Lesson learned
> the
> > > hard way. Re-write with your own MySQL wrappers and for the love of God
> and
> > > all that is holy do NOT make it an ORM wrapper.
> > > >
> > > > KTHXBYE.
> > > >
> > >
> > > I do believe that was the most eloquent and enlightened email that has
> > > ever graced my inbox.  Thank you for taking the time to edify us with
> > > that pithy reply.
> >
> > Glad I could be of service. There was no point in elaborating more on
> either Doctrine or Symfony any further.
> You've been even less helpful than the broken community surrounding
> doctrine.  Thanks for your effort daevid, I know you tried hard ;)
> -nathan

You asked if anyone had experience with Doctrine and to share the experience. I 
did just that *wink*. I never claimed to have a solution to your Doctrine 
problem, other than the fact that Doctrine is in itself the problem. You are in 
a recursive loop. :) Think of me as the "return;". You're welcome. 

In all my 25+ years of coding experience with any language and especially PHP, 
I've learned the hard way that the one-size-fits-all approach of a generic 
framework and the bloat of an ORM just doesn't work. It looks wonderful, trust 
me, I've fallen prey to its sultry gaze myself. Hell, I've even written tools 
that started to look like ORMs and Frameworks, and then there comes a point 
when you realize their cost is too high. You're better off (IMHO) making some 
very efficient wrapper functions for sql_query(), sql_save() [does 
insert/update intelligently], sql_delete(), etc. and not get all fancy with 
making a SQL class/object and all that crap either.

OOP is great for many things, but it's not the answer to everything and 
developers need to know when to use the right tool for the job. It has also 
been my experience that a SQL wrapper is best as a procedural system since it's 
called so frequently and often. Doing some silly:

$con = new DBConnection();
$con->query('select * from foo');
$myresults = $con->getResults();

Or whatever is a waste.

$myresults = sql_query('select * from foo');

Is far more efficient and easier to read.
Let the function open a connection, and do all the work.

The ORM dealios complicate things, as now you have some stupid YAML file to 
maintain, and you have to make objects that relate to other objects (1:M, M:M, 
etc.) and after a while, you start to think, "shit, I could have done this with 
like 3 SQL statements". The ORM's fatal flaw is it's one-size-fits-all Achilles 

Example: We used to have this crontab job that would update news stories from 
RSS feeds we harvested around the web. It was taking HOURS to complete. Mostly 
because for each story, we had to create a new Doctrine object thingy and all 
the related table objects and then update the instance object, then ->save() or 
whatever. Do that over a hundred-thousand objects and stuff starts to slow 
down. We converted it to use straight SQL calls and it ran in under 10 minutes. 
YES. From HOURS to minutes. An order of magnitude faster.

Just trying to save you (and anyone else) the time and trouble. I don’t dislike 
ORM and frameworks because I have some axe to grind, like I used to write a 
framework and it cheated on me and so I'm all jaded... No. I dislike them from 
experience over years of practical real-world implementations. I have tried 
them. I *WANT* to like them, I really do. I was very excited when Zend 
Framework came out... and then... I used it, and realized it was like the 
others. Bloat. Slow. Confusing. Cumbersome.

The last thing I'll leave you with is that, when you start to rely upon one of 
these ORM/PHP frameworks, you're not only stuck with it -- warts and all -- but 
you have to TRAIN other people to use it as well! If you find a bug, you either 
have to maintain it forever in your own branch, or hope the developers of the 
framework fix it. When you hire new people, you always have to add some caveat 
to the job request, "Zend Framework, Doctrine, Symfony, CakePHP, experience a 
plus". It's hard enough to find _good_ PHP developers, let alone ones that are 
in niche like that.

(BTW, my company is privately held, 14yrs old, makes $200MM/yr profit, is like 
the .com startup days as far as perks, fully benefits & matching 401k, has 
profit sharing every quarter and is hiring if anyone is interested. :) 


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to