Web Development Essentials – Frameworks
When I talked about Web Development last week, I kicked off with a quick overview of the languages and back-end server architectures you can use to develop your site. While you can develop a site perfectly well using this simple model, when your idea gets more complex you can run into problems, face longer development schedules and end up spending more to get the site fully up and running.
Luckily, there is another aspect to be considered: web application frameworks. They have been around for a while now, but it is only recently that they have really taken off and risen to the forefront of web development. Now, you can barely move for the deluge of frameworks available for every language and platform – which is great for us developers!
What Are They?
If you don’t know what a framework is, then it is a simple concept – they are best described as being like the foundations of a building but translated to the web. They take many forms, but they generally follow one golden rule: to enable you to get your project up and running quickly, easily and with a minimum of fuss.
How they do this is usually through providing you with a library of functions and code which do the common tasks you experience whenever you develop a website, like user authentication systems, database access and visual output production. The whole idea is that you don’t waste your time re-implementing the same features you use on every site you make or that have been done a million times before but only spend your time on what is unique to your project. After all, you don’t see BMW re-inventing the wheel with every new model they release, do you!
First off, there are two concepts which are so incredibly important that I don’t know why so few developers seem to follow them. The first is KISS – Keep It Simple, Stupid. This basically means always resort to the simplest implementation, model or idea. Making things more complicated than they need to be because it is ‘cooler’ or just because you can is a bad idea. All it does is create headaches when things go wrong and ends up stretching your development schedule.
The second is DRY – Don’t Repeat Yourself. This falls back into the code re-use angle for using frameworks. If there is already a session handling routine in existence which fulfills what you need from it, why create it again? The same goes for your database access code, templating systems, everything. If you’ve done it once, you shouldn’t need to do it again.
Model-View-Controller (MVC)
The MVC design pattern (or architecture) is something which has been around in the software engineering world for a good while and is now spreading into the web development world very quickly. The basic idea behind it is that you separate your system into 3 logical components:
- Model – this is the data or information which is to be present in the system, along with any business logic or rules which are to be applied to it. Commonly this takes the form of a database on the web, along with any rules which govern how it is to be treated (i.e. relationships or criteria which must be upheld).
- View – this is the visual presentation of the system. This is easy to make an analogue of with regards to web development, it is essentially the HTML page that the user will be viewing when interacting with the system.
- Controller – this is where most of the donkey work goes on. This is the part of the system dealing with the user inputs and changes to the model most commonly.
You may already be able to see how well this translates to a web project – its easy to see why its popularity is growing. In the end, you can end up with a much more modular system which can be tested, extended and deployed with greater ease than before with the added benefit of greater code re-use (somewhat of the holy grail amongst programmers!)
Frameworks
So, lets get onto the choices you have in this ever growing sector…
PHP
As the most popular web development language in use today, it is no surprise that there is a huge selection of PHP frameworks available now. While it would be silly to present them all, I’ve picked a few of the major ones in the community currently.
- Zend Framework – developed by the company who were behind PHP in the first place, and who contribute a large amount of work to the language, it is a framework backed by possibly the biggest name in the community. It follows the lead of Ruby on Rails and the MVC approach.
- CakePHP – another framework with a large following, it has been shown to be slower than Zend and CodeIgniter but is still very well featured. Again, this is inspired by Ruby on Rails and MVC.
- CodeIgniter – a framework which is designed to be lightweight, fast and generally unubtrusive to the programmer, it is gaining popularity quickly. It really is blistering performance-wise, and its philosophy of not forcing the developer to follow a set design methodology helps it.
Ruby
Ruby is quite possible the source of web frameworks and their popularity: back in 2005 when these frameworks were beginning to take off, there was one dominant player… All the others have followed suit since.
- That player, of course, is Ruby on Rails. The basis for so many frameworks in so many other languages, it has proven itself to be a great tool for developing sites quickly and without fuss and slashing development times. The only downside to it is that performance wise, it is somewhat of a slow poke. Don’t let this deterr you though – for an average traffic site, it is still a perfect match. After all, Twitter relies on it heavily!
- What could be the successor to Rails’ crown is Merb. This framework claims to be faster than Rails, whilst still offering the great Ruby-flavoured taste you and your family enjoy (can gems have a flavour?)
Python
While still a relatively small player in the web market, Python has its followers. Take, for example, Google, who you would be hard pressed trump in terms of sheer web presence – they are using it for their Google App Engine platform, amongst other languages. The only problem is finding a shared hosting package which enables you to use Python, but that situation is changing rapidly, and remember, greater choice is always a good thing.
- Django is perhaps the best known and most quickly evolving framework available for Python currently. A benefit is that it is an entire development platform in one: database, server and framework all bundled into one meaning you can simply install and get developing straight away before deploying to a more traditional architecture, if you wish. Its interpretation of MVC is what they like to call Model-Template-View (MTV).
- TurboGears is a long-established Python framework which is enjoying a growing support base.
- web2py is similar to Django in that it contains all the tools you need for development without any 3rd party toolkits, but is known for its shallow learning curve due to its teaching usage origins.
While this is far from a complete list of all frameworks out there, it does give you a good insight into the sheer numbers of them available. PHP for instance has dozens of them to choose from, and as always with development, it is a matter of personal taste and project requirements which will often make the decision, not just the feature set on paper.
The things that all of them have in common though are profound – they enable the programmer to quickly produce a system which can meet the requirements, and allows for rapid prototyping and generally saves you time and effort. What more could a developer want?
This is a follow-on from ‘Web Development Essentials – What Platform?‘ and is part of a series of articles on Web Development as it stands today.
Links
- A comparison of PHP framework performance benchmarks
- PHP frameworks:
- Ruby frameworks:
- Python frameworks:
Geoff Adams
Programmer, Research and Development









