Why I don't like CakePHP

2010-02-10

I've used CakePHP for a lot of projects now. There's no comparison to Ruby on Rails. Rails is smartly integrated, well-designed, and sits on top of an elegant language. CakePHP is an admitted ripoff of Rails that sits on a popular but terrible language. It copies Rails - almost randomly - without copying any of the stuff that makes Rails great. And PHP is a language plagued by indecision, delays, and paradigms from the last decade.

What makes Rails great?

What makes CakePHP awful?

Cake doesn't even try to hide the fact that its cloning Rails in PHP, but it's at a disadvantage from the start because PHP's syntax is just so much worse. And they use arrays to represent objects. And PHP's array syntax is terrible. Unbelievably terrible. Which makes the decision to go all-in on PHP arrays baffling. I spend the majority of my time in Cake trying to manipulate arrays-of-arrays-of-arrays-of-arrays that are supposed to represent some kind of shoddy struct, then mangling with model associations that require about 5 nested arrays to define. Add to this the fact that CakePHP tries to "innovate" its way around some of its shortcomings in a less-than-brilliant way (like, um, $recursive) and you get a steaming pile of garbage that's only marginally better than just coding a PHP project from scratch.

Rails's smart design has come at a cost. In the past, they haven't been shy about breaking backwards compatibility, sometimes in a big way, to cut out cancerous ideas before they take hold. It's a community that acknowledges mistakes and embraces their eradication. And Ruby is an elegant language with strong design and is under active development. PHP on the other hand has languished for years, most notably with a critical security bug called $register_globals. On top of that, they've been slow to introduce object support, type-checking, and sometimes make terribly confusing decisions (like the decision to call a feature overloading that has absolutely nothing to do with method overloading in the traditionally accepted sense of the word).

To be fair, here's what I don't like about Rails (and Ruby):