What’s needed to fall in love with a (web) framework?

Published on and tagged with framework

In a recent comment TheIdeaMan wrote: “I’d love to see a post from you on your top 10 “must haves” for the new framework.”

I thought a while about this, and tried to come up with such a list. Without luck. Not because there are no “must haves”, there are, but because the most important points are fuzzy and difficult to describe.

If I look back at the time when I decided to use CakePHP, it seems quite irrational that I have chosen CakePHP as my main framework. The only constraint was PHP4 support (though the only project that required it died shortly after the decision *g*). On the other hand, CakePHP contained only a fraction of today’s features, it was very buggy, there was no documentation beside the blog tutorial, and only a few people used it. And still, I liked it, and spent a lot of time with it.

Now, some years later, I’m more conscious about my own values, and so I want to use a framework that’s more aligned with those values. As I care about software design and good code, I want to see those things in the framework I use. And because details matter to me, the framework developers should also care about details and not only “make it work”.

So, in a nutshell, my top “must have” for a framework is a development philosophy that strives for the following topics:

  • Good design
  • Good code
  • Caring about details

However, there is one point which is even more important than what I listed above: you must like the framework. It’s that simple. The best framework is worthless if you don’t like it. Or do you really want to spend much time with something you don’t like?

14 comments baked

  • Dieter@be

    Other then the stuff you already mentioned, I appreciate “overridability/mutate-ability” eg flexibility to easily change things you don’t like in little-code but powerful ways, even core parts of the system if you need to.
    I also appreciate frameworks who really try to enforce tight principles (but good ones!)

    Cake is pretty good at both of these, though I don’t have much to compare to.

    Another thing I find very important: a framework (and more so it’s api) should be kept as simple as possible. I think cake scores worse at this: sometimes I think they make very simple operations like comparing strings or setting some options very complicated with the arrays stuff. It’s also often a lot to remember. (or are there IDE’s out there who can tab-complete cake’s arrays? )

  • dr. Hannibal Lecter

    So what you’re trying to say is that frameworks are like women? :-)

  • cakebaker

    @Dieter, Hannibal: Thanks for your comments!

    @Dieter: Yes, I agree with you, an API should be as simple and intuitive as possible. And Cake’s API resp. the API docs could be improved in this regard.

    I don’t think there is an IDE out there which can tab-complete cake’s arrays.

    @Hannibal: Yes, there are quite some parallels ;-)

  • titang

    I used to work with cakephp for almost 2 years. Recently i changed company, and i have to use another framework.
    Well i can compare both, and i can say CakePHP is really good.
    – Simple to use and to understand
    – Simple file structure
    – Very intuitive
    – Less configuration and more convention

    I find some good features in the other framework, but I still prefer cakePHP.

  • Brandon P

    I feel a framework shouldn’t just use good code design itself, it should require it from developers who use the framework. A framework should provide the developer with ways to do common tasks correctly (not just quickly). With regards to CakePHP, there are a lot of tempting ways to do things “dirty” that (I promise) will lead you down a road of coding hell.

    For instance, getting direct access to the DB from anywhere – yes, ANYWHERE within an app:

    $ds = ConnectionManager::getDataSource(‘sourceName’);

    EEK! That’s scary from many perspectives!

    Personally, I see frameworks that emphasize rapid application development (aka “RAD”) as a step sideways. For those developers who use these frameworks for something bigger than a blog or CMS know that your time spent in development pales in comparison with the time you will spend in maintaining and continued development an app.

    Many frameworks emphasize the idea of “Develop an app quickly” over “Develop an app correctly” but luckily I have enough sweat equity in this arena to see through the “cool features” of frameworks and look at the core code to see how solid.

    Compare CakePHP and Zend Framework’s core libraries. It becomes painfully obvious in the first 20 minutes which package is better managed, designed and coded. And to me, that’s what’s most important.

  • cakebaker

    @titang, Brandon: Thanks for your comments!

    @titang: I only partially agree with “Simple to use and to understand” and “Very intuitive” ;-) Though those statements are true for many parts, there are also parts that are not that intuitive (e.g. Auth component).

    And yes, in the end it is a matter of preference which framework you prefer.

    @Brandon: Yes, I agree with you, a framework should encourage and support the developer to come up with a good design.

    Yes, it’s not that clean that you can access the DB directly from anywhere, though it is a direct consequence of the design. And it is up to the developer not to use it anywhere ;-)

    Yes, maintainability and extendability are often more important than rapid application development. And those points are usually the result of “slow” application development, because good design takes its time.

    And yes, the core code of CakePHP and ZF are very different worlds ;-)

  • TheIdeaMan

    @cakebaker Thanks for following up my comment with a blog post. You’re “wishlist” is good, if a bit broad. :) A friend of mine recently posted a review of the Recess! Framework that was mentioned in the post I originally commented on:
    http://blueparabola.com/blog/rest-recess-framework

    The wishlist at the bottom of that post is more what I’d hoped for, but in that case it’s very focused on the REST architectural style. I look forward to hearing more about your journey to finding the best framework for your needs. It’s one I think we’re all one whether we’re writing them or improving them through our reviews, tutorials, or gripes. :)

    Thanks again for your blog and this post.

  • cakebaker

    @TheIdeaMan: Thanks for your comment!

    Yes, my “wishlist” is a bit broad because I consider most features as “nice-to-have” and not as “must-haves”. If I look at my current usage of CakePHP, then there are only a few things I really need: ORM, MVC, clean urls (routing), and the CSRF prevention by means of the Security component and the Form helper. Everything else is “nice-to-have”.

    And yes, it is a journey every developer is on, and it is not limited to finding the best framework. The same also applies for finding the best IDE, the best version control system, the best xy…

  • David

    Hi, I would like to add some “humans” value to your wishlist. For instance, what I am(was) looking for into the CakePHP framework is a pedagogical value ==> means I want to be able to code better after I understand how the whole thing work.

    And that’s what I’ve found some years ago. I really appreciate a framework that forces me to have good practice. I’m a trivial programmer and I did learn a LOT with this framework. T’was not always clear or simple, but made me Think ! ==> Why is that happening that way.. uh yea.. ok, I see….

    :)
    my two cents

  • RainChen

    I’m working with cakephp for almost 1.5 years. I don’t think Cake is the PHP framework I’m looking for. Because I’m also a Rails user. I trie to make Cake to work as Rails do,but I false. IMOP, Cake is at most 20% power of Rails v1.2.3 (and newest Rails is v2.2 ). So I start to look around, check out some others Rails like php frameworks. I found Akelos , very similar to Cake,but more close to Rails.At least Akelos’s ActiveRecord supporting is much better than Cake.

  • cakebaker

    @David, RainChen: Thanks for your comments!

    @David: Yes, that’s a good point. A framework should support you to become a better developer. And in this regard, Cake does a relatively good job.

    @RainChen: If you are looking for a Rails-like PHP framework, then Akelos is probably the better choice than CakePHP. Akelos claims to be a Rails port, whereas CakePHP is “only” inspired by Rails. And yes, Cake is much less powerful than Rails…

  • David

    You could start a new blog describing what is the (your?) definition of the “power” of a framework.
    Where, what, etc. ;)

  • taylor.luk

    Recently fall in love with Maintainable Framework, let me keep pretty much all the rails mindset when coding for PHP projects..

    – Good design decisions for PHP (array shortcut, short open tag)
    – Good code base
    – Solid ORM implementation (object instance, STI, has_many :through)
    – migrations and yaml.
    – I think its way faster than Cake because Cake’s naming convention and class loader slower it down where Maintainable uses much simpler class loading

  • cakebaker

    @David: Thanks for your idea for a future article!

    @Taylor: Thanks for mentioning the Maintainable Framework, it is the first time I hear about it. On a first glance it looks very nice, I have to investigate it further.

Bake a comment




(for code please use <code>...</code> [no escaping necessary])

© daniel hofstetter. Licensed under a Creative Commons License