04
nov
2008

Why you should try Django : Agility

Disclaimer: I'm not naive enough to think that Django is for everybody and that's why the title reads 'try' and not 'use'. However, I do think after giving Django a chance and breaking out of your cycle you will be impressed. I also realize due to where I'm aggregated I'm preaching too many of the converted. However, perhaps if nothing else this will help your arguments when persuading others or your work to give Django a go. I'm also going to assume you know nothing about Django or even much about programming. Finally, I write this as I am getting more and more frustrated with having to work in other environments.

Clients often don't know what they want, I think this is a sore spot shared by many web developers. Companies often know they 'want' and 'need' a website but usually they don't know why, what they need or what they can even do. This can make the development process a bit rocky. I've found that often clients start to get a better idea of what they want/need as the development progresses. This is exactly why dynamic, agile development is so beneficial.

So let's set the scenes with a very simple PHP example (purely because it’s what I know best). You have a news posting system, kind of like a simple blog. Its mySQL powered and you have everything working, you can do all the normal CRUD (create, retrieve, update, delete) functionality. To do this you have a bunch of SQL queries, a few different forms made up and its all good to go. The client is very happy however they just realised they need to be able to add a picture to each of the news stories! You of course have not taken this into account, how could you? You didn't know. In this system you would need to, update your database, update your SQL queries, update your forms and form handling code. Nightmare! Now you need to tell the client the news, let them know that it’s not that straight forward and give them a price. This might lose you some business or create an unhappy customer.

Now, take a Django solution. It’s set up with the same functionality and uses a bunch of custom forms and management pages (rather than django-admin). How much of this do you need to update? You first find your model. Add a picture field and assuming you're still in dev with no important data - just drop the database (or modify the tables manually)  and resync then you're done.

How is it so easy?

Django’s ORM creates the database based on the models and handles all the querying of data. If you use ModelForm then forms are created based on the models too and thus updated. The only thing you will need to update is the HTML/CSS to include the picture into your design.

With most frameworks doing such changes would just not be that straight forward and quick!

Of course, if you will often want to do more with picture such as re-size and create thumbnails etc. but this is just a very basic example.

Previous Post: Choice is bad; PHP has too many Frameworks/CMSs
Next Post: Grinds my gears; IE 6 Users

Short url - Related tags: django, mysql, php, python, server-technology

blog comments powered by Disqus