{
    "href": "/post/2005/02/04/introducing-the-hive/",
    "relId": "2005/02/04/introducing-the-hive",
    "title": "Introducing: the Hive",
    "author": "pmjones",
    "markup": "html",
    "tags": [
        {
            "href": "/tag/php/",
            "relId": "php",
            "title": "PHP",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        },
        {
            "href": "/tag/solar/",
            "relId": "solar",
            "title": "Solar",
            "author": null,
            "created": null,
            "updated": [],
            "markup": "markdown"
        }
    ],
    "created": "2005-02-04 18:49:55 UTC",
    "updated": [
        "2005-02-04 18:49:55 UTC"
    ],
    "html": "<p>The world may not feel the need for yet another class library, but after two years with <a href=\"http://pear.php.net\">PEAR</a>, I sure do.  My attempt to unify PEAR packages with a wrapper package (which I attempted with <a href=\"http://phpyawp.com/\">Yawp</a>) is essentially a dead-end.  While I like the mode of operation I have developed with Yawp and <a href=\"http://pear.php.net/DB_Table\">DB_Table</a> and <a href=\"http://phpsavant.com\">Savant</a>, I do not think the PEAR project is open to incorporating such a mode.</p>\n<p>With that in mind, I am introducing a new class library for PHP5: the Hive.  You can <a href=\"http://ciaweb.net/Hive-0.0.1dev1.tgz\">download a PEAR package of it</a>.  While this is a 0.0.1 development release, I think you will find the work well fleshed out, with a current <a href=\"http://phpdoc.org\">PhpDocumentor</a>-generated <a href=\"http://ciaweb.net/hive_api/\">API reference</a>. End-user documentation will be forthcoming in the next few weeks.</p>\n<h3>A Bit About My Pear Background</h3>\n<p>What is it that developers love about PEAR?  Look no further than <a href=\"http://wiki.ciaweb.net/yawiki/index.php?area=PEAR_Dev&amp;page=PearGreatness\">this page</a>, which was the result of a call-for-replies on the PEAR-DEV mailing list last year.  Let me add to that list my own reasons why I started using PEAR classes.</p>\n<p>In the beginning, there was only one thing that mattered to me: unified error handling.  That was it, really.  If a foreign object reported an error, I knew exactly how to check for it and what format it would be in; if I needed to report an error, I knew exactly how to format it.  Thus, for all its flaws, PEAR_Error was the main reason I started using PEAR classes.  Add to that the PEAR DB abstraction package, which was a great labor-saver.  Finally, and I have come to love this more than anything else, the PEAR installer has turned into a work of genius under the stewardship of Greg Beaver.</p>\n<p>But I have come to believe that PEAR is too much a mishmash; even with coding style standards, the class packages operate according to widely varying styles.  In addition, it is far too difficult to add a new package that I find useful but is similar in purpose to an existing package (even if the principles of their operation are widely different).  For example, see the acceptance of DB_Table in the face of serious opposition and only after patient months of lobbying, as well the rejection of Savant after a knock-down drag-out (to which rejection I contributed my own fair share).</p>\n<p>In short, I find it much too hard to do anything new or different within PEAR that is not already part of PEAR doctrine; while this brings stability, it also brings a certain morbidity.  (This is not to say I'm leaving PEAR; I'm not.  I am just going to concentrate my new development efforts outside PEAR, not inside it.)</p>\n<h3>Foundational Principles Of The Hive</h3>\n<p>There is one essential principle behind the Hive:  comprehensibility.  Developers exploring the Hive should be able to comprehend the code quickly and easily, so they can see exactly what's going on and why.  In short, I am tired of slogging through uncommented, undocumented, complex, obtuse code and packages, whether mine or someone else's.</p>\n<p>The principle of comprehensibility gives rise to two corollaries:</p>\n<ul>\n<li>Simplicity of code</li>\n<li>Obsessive dedication to comments and documentation</li>\n</ul>\n<p>These in turn mean that it should be easy to extend and customize code in the Hive, but that has yet to be borne out.</p>\n<h3>Some Technical Notes</h3>\n<p>The Hive adheres to PEAR coding style standards and its directory structure is similar to PEAR's.</p>\n<p>Hive can exist with any other library set, including standalone libraries, PEAR, Horde, and so on; using the Hive does not mean you are limited to the Hive.</p>\n<p>Hive comes with a shared-object aggregator and convenience method central class and some basic functional classes:</p>\n<ul>\n<li>Hive_Cache for caching; both file and memcached are currently supported</li>\n<li>Hive_Error for unified error handling</li>\n<li>Hive_Sql for identical-operation database abstraction (will migrate to a PDO backend as PDO comes on-line)</li>\n<li>Hive_Sql_Entity for representing data-type abstracted tables with automated validation and form-hints generation</li>\n<li>Hive_User for user authentication and roles/groups (preferences and permissions will arrive later)</li>\n<li>Hive_Valid for data validation</li>\n</ul>\n<p>One major goal of the Hive is to provide shared application component backends that are not tied to any particular display mechanism.  This is accomplished through Hive_Sql_Entity (the successor to DB_Table) and the Hive.conf.php configuration mechanism, along with the shared object instantiator Hive::shared (which is a successor to the Yawp::getObject technique).  The initial set of application component objects will include a comment/trackback tool, a wiki page storage interface, and a blog entry storage interface.</p>\n<h3>Cliffhanger</h3>\n<p>(Not a conclusion.  ;-)  I'll be writing more about the Hive in weeks to come; with any luck, this will be in the form of documentation, as well as blogging about feedback, issues, ideas, and to-do items.</p>\n<p>As always, I'm happy to hear feedback and see trackbacks.</p>\n<h3>Update (2005-03-08)</h3>\n<p>Somebody else is using the name \"Hive\" for a PHP5 project.  I have adopted a new name for the project:  Solar.  You can search this blog for other Solar entries to learn more, or <a href=\"http://solarphp.com\">visit the Solar home page</a>.</p>\n"
}
