{
    "href": "/post/2009/11/11/the-future-of-zend-framework-is-solar/",
    "relId": "2009/11/11/the-future-of-zend-framework-is-solar",
    "title": "The Future of Zend Framework is Solar",
    "author": "pmjones",
    "markup": "html",
    "tags": [
        {
            "href": "/tag/benchmarks/",
            "relId": "benchmarks",
            "title": "Benchmarks",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        },
        {
            "href": "/tag/php/",
            "relId": "php",
            "title": "PHP",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        },
        {
            "href": "/tag/programming/",
            "relId": "programming",
            "title": "Programming",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        },
        {
            "href": "/tag/solar/",
            "relId": "solar",
            "title": "Solar",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        }
    ],
    "created": "2009-11-12 05:38:59 UTC",
    "updated": [
        "2009-11-12 05:38:59 UTC"
    ],
    "html": "<p>I have said it <a href=\"http://benramsey.com/archives/zend-framework-view-notes/#comment-23921\">before</a> and I'll say it again now:  If you want to see the future of Zend Framework, look at <a href=\"http://solarphp.com\">the Solar Framework for PHP 5</a>.</p>\n<p>FYI: This is a cheerleading post. Some will be annoyed by it or find it \"unfair\".  Others may find it informative and enlightening.  I make no apology for advocating what I think are the good things about <a href=\"http://solarphp.com\">Solar</a>, especially when other projects appear to be mimicking those things.</p>\n<p>I noticed that Matthew posted the ZF 2.0 roadmap yesterday:</p>\n<p><a href=\"http://framework.zend.com/wiki/display/ZFDEV2/Zend+Framework+2.0+Roadmap\">http://framework.zend.com/wiki/display/ZFDEV2/Zend+Framework+2.0+Roadmap</a></p>\n<p><a href=\"http://solarphp.com\">Solar</a> is <em>already</em> doing most of what is described as the future for Zend.  Let's go over this, shall we?</p>\n<blockquote>\n<p>Unified constructor. All constructors will (optionally) accept an array of options or Zend_Config object as the first argument. This allows for more flexibility to add new arguments to the constructor, have variable numbers of arguments, and allow \"named\" arguments. Additionally, it's a good technique for allowing Dependency Injection.</p>\n</blockquote>\n<p><a href=\"http://solarphp.com\">Solar</a> has had a framework-wide <a href=\"http://solarphp.org/manual:project_standards:constructor_parameters\">unified constructor</a> for years now. As far as I know, Solar is the first PHP framework to demonstrate this design pattern and give it a name. You can have a unified constructor <em>right now</em> with <a href=\"http://solarphp.com\">Solar</a>.</p>\n<p>In addition, we already have a unified <a href=\"http://solarphp.org/manual:solar:dependency_injection\">dependency injection</a> <em>and</em> service locator implementation, via the <a href=\"http://solarphp.org/manual:solar:config_file\">unified configuration</a> mechanism and a <a href=\"http://solarphp.org/manual:registry:overview\">lazy-loading registry</a>. You can have DI/SL <em>right now</em> with <a href=\"http://solarphp.com\">Solar</a>.</p>\n<blockquote>\n<p>Options. In ZF 1.X, the various components which accept options accept a variety of formats: some expect underscore_separated keys, others expect camelCasedKeys, others expect UPPERCASEDKEYS, and some expect lowercasedkeys. This leads to confusion for many, and also leads to difficulties debugging. Our goal in ZF 2.0 is to standardize option keys to correct this situation.</p>\n<p>Currently, we are leaning towards all_lowercase_underscore_keys.</p>\n</blockquote>\n<p><a href=\"http://solarphp.com\">Solar</a> has already standardized on its config keys as lowercase-underscore. You can have standard config keys <em>right now</em> with <a href=\"http://solarphp.com\">Solar</a>.</p>\n<blockquote>\n<p>Exceptions. Each component will have an Exception marker interface, with exceptions defined for discrete exception types thrown by the component. The concrete exceptions will either extend the global Exception class or an SPL Exception, and also implement the component Exception interface.</p>\n</blockquote>\n<p><a href=\"http://solarphp.com\">Solar</a> provides a <a href=\"http://solarphp.com/class/Solar/exception%28%29\">unified exception mechanism</a> already.  This is not quite the same thing as described in the ZF2.0 document, but if the idea is to have a unified way of throwing and recognizing exceptions, <a href=\"http://solarphp.com\">Solar</a> is already doing it.</p>\n<blockquote>\n<p>Design By Contract.</p>\n</blockquote>\n<p>OK, we don't really do this. <a href=\"http://solarphp.com\">Solar</a> tends to use adapters, plugins, class stacks, and duck typing, not interfaces.</p>\n<blockquote>\n<p>Elimination of most singletons.</p>\n</blockquote>\n<p><a href=\"http://solarphp.com\">Solar</a> doesn't use singletons.  We use the registry and, occasionally, unified static-method-collection classes.  You want two or more database connections? Mark them for lazy-load in the registry, and set your config file to use the appropriate service locator keys for whatever objects may need them.  You can have this <em>right now</em> with <a href=\"http://solarphp.com\">Solar</a>.</p>\n<blockquote>\n<p>Creation of components for general-purpose, cross-functional actions. A number of components duplicate code, and we want to push the duplication areas into discrete components that the original components may then consume. Some of these include:</p>\n<ul>\n<li>Plugins/Helpers/Strategies (seen currently in Zend_Controller_Front, Zend_Controller_Action_Helper, Zend_View (helpers and filters), Zend_Form (validators, filters, and decorators), etc.). Plugin discovery and loading could benefit from a common API.</li>\n<li>Decorators (seen currently in Zend_Form; other areas could benefit from the pattern)</li>\n<li>Factories (seen currently in Zend_Db, Zend_Navigation_Page, Zend_Auth, Zend_Translate, Zend_Cache, etc.)</li>\n<li>Caching (seen currently in Zend_Translate, Zend_Locale, Zend_Queue, Zend_Paginator, Zend_Feed_Reader, Zend_Db_Table, etc.)</li>\n</ul>\n</blockquote>\n<p><a href=\"http://solarphp.com\">Solar</a> already has a <a href=\"http://solarphp.com/class/Solar_Factory\">standardized factory mechanism</a> and a standardized adapter approach. With the lazy-loading registry and DI/SL mechanism we can inject a <a href=\"http://solarphp.com/package/Solar_Cache\">cache object</a> into any other object that's ready to receive it. You can have these <em>right now</em> with <a href=\"http://solarphp.com\">Solar</a>.</p>\n<p>(In fairness, we don't use decorators much, and the plugin systems are more a standard approach using class stacks than an encapsulated system.)</p>\n<blockquote>\n<p>Usage of new language features within plugin architectures.</p>\n</blockquote>\n<p><a href=\"http://solarphp.com\">Solar</a> isn't on 5.3 yet, but then, neither is Zend Framework.</p>\n<blockquote>\n<p>Autoload-only. We will move to using autoloading throughout the framework. This solves a number of performance issues, as well as simplifies coding dependencies (particularly exceptions).</p>\n</blockquote>\n<p><a href=\"http://solarphp.com\">Solar</a> is already autoload-only.  You can be autoload-only too <em>right now</em> with <a href=\"http://solarphp.com\">Solar</a>.</p>\n<blockquote>\n<p>Namespaces. PHP namespaces benefit frameworks and libraries more than any other code bases, and ZF can benefit from it greatly, particularly with components such as Zend_Search_Lucene and Zend_Controller.</p>\n</blockquote>\n<p><a href=\"http://solarphp.com\">Solar</a> already has first-class support for PHP 4/5 style namespaces (i.e., pseudo-namespaces) and supports mixing of multiple \"vendor\" prefixes in projects (and supports cross-vendor fallbacks across library hierarchies).  <a href=\"http://solarphp.com\">Solar</a> expects that you will be working within your own pseudo-namespace already, and so is poised to use 5.3 namespaces proper with little effort.  You can have namespace-like support <em>right now</em> with <a href=\"http://solarphp.com\">Solar</a>.</p>\n<blockquote>\n<p>goto</p>\n</blockquote>\n<p>As with \"new language features\" above, <a href=\"http://solarphp.com\">Solar</a> isn't on 5.3 yet, but then, neither is Zend Framework.</p>\n<blockquote>\n<p>MVC Implementation: Our current MVC implementation is increasingly adding overhead to the dispatch cycle, slowing down the request cycle. While you can squeeze additional performance out of it via stripping require_once calls and using autoloading, the fastest requests are still far short of other, slimmer frameworks ...</p>\n</blockquote>\n<p><a href=\"http://solarphp.com\">Solar</a>'s dynamic dispatch cycle is much faster than the one in Zend Framework, and has been for years; see these benchmarking posts:</p>\n<ul>\n<li><a href=\"http://paul-m-jones.com/blog/?p=238\">http://paul-m-jones.com/blog/?p=238</a></li>\n<li><a href=\"http://paul-m-jones.com/blog/?p=315\">http://paul-m-jones.com/blog/?p=315</a></li>\n<li><a href=\"http://paul-m-jones.com/blog/?p=421\">http://paul-m-jones.com/blog/?p=421</a></li>\n</ul>\n<p>You can have a much faster dispatch cycle <em>right now</em> by using <a href=\"http://solarphp.com\">Solar</a>.</p>\n<h2>Models and Master-Slave</h2>\n<p>One more thing that Zend Framework <em>doesn't</em> have, that <a href=\"http://solarphp.com\">Solar</a> does, is an integrated model system.  Zend Framework recently <a href=\"http://old.nabble.com/Discontinuing-Zend-Entity-in-favour-of-Doctrine-integration-td26117819.html\">dropped the idea of having their own</a>, and expect to depend on an external system for reasonable model/record/collection support.  <a href=\"http://solarphp.com\">Solar</a> has an integrated <a href=\"http://solarphp.org/manual:model\">model system</a> <em>right now</em> with support for single table inheritance, various relationships, unified saving of object graphs, automatic data filtering, automatic form generation, calculated columns, collection methods, automatic data caching and clearing, and much more.</p>\n<p>Yet another thing: we also provide support out-of-the-box for <a href=\"http://solarphp.com/blog/read/19-adapter-for-master-slave-my-sql-setups\">master-slave MySQL replication</a>, with <em>no changes needed to the codebase</em>.  Change your config file from the single-server connection to the master-slave connection, and you are done.  (Well, you might have to wrap some parts in transactions, but after that, it will work on both single-server and master-slave setups.)</p>\n<p>You can have robust models and master-slave support <em>right now</em> with <a href=\"http://solarphp.com\">Solar</a>.</p>\n<h2>Modesty</h2>\n<p>There is one significant thing that Zend has that <a href=\"http://solarphp.com\">Solar</a> doesn't: narrative documentation.  Our <a href=\"http://solarphp.com/class\">API docs</a> are second to none, but the tutorials are lacking.  We've been spending our time making the framework great, not writing about the framework.  You can help with that if you like by adding to the wiki.</p>\n<h2>Conclusion</h2>\n<p>The point of all this is not to belittle Zend, Zend Framework, its developers, or its contributors.  The point is to ask Zend Framework adopters:  why wait for ZF 2.0 when you can have all those features and more, <strong>right now</strong>, by using <a href=\"http://solarphp.com\">Solar</a>?</p>\n<p>(Let the ZF apologists begin their comments <em>right now</em>. ;-)</p>\n"
}
