bentomas.com

Designing a new web framework

I’m on a bit of a server side javascript kick these days. And by “kick” I mean that I cannot stop thinking about it. I have decided to build a small tool (for me and my fiancé) in javascript, and more specifically, using a library called node.js.

If you look at the example code (on node.js’ homepage) for a webserver, you can see that the API is quite primitive. And this is on purpose; to quote:

In order to support the full spectrum of possible HTTP applications, Node’s HTTP API is very low-level.

Because the HTTP API is so bare bones, I have decided to build a mini-framework on top of it1. What do I mean by “mini-framework”? Well, I mean that it will be something I will tinker around with in my free time, it probably won’t ever be finished, and will probably only ever be used by me or maybe some friends. What I don’t mean by that is something that is half-assed or small in scope. I’m dreaming big here people!

Why build Yet Another Framework? Well, mostly because I like building things. And partly because it is through trying to do something myself that I begin to understand it better. And then additionally, I have small complaints about the popular frameworks out there (And of course I can do it better).

When in the dreaming stage of a project, I like to look at what else is out there for inspiration. I have used three major web frameworks: Rails, Django and Joomla (which, yes, I realize is technically a CMS). I don’t like Joomla at all, so this is the last you will hear of it. But I do like both Rails and Django quite a bit. My experience with both of them is limited to small, simple websites and I have not really ever worked with the source code for either of them. So, take these thoughts as coming from someone who might not really know what he is talking about.

Anyway, without further ado, my thoughts on Rails and Django2.

What do I like about Rails?

What don’t I like about Rails?

What do I like about Django?

What don’t I like about Django?

It’s interesting that I have a lot less things I don’t and do like about Django than Rails. Strangely enough, that alone sort of summarizes my feelings about it.

So what does this all mean? Here is what I want from my javascript framework:

I also have some ideas on an ORM and templating language, but I’ll save those for another post.

And that’s all I have for now, but as I start playing around, I’ll try and post more detailed thoughts on individual parts of the process.

  1. Like apparently everyone else on the face of the planet: Djangode, Express, Coltrane, Vroom, node-router, etc.

  2. I’m sorry if it seems like I am ragging on these projects or dismissing them as trivial. I don’t mean to do that. Both Django and Rails are amazing frameworks that have changed how I develop websites and how I think about writing code in general. I’m trying to be _con_structive here, rather than _de_structive.