<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>0xDECAFBAD - Tag: zend</title>
    <link href="http://decafbad.com/blog/atom.xml" rel="self"/>
    <link href="http://decafbad.com/blog"/>
    <updated>2011-11-16T16:29:50+00:00</updated>
    <id></id>
    <author>
        <name></name>
        <email>l.m.orchard@pobox.com</email>
    </author>
    

    <entry>
        <title>A Curmudgeon Playing with the CodeIgniter Framework and OpenID</title>
        <link href="http://decafbad.com/blog/2007/07/23/a-curmudgeon-playing-with-the-codeigniter-framework-and-openid"/>
        <updated>2007-07-23T14:37:33+00:00</updated>
        <id>http://decafbad.com/blog/2007/07/23/a-curmudgeon-playing-with-the-codeigniter-framework-and-openid</id>
        <content type="html">&lt;p&gt;One bit of hackery I did this weekend was to explore the &lt;a href=&quot;http://codeigniter.com/&quot;&gt;CodeIgniter PHP framework&lt;/a&gt;, which is even less magic yet more glued-together out of the box than the &lt;a href=&quot;http://framework.zend.com/&quot;&gt;Zend Framework&lt;/a&gt;.  Also, very much less magic than &lt;a href=&quot;http://cakephp.org/&quot;&gt;CakePHP&lt;/a&gt; and barely in the same universe as &lt;a href=&quot;http://www.symfony-project.com/&quot;&gt;Symfony&lt;/a&gt;.  I think I may have found my sweet spot of simplicity and comprehensible magic.&lt;/p&gt;


&lt;p&gt;&lt;a href=&quot;http://codeigniter.com/&quot;&gt;CodeIgniter&lt;/a&gt; has is a PHP 4 / 5 framework that provides a lightweight Model / View / Controller arrangement with URL routing and a useful but minimal constellation of utility classes and helpers.  The view templates are in PHP, with just a bit of pre-processing.  The controllers are plain-old PHP classes whose methods are called via simple URL routes.&lt;/p&gt;


&lt;p&gt;The &lt;a href=&quot;http://codeigniter.com/user_guide/general/models.html&quot;&gt;model layer of CodeIgniter&lt;/a&gt;, however, is the weakest part of the trio - which I actually like a lot.  It's not a magical ORM - instead it's just a simple superclass from which to derive, mostly there to suggest that a separate model is a good thing to write.  The DB abstraction classes just make the job of writing SQL statements easier and don't pretend that there's no impedance mismatch between objects and relational tables.&lt;/p&gt;


&lt;p&gt;The depth of code in &lt;a href=&quot;http://codeigniter.com/&quot;&gt;CodeIgniter&lt;/a&gt; is shallow enough that I felt I was able to get into developing quickly while still taking side trips through the framework methods I was calling and get at least a glance at what being taken care of for me.  &lt;a href=&quot;http://codeigniter.com/forums/viewthread/50715/&quot;&gt;There's always danger in magic&lt;/a&gt;, but this stuff doesn't really get out of hand.&lt;/p&gt;


&lt;p&gt;To doodle around with an idea, I threw together a layout decorator class to support the sort of nested templates I'm used to from &lt;a href=&quot;http://www.symfony-project.com/&quot;&gt;Symfony&lt;/a&gt;.  Out of the box, &lt;a href=&quot;http://codeigniter.com/user_guide/general/views.html&quot;&gt;CI views&lt;/a&gt; are simple, offering facilities for calling sub-templates and &quot;partials&quot; but not directly providing conventions for such.  My first swatches of code add a bit of that.&lt;/p&gt;


&lt;p&gt;After playing around with layouts, the next thing I did was to use &lt;a href=&quot;http://codeigniter.com/user_guide/libraries/sessions.html&quot;&gt;CI sessions&lt;/a&gt; and the &lt;a href=&quot;http://www.openidenabled.com/openid/libraries/php&quot;&gt;PHP OpenID Library&lt;/a&gt; to develop both an auth producer and consumer.  &lt;a href=&quot;http://codeigniter.com/&quot;&gt;CodeIgniter&lt;/a&gt; doesn't come with a ready-made user auth system, though it does come with &lt;a href=&quot;http://codeigniter.com/user_guide/libraries/sessions.html&quot;&gt;its own implementation of sessions&lt;/a&gt; using encrypted browser cookies to replace PHP's native sessions - another feature I really like.&lt;/p&gt;


&lt;p&gt;Kind of odd - but on the same toy app I can sign up for local accounts, sign into other sites with OpenID URLs based on local accounts, and sign into my &lt;a href=&quot;http://codeigniter.com/&quot;&gt;CI&lt;/a&gt; app with external OpenID identities.&lt;/p&gt;


&lt;p&gt;The wild bit is that I can even sign in locally with one OpenID URL, then use the newly created local profile to get a second OpenID URL to sign in somewhere else.  Seems interesting yet possibly dangerous.  I mostly just glued the right parts together and got the Auth_OpenID black-box modules working - now that I have an operational OpenID system, I need to study it further.&lt;/p&gt;


&lt;p&gt;The next thing I want to do is work more on profile managment, offer some of the &lt;a href=&quot;http://openid.net/specs/openid-simple-registration-extension-1_1-01.html&quot;&gt;OpenID Simple Registration&lt;/a&gt; fields, and look into &lt;a href=&quot;http://drnicwilliams.com/2007/07/20/one-app-one-user-account-and-multiple-openids/&quot;&gt;supporting multiple auth IDs linked to the same user profile&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;It might also be fun to do something like &quot;&lt;a href=&quot;http://simonwillison.net/2007/Jul/13/&quot;&gt;catalogue the sites that a user logs into and automatically construct a homepage&lt;/a&gt;.&quot;  Overall, I've got some vague notional ideas to build a personal status collector and maybe some federated social networking and messaging stuff.  But, one hack at a time.&lt;/p&gt;


&lt;p&gt;Hopefully, I'll get this code I've got so far into better shape and commit to my SVN repository.  Sooner than later, otherwise it'll never get off my dev box.&lt;/p&gt;




&lt;div id=&quot;comments&quot; class=&quot;comments archived-comments&quot;&gt;
            &lt;h3&gt;Archived Comments&lt;/h3&gt;
            
        &lt;ul class=&quot;comments&quot;&gt;
            
        &lt;li class=&quot;comment&quot; id=&quot;comment-221087156&quot;&gt;
            &lt;div class=&quot;meta&quot;&gt;
                &lt;div class=&quot;author&quot;&gt;
                    &lt;a class=&quot;avatar image&quot; rel=&quot;nofollow&quot; 
                       href=&quot;http://plasmasturm.org/&quot;&gt;&lt;img src=&quot;http://www.gravatar.com/avatar.php?gravatar_id=e17949267bbfe21a0fadf1bbf00592b4&amp;amp;size=32&amp;amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png&quot;/&gt;&lt;/a&gt;
                    &lt;a class=&quot;avatar name&quot; rel=&quot;nofollow&quot; 
                       href=&quot;http://plasmasturm.org/&quot;&gt;Aristotle Pagaltzis&lt;/a&gt;
                &lt;/div&gt;
                &lt;a href=&quot;#comment-221087156&quot; class=&quot;permalink&quot;&gt;&lt;time datetime=&quot;2007-07-24T01:34:03&quot;&gt;2007-07-24T01:34:03&lt;/time&gt;&lt;/a&gt;
            &lt;/div&gt;
            &lt;div class=&quot;content&quot;&gt;&lt;p&gt;Hmm, a system that treats its own OpenIDs just like any other OpenID and considers them foreign credentials for which it creates a new account seems… weird. It seems it should recognize its own OpenIDs and map them back to the corresponding username.&lt;/p&gt;&lt;/div&gt;
            
        &lt;/li&gt;
    
        &lt;li class=&quot;comment&quot; id=&quot;comment-221087158&quot;&gt;
            &lt;div class=&quot;meta&quot;&gt;
                &lt;div class=&quot;author&quot;&gt;
                    &lt;a class=&quot;avatar image&quot; rel=&quot;nofollow&quot; 
                       href=&quot;http://www.elroyjetson.org&quot;&gt;&lt;img src=&quot;http://www.gravatar.com/avatar.php?gravatar_id=4a34cf8d239b6589024fc004cfdad5b8&amp;amp;size=32&amp;amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png&quot;/&gt;&lt;/a&gt;
                    &lt;a class=&quot;avatar name&quot; rel=&quot;nofollow&quot; 
                       href=&quot;http://www.elroyjetson.org&quot;&gt;Elroy Jetson&lt;/a&gt;
                &lt;/div&gt;
                &lt;a href=&quot;#comment-221087158&quot; class=&quot;permalink&quot;&gt;&lt;time datetime=&quot;2007-08-24T20:51:24&quot;&gt;2007-08-24T20:51:24&lt;/time&gt;&lt;/a&gt;
            &lt;/div&gt;
            &lt;div class=&quot;content&quot;&gt;&lt;p&gt;Thanks for pointing this framework out.  Some how it had slipped through my fingers.&lt;/p&gt;

&lt;p&gt;I have tried them all and was (maybe still am) close to dumping php for ruby and the rails framework.&lt;/p&gt;

&lt;p&gt;Once I started digging into rails all the php frameworks just seemed like awkward teenagers that have to do everything their own way just to prove that they are different.&lt;/p&gt;

&lt;p&gt;codeIgniter is small.  Simple to setup and, so far anyway, seems about as elegant as you are going to get using php.&lt;/p&gt;&lt;/div&gt;
            
        &lt;/li&gt;
    
        &lt;li class=&quot;comment&quot; id=&quot;comment-221087159&quot;&gt;
            &lt;div class=&quot;meta&quot;&gt;
                &lt;div class=&quot;author&quot;&gt;
                    &lt;a class=&quot;avatar image&quot; rel=&quot;nofollow&quot; 
                       href=&quot;&quot;&gt;&lt;img src=&quot;http://www.gravatar.com/avatar.php?gravatar_id=7b2554252993cc349aa4671cdc751985&amp;amp;size=32&amp;amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png&quot;/&gt;&lt;/a&gt;
                    &lt;a class=&quot;avatar name&quot; rel=&quot;nofollow&quot; 
                       href=&quot;&quot;&gt;Cody Ray&lt;/a&gt;
                &lt;/div&gt;
                &lt;a href=&quot;#comment-221087159&quot; class=&quot;permalink&quot;&gt;&lt;time datetime=&quot;2008-06-03T21:30:09&quot;&gt;2008-06-03T21:30:09&lt;/time&gt;&lt;/a&gt;
            &lt;/div&gt;
            &lt;div class=&quot;content&quot;&gt;&lt;p&gt;Did you ever put this into your SVN? I can't seem to find it through Trac.&lt;/p&gt;&lt;/div&gt;
            
        &lt;/li&gt;
    
        &lt;/ul&gt;
    
        &lt;/div&gt;



</content>
    </entry>
    
    

    <entry>
        <title>A Curmudgeon Playing with the Zend Framework</title>
        <link href="http://decafbad.com/blog/2007/07/09/a-curmudgeon-playing-with-the-zend-framework"/>
        <updated>2007-07-09T20:21:41+00:00</updated>
        <id>http://decafbad.com/blog/2007/07/09/a-curmudgeon-playing-with-the-zend-framework</id>
        <content type="html">&lt;p&gt;Because it's been awhile since I last surveyed the landscape, I played around a bit with web frameworks this weekend.  Mainly, I tried getting something simple working with the &lt;a href=&quot;http://framework.zend.com/&quot;&gt;Zend Framework&lt;/a&gt;.  After intermittent play and much studying of documentation between Saturday and Sunday, I got to &quot;hello world.&quot;&lt;/p&gt;


&lt;p&gt;Unlike other web frameworks of late, Zend Framework doesn't come with any magical CLI tools to build out directory trees and / or generate code.  Being somewhat suspicious and curmudgeonly about that sort of magic to begin with, this actually struck me as an attractive thing about ZF.  In fact, what I really liked about ZF at first glance is that it's less of a monolithic &lt;b&gt;system&lt;/b&gt; and more of a bucket of parts from a single source that fit together decently.&lt;/p&gt;


&lt;p&gt;And, all my favorite parts are there:  Among other things there's &lt;a href=&quot;http://framework.zend.com/manual/en/zend.config.html&quot;&gt;config&lt;/a&gt;, &lt;a href=&quot;http://framework.zend.com/manual/en/zend.log.html&quot;&gt;logging&lt;/a&gt;, &lt;a href=&quot;http://framework.zend.com/manual/en/zend.controller.html&quot;&gt;a front controller&lt;/a&gt; with &lt;a href=&quot;http://framework.zend.com/manual/en/zend.controller.router.html&quot;&gt;URL routing&lt;/a&gt;, template-system agnostic &lt;a href=&quot;http://framework.zend.com/manual/en/zend.view.html&quot;&gt;view support&lt;/a&gt;, and somewhat non-magical &lt;a href=&quot;http://framework.zend.com/manual/en/zend.db.html&quot;&gt;DB / model support&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;These were all things I'd grabbed from &lt;a href=&quot;http://pear.php.net/&quot;&gt;PEAR&lt;/a&gt; for &lt;a href=&quot;http://decafbad.com/svn/trunk/Cuckoo/lib/MiniFramework.php&quot;&gt;my more recent PHP mini-framework&lt;/a&gt; play, but I figured there should be some benefit from finding them in a unified collection like the Zend Framework.&lt;/p&gt;


&lt;p&gt;The experience was somewhat similar to rolling my own, though.  I stumbled through some docs and eventually found some blog entries and a tutorial.  It's all very loosely-coupled and somewhat DIY, which is actually what I wanted.  The experience has left me wondering if I really &lt;b&gt;should&lt;/b&gt; have wanted it, but I'm guessing it'll go easier from here on out.&lt;/p&gt;


&lt;p&gt;In the meantime, though, I feel like I have a decent grasp on what all those loosely-coupled parts are doing.  I've skimmed through code, traced wires, broken things and watched the errors.&lt;/p&gt;


&lt;p&gt;See, my problem with a lot of modern magic-imbued web frameworks is that I have a deep distrust of what they're doing.  They come with a lot of moving parts doing things that I don't see - and when I do finally see them, I tend to run into decisions with which I disagree.  I see abstraction where I think the gritty concrete needs to be left bare.  I often see lots of astronaut acrobatics that just have to be burning tons of cycles.  I see further acrobatics done to compensate, unrolling loops and pre-parsing config files - which requires further layers of magical tools to generate code and caches.&lt;/p&gt;


&lt;p&gt;Too many moving parts wherein assumptions can hide, later to bite me when we're hundreds of miles into the post-launch desert and trying to fight scaling fires or develop a new feature with some weird angles to it.&lt;/p&gt;


&lt;p&gt;For example, consider &lt;a href=&quot;http://www.symfony-project.com/&quot;&gt;Symfony&lt;/a&gt; for PHP.  Their configuration system runs PHP code that results in YAML.  Parsing that YAML, along with cascading layers of other generated YAML, then drives a PHP code generation stage, composing all the static code necessary to bootstrap the framework with each request.  There's an amazing amount of flexibility exposed by that system, and it's quite clever -&amp;nbsp;but my curmudgeonly side catches whiffs of insanity.&lt;/p&gt;


&lt;p&gt;Maybe that's really the issue -&amp;nbsp;I've been doing this stuff long enough to have written my own one of everything, so I've got my own opinions and I like to have a grasp on everything.  I've written front controllers, templating systems, and model abstraction layers.  I've worked in a half-dozen or so languages doing all the above.  I don't yet accept that web app development has &lt;a href=&quot;http://mengwong.livejournal.com/38969.html&quot;&gt;passed the da Vinci point&lt;/a&gt; -&amp;nbsp;a single developer should be able to grasp the structure of a web framework in mind without getting lost in too many fractal branchings.&lt;/p&gt;


&lt;p&gt;Anyway, I'm rambling like an old grouch, but I think I've reached my point.  Hopefully more actual experimentation soon.&lt;/p&gt;

</content>
    </entry>
    
    
</feed>

