Web Application Frameworks

So, you want to write a web application, and you’re looking for a framework?

I bet you don’t. I bet what you are really trying to write is a fancy CMS. “Wait!”, I hear you cry. No, you wait…this is my post.

Let me explain what I mean by CMS (Content Management System): it’s a system that is involved in moving some content from some users to others, where “anonymous” is also considered a user. Often, the ability to integrate mail (being able to send mail in and most importantly to get mail notifications) is also considered a part of CMS.

Where does that leave us? Facebook: a CMS. Twitter: a CMS. Livejournal: a CMS. Gmail: a CMS. Google Search? Nope, that’s not a CMS: that’s an actual web application. It gets input, it runs some code, it shows output.

Ever wondered why ORM is so popular in “web applications”? Because when you’re primarily moving content about, describing that content is a really important part of the equation.

CMSs are basically about communication. This is why they are so popular: people enjoy to communicate. A lot. (Hey, people reading my blog!)

That’s fine. If you wanna write a CMS, go ahead. Use Django, or RoR or whatever. I bet some of these are better than others — but because I have no experience with CMSs, I cannot give good advice on that topic.

If, however, you want to write an actual web application, not a fancy CMS, what will you use? Certainly not Django or RoR. That helps you very little. Yes, it’s got “a request object” (that wraps around 3 WSGI objects/methods). It’s got a “dispatcher” (how long would it take you to write something that maps URLs to code? 5 minutes). And it’s got a templating system.

But here is the point — I don’t know if Django’s templating system is any better than any other. I’m not a fan, of course — I would use Nevow’s template, or perhaps ZPT. But templating is really about choosing a language, so arguments tend to be almost purely emotional here.

So what’s an example of a web application? Well, let’s enter my mind for a minute, and see what we find. These days, I’m involved with AppSpeed, an application-level performance monitoring system. It’s an application that helps you monitor your performance. But it’s not out yet, so let’s look at other things in roughly the same category: managing your wireless router. It’s about the same general niche — data center management. Except this is about the tiny data center you have in your house.

The requirements for both are the same — we want to use the web application to *understand* and *control* what’s going on in the infrastructure. There’s no ORM: if you’re keeping data, be it configuration, logs or history, you already have that choice before you started writing the web part.

So, given that dispatch is trivial, and the ORM is irrelevant, you need to choose two things: a templating system, and a JavaScript framework if you will use any AJAX at all. Templating systems are a dime a dozen, and JavaScript frameworks are likewise — and any combination works more-or-less as well as any other.

So, what’s my point? Web application frameworks are really CMS application frameworks. If you want to write a CMS, go ahead — it might get popular and worth billions of dollars.

But if you write a web UI for a non-CMS applications, just choose a random templating system, and enjoy…as long as you remember that any commonly-known wisdom about web application has a good chance of not applying to you.


5 Responses to Web Application Frameworks

  1. Michal Pasternak says:

    There’s just one bit missing. No matter what templating system you choose, most of them either are new languages actually or try to re-implement Python by mixing Python syntax with HTML! Look: Mako? Check for-loop in first example on homepage here http://www.makotemplates.org/ . Genshi? How about a different for-loop syntax? http://genshi.edgewall.org/wiki/GenshiTutorial#MakingtheApplicationDoStuff . Jinja? How about some if-else constructs RIGHT in the ugly HTML language, but let’s surrond them in closures this time http://jinja.pocoo.org/2/documentation/tricks#id1 . t

    Some people say Divmod Nevow is not as popular, as other frameworks, because of the documentation, or lack of it. I think it’s not true. Most people using web frameworks want something like PHP or even Smarty (which is actually a worse-than-PHP retarded language written in PHP); they are not interested in learning something new.

    {$if post_end==True}

  2. moshez says:

    I agree, most templating systems are horrible. I think Nevow, and to a less extent ZPT, stands head-and-shoulders above the pack by forcing the real code to live in a real programming language. Something like Enhydra’s XMLC is also better than the common alternative — merely making a version of the HTML page available as an object and letting us manipulate it in code (so XMLC is a little like DOM done slightly less terribly)

  3. I hate Django and I use it every day (and pay the bills with it every month). I completely agree on the framework issue from every technical aspect. And those are the important aspects to consider (the technical ones), right?

    Unfortunately, my clients often swap “Python” and “Django” in conversation, because they don’t even realize there is any difference. You see where I’m going with this? I need something to sell and I can’t sell “I’m going to grab this template engine you didn’t hear of and a specialized JS library I read about on Ajaxian the other week.” But, I can sell a brand.

    The brand is a magnet and I use and contribute to the 3rd party apps as often as possible. Despite my deep seeded complaints of Django, the application landscape is fantastic. Of course, this also helps when hiring. If I’m bringing someone on for myself, I can understand a good developer from a bad developer (more or less). When I can only influence the client about additional consultants to bring in, either we have a brand to filter or, as far as the client is often concerned, a PHP guy is as good as anything else.

    Frameworks provide a lot to blog about, and a lot of parts to reuse, and metrics for comparing resumes in some cases. We can talk and write a lot about how they don’t really provide a lot of technical value, but then we’re just forgetting how much of this job is about social engineering.

  4. Hm, I think I may have heard this rant in person not too long ago 🙂

  5. For 3 years I have been using web.py (http://www.webpy.org) and its default template engine and I am quite happy. Especially now after discovered the ‘–compile templates’ option which compile the templates into a python bytecode module which speeds up the whole rendering phase.

    I guess I am not fan of the ORM concept.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: