What I Want from a Web Framework
As of today, it's been exactly six years since I started programming in PHP. When I started, the major players for writing web applications (to the best of my knowledge at the time) were CGI scripts written in whatever 1, mod_perl, and PHP, which was on version 3 and just getting started as a web-development language. PHP was free, open-source, and easy to get running under Apache. PHP also had good library support, which was important for interfacing in a clean way with our database at the time, Oracle 8i. PHP wasn't, and isn't, a framework (as I understand the meaning of the term). Frameworks, (such as the then-contemporary ArsDigita Community System) weren't really an option for us, since we were attacking the massive virtual hosting problem with a single set of PHP scripts that assumed the form of the website in question by, in essence, looking up the hostname in the database and spitting out HTML accordingly. For the problem we were trying to solve (in the way we were trying to solve it), it's doubtful an out-of-the-box framework would've done the trick. Still, by writing what in some sense was a framework (albeit one with an installed base of one system targeted toward a handful of markets), I feel like I have a reasonably well-thought-out wishlist of what I'd like to see if I were creating a new web app from the ground up. So here goes: First off, some prerequisites. Some of these are givens, but others not even longtime players like PHP achieve. But this is a basic list of things that a web language/framework needs to include to even step up to the plate: ease of getting started, cross-platform capability, free and open-source licensing, decent libraries (with some caveats) and built-in support of international character sets.
- If a web framework isn't easy to set up, very few people will take the time to try it. It's precisely the "what should I write this in if I just want to get it running quickly" crowd that is needed to make a language succeed. These quick prototypes often quickly accrete into larger projects, which then turn into companies (cf. PHP, for a meta-example). Also, unless there are obvious and compelling features to make me want to try a framework or language, I'm probably only going to try those that are easy to experiment in.
- Second, good cross-platform support for a language or framework is essential. One of the reasons the reddit guys switched from Lisp to Python was that the Lisp on their dev system didn't match the Lisp on their production system. I like to do development on my iBook, but for various performance reasons, Mac OS X isn't a particularly good server OS yet. So it would be nice to be able to deploy to Linux or FreeBSD for production use.
- A related reason the reddit guys switched was that although there are Lisps that work on both MacOS X and FreeBSD, they are all commercial, and I assume, closed-source products. This ties into ease of experimentation as well. If I need to buy a license or deal with a crippleware free version, I'm less likely to try a product. Also, open source is a pretty-well proven way to develop a platform, if not consumer-oriented software like word processors.
- Library support has historically been quite important as well. I'm on the fence whether an RDBMS is going to be the long-term winner for persistent storage for web apps, but at the moment it's pretty important. And lacking first-class support for things like bind variables is a pretty big unfeature, so the libraries have to be complete and up-to-date. And library support adds the sorts of candy that gets people to try your environment in the first place.
- Lastly, (and I'm talking to you, PHP), transparent and built-in support for international character sets is an important feature. Heck, if internationalization in general could be cleanly integrated into the framework, so much the better.
<? function that_returns_an_array() { return array ('foo' => 1, 'bar' => 2); } echo that_returns_an_array()['bar']; ?>It should print 2 but it doesn't even parse; a little more closure would be nice. Having to type "array" to define a hash is also a little annoying; something that looks a little cleaner couldn't hurt. And I understand functional programming is supposed to have some kind of salubrious effects, so maybe a language that lends itself to functional programming would be a Good Thing. One thing I do like about PHP is it's inside-out nature. There are all sorts of ways to shoot yourself in the foot with this sort of architecture, but it sure helps with point 1 if you can mock up a site in HTML and then add the active portions in place. Related to this, however, is a pet peeve of mine: the profusion of template languages. I can think of three arguments for the existence of templating languages:
- Web designers are scared of programming languages
- We need to separate presentation from content
- Bad people can do bad things in the native language
0 Comments:
Post a Comment
<< Home