Seriously, Keep it Simple, Stupid

Marketing

Seriously, Keep it Simple, Stupid

Like Scott, I spent last week in Portland attending OSCON. The first session I went to was a joint talk given by Rasmus Lerdorf and Thomas Sha. Rasmus is a Yahoo! software architect and the creator of PHP. Thomas is the head of YUI development. They spoke about strategies for helping Javascript and PHP developers work effectively together. They covered data exchange between the two languages, XSS and XSRF security best practices, and gave a great introduction to the YUI Javascript library for PHP developers wary of front-end coding.

However, what interested me most was the ongoing commentary Rasmus interjected about his own coding style. In between his main points he would show samples of his own code and desire to keeping things as simple as possible. He offered a pragmatic way of coding that really struck a chord with my own style.

I’ve always shied away from large, cumbersome MVC frameworks in favor of my own simple, stripped-down code base. I’ve explored frameworks like CakePHP, Symfony, and Solar, but each time I come away thinking that was a lot of work for very little pay-off. To be honest, I’ve often felt ashamed and a little embarrassed for not using them. So many people do I feel like I must be missing something. But each time I start down the MVC path I quickly retreat when I realize I can accomplish the same thing faster and with less work using my own collection of code.

Only recently have I begun championing my simple development methods. Earlier this year I open-sourced my personal code base on Google Code – calling it the Simple PHP Framework. Let me get this out of the way right now: I only call it a “framework” because that’s what people search for in Google. It’s not a framework – it’s a “foundation”.

Sitening has been using this code internally for our own projects and client work for about nine months. It has served us well, but I’ve been hesitant about publicly announcing it because I still feel the stigma of being a non-MVC programmer – an anti-framework kind of guy. I’m announcing it now because Rasmus’ talk boosted my confidence. He highlighted his own minimal database wrapper  and spoke against automatic code generation – something I’ve long been wary of and a key reason for my dislike of Rails. Near the end of his talk he summed up his (and my) feelings when he said

Doing things my way may not be right for everyone, but I’ve worked on some pretty complex projects and it’s served me well so far.

And so with that said, I’ll make my own disclaimer. The Simple PHP Framework isn’t for everyone. But if you’re a web-design shop like Sitening, with multiple client projects open at once, having a standard development methodology and code base is key. It means any programmer can jump on board and feel comfortable working on an unfamiliar project. An added bonus is the one-to-one relationship between browser URLs and PHP scripts you must adhere to. Not piping every request through a monolithic controller means our designers spend less time worrying about templates and more time building out the HTML they’re so talented at creating. I’ve yet to see a framework or CMS that offers a work flow as natural and easy to use for designers.

You can check-out the latest copy of my PHP framework with SVN using the command below:

svn checkout http://simple-php-framework.googlecode.com/svn/trunk/ framework

For more info on Rasmus’ anti-framework thoughts, here’s a blog post he wrote on the subject.

Related Posts Plugin for WordPress, Blogger...

Tell us what you think

  • http://adastrasystems.com Mike Pritchard

    Thank you so much. I feel that same way, what is it with all these php frameworks? They are hard to maintain, sometimes hard to upgrade and page loads are slower. You also make scalability a tougher problem to deal with, which is a real headache. I know most of these frameworks have caching, but that’s just a band-aid trying to fix the inherent problem of using a complicated and bloated back-end that will always be slower. The first rule of engineering is KISS, which is the most violated rule in engineering.

    I just wrote a blog post (http://adastrasystems.com/2010/05/19/symfony-and-php-frameworks/) before I found your article, nice to find a kindred spirit!

  • Matt

    Sorry about all that, please disregard those posts; I’ve realized that WEBROOT() is indeed correct and it wasn’t working because I was trying to use the framework on a local server in a subdirectory, with something configured wrong.

  • Matt

    My code was cut off, I’m assuming for security reasons, but I’m sure you realize what I meant.

  • Matt

    It seems to me that in the latest version of your framework, the calls to WEBROOT() in index.php should instead be DOC_ROOT, i.e.:

    This is how I got it to work, at any rate.

  • http://clickontyler.com Tyler Hall

    @Matt

    The Framework leaves it up to the programmer to separate content from logic – if they want to.

    Personally, I use an *extremely* loose MVC architecture in most of my projects. Full blown MVC is fine – but I find it overkill for most small to medium sites.

  • Matt Browne

    Hi, I was wondering if there’s any way of separating programming logic from content in your framework, or do you leave that up to the person using it? What do you do? I generally like using the MVC pattern at least somewhat loosely as recommended in this “PHP Best Practices” article: http://www.odi.ch/prog/design/php/guide.php. (Of course I have adapted his recommendations quite a bit.) I definitely like the idea of keeping things as simple as possible, and I totally agree about most frameworks being overblown.

    BTW thanks a lot for your DBObject class; it’s been very helpful. I’ll have to check out the new version.

  • http://www.sitening.com/ Tyler Hall

    Even when doing low level coding in PHP, there are still many similar problems that you have to solve from project to project. That could be user authentication, building an RSS feed, or even the directory structure of the site itself. The point of the Simple PHP Framework is to take care of the low level commonalities so you can focus on building your app rather than its structure. You can pick and choose which pieces of the framework you want to use with your code. It’s up to you to use it a lot or just a little.

  • http://www.chrisranjana.com Web developers

    “If you’re looking for a framework that will hold your hand, generate code, and wrap everything inside a happy little object then you should look elsewhere. But if you want a framework that will get rid of the grunt work and get out of your way you’ve found it.”

    That is the explanation I found for this framework. Then why bother creating a framework at all. We could very code directly using php :)