Working with Development Frameworks

I recently had a slap-in-the-face kind of realization moment after getting quite a ways into a project using an off the shelf development framework. In this case the framework in question was CakePHP, and the realization came in two parts:

  1. I realized that I didn’t like the syntax of the framework, even for doing basic things
  2. Because of the fact that I didn’t like the syntax, things that should have been relatively simple were taking much longer than necessary

It was from here that I made the almost hurtful decision to start again, this time building everything from scratch. Now I couldn’t be happier, partly because of the fact that the project itself is going far quicker and easier than before, but also because I know that the usefulness of this framework will go far beyond this project.

You see, now that I have built a framework that jibes perfectly to my programming style, I can apply it to future projects as well. This is how Ruby on Rails started, and I’m sure how most of the popular frameworks started.

Now here is where I throw out a crazy suggestion – I think all developers should have a go at writing their own framework at some stage, even if it never gets into any of their production work. The benefits of this are two-fold – not only will they now have some knowledge of how the inner magic of a framework happens, but they will have a solid base of framework-y functions that they can use in both personal and professional projects moving forward if the need arises. If you are working in a larger team in your professional life, you might even be lucky enough to customize your basic framework as a collaborative effort for a future project.

Don’t get me wrong, I’m certainly not discouraging the use of existing frameworks if they do what you want, I just think that developers should not take things at face value, and ensure they know not only how to use a framework, but also how it does its thing, and from that come up with reasoning on why they are using it.

And for the record – my framework is called Seven, and it’s the best framework in the world, ever…

  • http://kevinlloyd.net Kevin Lloyd

    Being a CakePHP and Ruby on Rails groupie, I’d have to disagree (somewhat) what this suggestion.

    The thing is, these frameworks (most that I know of) are built by teams of developers that have a wide variety of knowledge. For me, there would just be too many things that I would not be familiar with or wouldn’t even think about if I were doing this on my own.

    Don’t get me wrong, for each of the frameworks that I use, I have a vast majority of snippets and libraries that I use. I’m just against the whole starting from scratch thing; it never seems to go well for me.

  • http://www.pantsland.com Brad Kellett

    I can absolutely see your side of it there, any I’m not trying to suggest that someone builds the next Rails, or even something that will work in production situations – but the exercise of mentally breaking down the problem of a framework and building something of your own, even if it doesn’t have all the features of Rails et al, puts you in a much better state to be able to understand how your chosen framework does it’s magic.

  • http://www.uow.edu.au/~kd21 kd

    Well, this is exactly the reason why you’d want an un-opinionated framework like Catalyst, where you get to make the choice of template language, orm and so on.

  • http://fewagainstmany.com Tim

    @brad : I totally agree. One pattern that I’ve seen regularly is:
    1. developer is a beginner, he writes every thing from scratch in spaghetti mode.
    2. developer becomes more familiar with the language, but he still writes everything from scratch
    3. developer becomes experienced, sees the value of using a framework, and now writes everything on top of his/her favorite framework
    4 developer realizes that the framework does way too many things that aren’t needed for his project, and starts writing his own framework inspired by the one he/she’s been using, minus the superfluous features.

    I’ve been there too, and finally settled on a set of open-source modules, that I assemble in my own structure. best of both worlds so far :)