CakePHP 2.0 Rant
Published on Jan 31, 2011 by Jamie Munro/*CakePHP 2.0 Rant*/?> /*CakePHP|cakephp,cakephp 2.0|cakephp-2-0,lazy loading|lazy-loading*/?> /*2011-1-31*/?> I was recently visiting the CakePHP bakery and decided to read a little bit about CakePHP 2.0-dev. I've rather enjoyed CakePHP as a framework since version 1.1 all the way through to version 1.3. However, after reading some of the "features" for version 2, I have to say, I'm a little disappointed about their focus.
In the bakery, there are 6 core features listed that they deem worth mentioning. The two that stand out to me the most are:
- Lazy loading model associations - Associated models are loaded on-demand greatly improving the memory use and performance of larger applications.
- Lazy loading of Helpers and Components - Helpers and components are loaded/constructed as needed helping performance.
Lazy loading, like most people, you are probably thinking, "oh wow, what a great way to improve speed!". Well, no offense, if you're thinking this way, you are the one that's lazy! Sorry for the shot. But if you really think about it, if your application is developed correctly in the first place you shouldn't rely on the framework implementing features like lazy loading, your application should be setup in a way that it is only retrieving the data that it needs and most importantly, when it needs it.
I can see it now, all of our models relationships will have recursive set to 2 because CakePHP will only fetch the data when I need it. This will make development so much easier! Well, yes, I agree that development times might speed up, but unfortunately, speed of development isn't the only thing we can care about. At some point, hours and hours of time needs to be dedicate solely to ensuring OUR (not the framework's code) is as optimized as it can be. If we don't, no matter how optimized CakePHP tries to be, your code will never be.
Ok, I'm done ranting, I just don't like it when developers are taking the lazy way out!