<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>A.J. Brown&#039;s Blog &#187; CakePHP</title> <atom:link href="http://ajbrown.org/blog/tags/cakephp/feed" rel="self" type="application/rss+xml" /><link>http://ajbrown.org/blog</link> <description>Coding adventures and technology musing for the masses</description> <lastBuildDate>Fri, 26 Mar 2010 17:57:50 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.1</generator> <item><title>PHP 5.3 and Cake 1.2.0</title><link>http://ajbrown.org/blog/2009/12/22/php-5-3-and-cake-1-2-0.html</link> <comments>http://ajbrown.org/blog/2009/12/22/php-5-3-and-cake-1-2-0.html#comments</comments> <pubDate>Wed, 23 Dec 2009 03:33:30 +0000</pubDate> <dc:creator>A.J. Brown</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[CakePHP]]></category><guid isPermaLink="false">http://ajbrown.org/blog/?p=212</guid> <description><![CDATA[I'm writing this quick note for anyone else that might come across this problem. I recently decided to upgrade one of my CentOS servers running a cleint's CakePHP application from a PHP 5.2.X version up to PHP 5.3.1. The package was from the remi repository, with no modifications. Suddenly, Cake stopped using my controllers' actions [...]]]></description> <content:encoded><![CDATA[<p>I'm writing this quick note for anyone else that might come across this problem.  I recently decided to upgrade one of my CentOS servers running a cleint's CakePHP application from a PHP 5.2.X version up to PHP 5.3.1.  The package was from the remi repository, with no modifications.  Suddenly, Cake stopped using my controllers' actions to generate output, and was displaying output from the default controller.</p><p>After pulling my head out, I found the issue in the dispatcher. Around line 359 or so (I hacked up my dispatcher with additional comments while debugging) in cake/Dispatcher.php, you will find the following:</p><p><code>$output = call_user_func_array(array(&#038;$controller, $params['action']), empty($params['pass'])? null: $params['pass']);</code></p><p>The problem is, call_user_func_array requires the 2nd parameter to be an array.  As you can see, cake is passing 'null' if we have no additional parameters to pass to the controller action.  To fix, just change 'null' to 'array()':</p><p><code>$output = call_user_func_array(array(&#038;$controller, $params['action']), empty($params['pass'])? array(): $params['pass']);</code></p><p>Now everything should be working again.</p><p>Note that this particular application is using a very early version of Cake 1.2.  This problem might be fixed in later versions.</p> ]]></content:encoded> <wfw:commentRss>http://ajbrown.org/blog/2009/12/22/php-5-3-and-cake-1-2-0.html/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Maybe I was too hard on CakePHP</title><link>http://ajbrown.org/blog/2008/12/23/maybe-i-was-too-hard-on-cakephp.html</link> <comments>http://ajbrown.org/blog/2008/12/23/maybe-i-was-too-hard-on-cakephp.html#comments</comments> <pubDate>Tue, 23 Dec 2008 20:24:45 +0000</pubDate> <dc:creator>A.J. Brown</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[CakePHP]]></category><guid isPermaLink="false">http://ajbrown.org/blog/?p=53</guid> <description><![CDATA[After a few bloody noses and black-eye's from my previous post "<a href="http://ajbrown.org/blog/2008/12/22/four-reasons-to-hate-cakephp/">Four Reasons to Hate CakePHP</a>", I think I might have been a little too hard on the little guy.  No, seriously, I really think I might have been a little to hard on it.  After reading some of the feedback, and reading some counter points by Matt on his blog, "<a href="http://www.pseudocoder.com/archives/2008/12/23/8-reasons-to-hate-cakephp/">[point] 8 Reasons to Hate CakePHP</a>", It made me reconsider my post.  My opinion remains the same, but now I realize my perspective is off.]]></description> <content:encoded><![CDATA[<p>After a few bloody noses and black-eye's from my previous post "<a href="http://ajbrown.org/blog/2008/12/22/four-reasons-to-hate-cakephp/">Four Reasons to Hate CakePHP</a>", I think I might have been a little too hard on the little guy.  No, seriously, I really think I might have been a little to hard on it.  After reading some of the feedback, and reading some counter points by Matt on his blog, "<a href="http://www.pseudocoder.com/archives/2008/12/23/8-reasons-to-hate-cakephp/">[point] 8 Reasons to Hate CakePHP</a>", It made me reconsider my post.  My opinion remains the same, but now I realize my perspective is off.  (I'd accept way off.)</p><p>The first thing I failed to consider is that one single tool is not an end-all solution to all problems.  A fair argument has been made about Zend Framework -- it's not quite a framework in the traditional sense of things.  CakePHP is exactly that; a framework.  That is the essence of half of the problems that I and my colleagues have experienced when it comes time to scale.  CakePHP provides a well structured framework (note: when I said structured before, I was referring to architecture, not file system structure) to quickly develop applications.  (Do I discredit myself by saying that it's very good at doing just that?) With CakePHP, you get an application that's ready to go out of the box -- not so much with Zend Framework.  Zend Framework is largely a library, not a framework.  This is, after all, why it's able to stay out of your way so easily -- it wasn't intended to be there in the first place.</p><blockquote><p>CakePHP is exactly that; a framework</p></blockquote><p>The second thing that put me back in perspective is an article I recently read about how Zend Framework is "winning the wrong war". (I apologize to the author, I can't find your post to link to.)  That posting makes a very good point.  It talks about how Zend Framework strives to gain the approval of Ruby on Rails folk, but it's going about it the wrong way.   Zend Framework is riddled with extremely useful components, thorough testing, and great documentation (most of the time).  The trouble is, most people just don't care about any of that.  Like that posting describes, most Ruby on Rails folk love RoR because of the little time to market required to get a conceived idea online.  I'll go ahead and admit:  Time to market with CakePHP is much faster than Zend Framework.</p><p>CakePHP's "weakness" (as I would have earlier described it) of being simple and concrete is where Zend Framework's "strength" lies.  Yes, with Zend Framework you can have an application online fairly quickly, but you don't get anything out of the box.  It provides all of the components needed, and <em>recommends</em> a file structure, but doesn't require one.  This allows you to pick and choose what you want Zend Framework to do for you.  But this flexibility comes at the price of a learning curve, and at the price of extra bloat for those sites not in need of the hundreds of extra components that it provides.</p><p>To make up for my skewed perspective, I hope to write a few more posts in the coming days comparing and contrasting features of both frameworks.  In the mean time, allow this follow up to serve as somewhat of a rebuttal <img src='http://ajbrown.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://ajbrown.org/blog/2008/12/23/maybe-i-was-too-hard-on-cakephp.html/feed</wfw:commentRss> <slash:comments>20</slash:comments> </item> <item><title>Four reasons to hate CakePHP</title><link>http://ajbrown.org/blog/2008/12/22/four-reasons-to-hate-cakephp.html</link> <comments>http://ajbrown.org/blog/2008/12/22/four-reasons-to-hate-cakephp.html#comments</comments> <pubDate>Mon, 22 Dec 2008 20:16:45 +0000</pubDate> <dc:creator>A.J. Brown</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[CakePHP]]></category> <category><![CDATA[Rapid Application Development]]></category> <category><![CDATA[Zend Framework]]></category><guid isPermaLink="false">http://ajbrown.org/blog/?p=37</guid> <description><![CDATA[Before starting a project recently, I spent some time doing some research comparing CakePHP and Zend Framework for rapid development.  I noticed that of the few articles out there, not many of them where able to offer any advice on using either framework for a new project.  In most blogs, it seemed to come down to preference. This article will hopefully sway you away from CakePHP]]></description> <content:encoded><![CDATA[<p><strong>A follow-up has been posted <a href="http://ajbrown.org/blog/2008/12/23/maybe-i-was-too-hard-on-cakephp/">here</a></strong></p><p>Before starting a project recently, I spent some time doing some research comparing <a href="http://cakephp.org"  rev="vote-against">CakePHP</a> and <a href="http://framework.zend.com"  rev="vote-for">Zend Framework</a> for rapid development.  I noticed that of the few articles out there, not many of them where able to offer any advice on using either framework for a new project.  In most blogs, it seemed to come down to preference.  My goal today will be to steer you away from Cake.</p><p>This article is intended for those that are familiar with the concept of rapid application development, and the benefit of using a framework such as Zend or Cake.  If you want more information on why you would use such a framework, This article is outside of that scope.</p><p>It's worth mentioning that CakePHP and Zend Framework aren't the only popular open source rapid application frameworks out there.  I'm only focusing on these two frameworks because I have the most experience with them, and can offer useful insight into their strengths and weaknesses.  If you're interested in other frameworks, have a look at any of the following.</p><h4 id="toc-other-popular-frameworks">Other Popular Frameworks</h4></p><ul><li><a rev="vote-abstain" href="http://www.symfony-project.org/">Symphony</a> - Built in <a rev="vote-for" href="http://www.doctrine-project.org/">Doctrine</a> ORM.</li><li><a rev="vote-abstain" href="http://www.zym-project.com/">Zym Framework</a> - a fork of Zend Framework, developed in parallel.</li></ul><h4 id="toc-cake-is-heavy">Cake is Heavy</h4><p>Staying out of your way is a very important for many aspects in life, including your application's third-party framework.  You want something that provides functionality and structure, but allows you to fulfill your own needs in your own way.</p><blockquote><p>Cake is no low-calorie meal</p></blockquote><p>There's nothing lightweight about it.  Cake tends to get in the way of your application by requiring your application to be built on top of (instead of along side of) itself.  When cake is bootstrapped (configured), it will look for your application specific configuration files in a hard coded file location that it expects. Although you can predefine the defines (which is a whole-other reason to avoid using cake) it uses to determine paths, you'll never be able to completely seperate cake from your life without modifying cake itself.</p><h4 id="toc-code-and-feature-management">Code and Feature Management</h4><p>One of my cleints' websites is was written on top of one of the Cake 1.2 alpha releases from a few months ago.  (By the way, did no one tell the developers that in <a title="Software Engineering" href="http://ajbrown.org/blog/tag/software-engineering">software engineering</a> "alpha" release is not meant for the public?) I recently upgraded to 1.2 Release Candidate 4 and had a few problems.  This is to be expected when you're using any non-stable version of anything, but what I didn't expect was API changes. I don't mean additional features, I mean changing APIs.  Granted they were few and far in between, but they were still unexpected.</p><h4 id="toc-hanging-on-to-old-times">Hanging on to Old Times</h4><p>The most annoying thing to me is that Cake uses PHP4 style objects. I feel safe in saying that any community software being developed today that believes hindering best practices in order to support an obsolete (in the loosest of terms) version of software is not very forward thinking.  No class members or functions have access modifier, and I don't remember seeing any type hinting whatsoever.</p><pre lang="PHP" line="1">
// This is Bad!

class Animal
{
    var $kingdom = 'Animal';

    function foobar()
    {
        //do something very private
     }
}

// This is GOOD!

class Animal
{
     private $_kingdom = 'Animal';

      private function foobar()
      {
          //do something private
      }
}
</pre><h4 id="toc-no-namespace-consideration">No Namespace Consideration</h4><p>Cake uses very generic class names with no consideration for names pace collisions.  By using cake, you're forcing yourself out of using generic class names in your own application (which is a better place for generic names to be!).  Want to name a class `Controller`, `App`, or `Model`?  Too bad -- cake has claimed those names for you!</p><p>Another horrible practice of Cake's is using global functions. Hsughughugh.  I cannot begin to tell you how painful and fragile this is.  All it takes to cure a few of the problems this creates is to wrap them in an abstract class!  I don't know why they would rather have the function uses() in a global namespace instead of wrapping it in a class as `Cake::uses()`.  Some (maybe most?) have been fixed in RC4 (you use `App::import()` instead of `uses()`), but they still allow the abuse by keeping the functions there.</p><h4 id="toc-conclusion">Conclusion</h4><p>If you are reading this article, you're probably at a crossroads between using CakePHP or using some other suite.  I could go on and on about why I personally hate cake, but when it comes down to it, the decision is yours.  Despite my gripes, Cake is still a good tool to get a simple website up and running quickly in a structured manner, without reinventing the wheel.  Just make sure your website will never need to be scalable, and that its codebase will never grow beyond the small flexibility it offers.  I'm personally experiencing this pain right now.</p><blockquote><p>Great for mom &#038; pop, but corporations shouldn't dare</p></blockquote><p>That's how I once described my thoughts on using <a href="http://www.joomla.org/" rev="vote-against">Joomla</a> as a foundation for websites to a potential client.  I think I'll go ahead and reuse that for this article.</p> ]]></content:encoded> <wfw:commentRss>http://ajbrown.org/blog/2008/12/22/four-reasons-to-hate-cakephp.html/feed</wfw:commentRss> <slash:comments>42</slash:comments> </item> </channel> </rss>