
I've been a PHP / MySQL developer for almost a decade now and I like it a lot. I think I could probably do just about anything you can imagine or have seen on the web in PHP / Mysql. I haven't been looking for a change, but part of being good at anything in life means keeping an open mind and thinking critically. In trying to keep an open mind, I read and keep up with the latest news in web development. Unless you've been living in a cave you've probably heard at least something about Ruby on Rails. Ruby on Rails has been making a ton of news lately in the web development community. And in case you don't know, Ruby on Rails is a programming framework for the programming language Ruby.
Also another programming framework that is making some buzz in the community is Django. Django is a programming framework for Python that I first heard about when I read the news on Simon Willison's blog that Django was going to be released as an open source framework.
So trying to be the open minded critical thinker that I am, I thought I would give both of them a try. I tried Ruby on Rails first by working through a tutorial they had which walked you through making a simple to-do application. I admit that I'm no guru after working through one tutorial but I do have some initial impressions which might be of interest to people thinking about Rails or Django.
First of all the installation process was a little tricky since in order to get Rails to work with Apache 2 you have to install FastCGI. After the install the tutorial was pretty straight forward and Rails did a lot of the tedious reparative tasks for you, which I liked. However, after finishing the tutorial I felt like the overall application was sluggish. I'm sure a lot of this has to do with the fact that Rails uses FastCGI instead of a module for Apache like mod_python and php4_module. I've heard but haven't experienced it first hand that Rails is a lot faster when you use LightHttpd instead of Apache 2. But for me that wasn't an option because I already had a lot of applications on my server that were dependent on Apache and I didn't want to run another web daemon on a different port on the same server.
Just recently I've been trying Django. I just finished part one through part four of "Writing your first Django app". I have to say that so far I'm really impressed with Django. It seems a lot more logical and seems to mesh more with my programming philosophy. The programming workflow and Django's stack just seem to make more sense. Not only does Django seem to make more sense, it's a lot faster than Rails when used with Apache 2. I don't have any benchmarks to prove it but you can just tell by the feel that Django's tutorial poll application is faster than Rails's tutorial to-do application.
Another main difference between Django and Rails is that Django uses Python and Rails uses Ruby. So what does that mean? Well if you like Ruby you're going to want to use Rails and if you like Python you're probably going to want to use Django. But what if you don't know either Python or Ruby, what then? You'll need to do some research or just take my word for it that Python is better! Python is stricter in the way that it does things, like being whitespace sensitive for example. Being whitespace sensitive means that it delimits blocks of code by line breaks, other programs like Java, C++ and PHP use curly braces to delimit code blocks. In the online book Dive Into Python, Mark Pilgrim puts it this way, "After some initial protests and several snide analogies to Fortran, you will make peace with this and start seeing its benefits. One major benefit is that all Python programs look similar, since indentation is a language requirement and not a matter of style. This makes it easier to read and understand other people's Python code."
One of the other features and main differences between Rails and Django is that Django has an "Automatic admin interface" which you can either take it or leave it. But if you want the automatic admin interface it's there to use, and guess what? It's not crap! It's actually pretty detailed and even styled. Having an automatic admin interface can cut down on building web applications like content management systems and blog applications. And what I found really cool about the admin interface that comes with Django is that it doesn't look like something your PhD math professor designed. It's actually has a nice detailed clean graphically designed interface.
If you can't already tell my preference is defiantly swaying toward Django. The final catalyst that made the pendulum sway towards Django was listening to a three hour Snakes and Rubies presentation where Adrian Holovaty (one of the creators of Django) and David Heinemeier Hansson (the creator of Rails) both present their frameworks and then answer questions from the audience. In my opinion Adrian's presentation was far superior to David's it wasn't even funny. Adrian's presentation was very logical in that he explained the Django stack so that you could follow Django's workflow for creating applications. David's presentation on the other hand seemed to be in no particular order and very unorganized. Not to mention that David's over all demeanor was very cocky and arrogant which was a major turn off. After hearing both presentations and the questions that followed it felt very clear to me that Django is definitely the framework for me. Its overall philosophy goes with mine, it uses Python which I like more than Ruby and Django's workflow and stack seem a lot more simple and logical than Rails.
Currently I'm now planning to finish reading Dive Into Python and the Django documentation and then move on to rewriting this blog using Django which is currently using PHP and my own PHP framework that I wrote.
If you're bored with PHP and need a change, give Django a try! What's the worst that can happen, you broaden your knowledge base and become a better PHP programmer (or whatever you use) because of it?
del.icio.us
digg
newsvine
blinklist
magnolia
Please be considerate of others. Keep comments relevant. Content deemed inappropriate or offensive may be edited and/or deleted. Email addresses are never displayed.
Line breaks and paragraphs are automatically converted — no need to use p or br/. Quotes, apostrophes, and double-dashes are automatically converted to smart punctuation. Be careful when copying and pasting portions of entries or other comments.
Links can be created using the standard <a href="http://url">urlName</a>. The following inline HTML elements may also be used: strong, em, cite, & code. The title attribute is allowed within any element. All other code will get removed before posting.
Comments
Nice post, Brent!
I nearly spit my coffee on my screen when I read that. Thanks - and welcome to the Django community!
I haven’t looked into Django much mainly because I attached myself to Ruby. Ruby feels like I am speaking English instead of programming, which I find very attractive. I have chosen Ruby and Rails, but that is not to say that I am not going to also look into Python and Django. I’m addicted to indention so in that respect, Python is intriguing.
cu
Sebastian
Btw, very nice comparison, the best i’ve read so far!
cu
Sebastian
However, the buzz around RoR is so big, I sometimes feel I’ll be left behind if I don’t jump on the RoR bandwagon. I’ll be honest, the Ruby syntax is different enough from other languages that it puts me off a bit. I’m going to give it a few more tries, maybe it will grow on me.
and also not too mention rails fanatics are mocking other frameworks (especially in PHP) in any occations.
FYI, here is a performance benchmark comparison of the three frameworks/platforms:
http://wiki.rubyonrails.org/rails/pages/Framework+Performance
I was contemplating learning a server-side platform, and I think I will go with Django/Python.