Archive - Originally posted on "The Horse's Mouth" - 2012-11-10 18:01:18 - Graham Ellis
When you write web applications, there are many features you'll need which mirror features other people have needed too. Now - there's nothing to stop you writing your own code (maybe in Ruby, Python or Perl) including these features ... but wouldn't it be better to use the feature set that someone else has already written?
A web framework is both the upper layer - the hanger - on which you can hang the code that does differ for your application, and the lower layer - routines that you call to perform common fucntions. Very often, web frameworks use standard classes of objects too, so that you can say "I want one of THOSE, but it has the following differences / extras".
Where the base language is Ruby, the usual framework you'll find is Rails. For Python, Django is very much the most popular at present. With Perl, there are a number - Catalyst, Dancer, Mason, Solstice and Mojolicious for example. For more, see [here] on Wikipedia. PHP is slightly different - but only slightly so - in that a few more of the elements (such as the session handling stuff) is built into the base programming language. The biggest name with PHP is the Zend Framework.
So - what might you find in a Framework?
• A Scaffolding into which you can build your application
• Form helpers
• A model system (in most of them) to let you hold and manipulate databases and easily convert them to and from objects
• Session handlers (in base langauge with PHP)
• Templating systems
• Easy support for model - view - controller architecture
• A Utility application to let you admin / update databases via the web
• Router to map URLs to particular controller / action logic.
We'll introduce you to Django or to Rails at the end of your Python or Ruby course. With Perl, where there's no single market leader, please ask and we can work through a framework with you.
Illustration from last week's PHP course - yes, I've been playing with colour. The coathanger is a historic one, currently on display in the museum