News for hackers. Stuff that matters.
Re:OrmHate by debacle on Tuesday June 26, 2012 @10:13AM (#4161859)
For the same reason PHP gets so much hate - both are tools with valid uses, but because they make hard things easier for people, that means that people who have no idea what they're doing can do very bad things.

Hating on a tool is ridiculous.

Re:OrmHate by zzzeek on Tuesday June 26, 2012 @10:22AM (#4161923)
The core of fowler's article is, "what is the alternative to ORMs?" - and the answer is there isn't much other than rolling your own.

This is not at all analogous to PHP where there is an abundance of alternatives to it's mediocre design. PHP isn't hated because of its concept - a "web-based scripting language". It's hated because it's done very poorly. Just like a lot of bad ORMs Fowler refers to.

Re:OrmHate by brazzy on Tuesday June 26, 2012 @10:39AM (#4162055)
Funny you should mention PHP. I suspect that a lot of the ORM hate comes from people forced to develop PHP and witnessing the epidemic of NIH syndrome among its web frameworks, every single one of which seems to come with its own half-assed ORM.
Re:OrmHate by debacle on Tuesday June 26, 2012 @10:27AM (#4161966)
There is nothing wrong with PHP - it runs multi-billion dollar companies and it is the most ubiquitous language on the web for a reason.
Re:OrmHate by hzy on Tuesday June 26, 2012 @10:35AM (#4162030)
Because it has near-zero barrier to entry. That doesn't speak highly of PHP as a language, just on how its deployment strategy is designed.
Re:OrmHate by debacle on Tuesday June 26, 2012 @10:37AM (#4162041)
I don't think Facebook or Yahoo chose PHP because it was easy to write.
Re:OrmHate by varikin on Tuesday June 26, 2012 @10:49AM (#4162117)
I think that is exactly why Mark Zuckerburg chose PHP when working on TheFaceBook back in 2003 and 2004. It was easy to write and deploy.
Re:OrmHate by Cloven on Tuesday June 26, 2012 @10:46AM (#4162098)
you are incorrect.
Re:OrmHate by debacle on Tuesday June 26, 2012 @11:04AM (#4162224)
Yahoo's rationale for choosing PHP:

"The short development cycles needed to stay ahead of the competition demand a web-centric scripting language that is easy to maintain and update."

http://public.yahoo.com/bfrance/radwin/talks/yahoo-phpcon200...

They didn't choose Python, or Ruby, or Java, because none of those languages are as expressive or shut-up-and-get-out-of-my-way as PHP. Just because a high schooler can write PHP doesn't mean it's a toy not also meant for world class engineers.

Re:OrmHate by Cloven on Tuesday June 26, 2012 @11:45AM (#4162487)
PHP is more expressive than python, ruby, or java. I see.
Re:OrmHate by wmil on Tuesday June 26, 2012 @11:29AM (#4162399)
It's success is largely due to it having the correct execution model. The request based execution environment makes iterative development quick and easy.

However there are plenty of bad ideas in the language itself.

Re:OrmHate by zzzeek on Tuesday June 26, 2012 @11:15AM (#4162295)
there's a lot wrong with PHP, here's a good place to start: http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de...
Re:OrmHate by papsosouid on Tuesday June 26, 2012 @11:04AM (#4162226)
Just because PHP doesn't 100% doom you to failure, doesn't mean there is "nothing wrong with it".
Re:OrmHate by Cloven on Tuesday June 26, 2012 @10:45AM (#4162086)
I would say there's a difference. PHP is bad because it has a wide variety of objectively awful design flaws, its standard library is a conflicted mess, and it's unperformant. Implementing it into a modern architecture is highly correlated with sloppiness and technical debt.

ORM is bad because the impedance mismatch between an object and a relational model is very difficult to get right.

Frequently, for example, one iterates over collections of objects in the OO paradigm. A naively written ORM, or one without sufficient introspection into the loop intent, can translate that into N select statements, each incurring a network round trip.

The end result is that OO programmers have to understand not only their object code, but also the relational model, and finally too the ORM's peculiarities and suboptimalities. So in attempting to solve one problem, most of the time you end up with three.

That said, there is a sweet spot in ORMs for simple code (e.g. most web apps, where ActiveRecord and Sequel and the like are fine). But there's no sweet spot for PHP code. Every line written is technical debt.