The Web Squeeze: Django Vs Rails - The Web Squeeze

Jump to content

Forum

Ruby/Ruby on Rails

Ruby on Rails help forum for members interested in learning best ROR coding practices and how this scripting language speeds up the process of creating data-base driven websites.
Digg Del.ico.us Slashdot Technorati furl Reddit Facebook Fark Google Magnolia Wink Yahoo Netscape
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Django Vs Rails

#1 User is offline   Jason Icon

  • Master of the Universe
  • Icon
  • Group: Mentor
  • Posts: 2,533
  • Joined: 15-February 08
  • Gender:Male
  • Location:London, England

Posted 06 June 2008 - 08:05 AM

So, as far as I understand it both are about the same but in different languages. I am going to learn one of the two. Does anyone know the key differences between the two frameworks?
0

#2 User is offline   Rakuli Icon

  • Community Director
  • Icon
  • Group: Community Director
  • Posts: 1,378
  • Joined: 13-February 08
  • Gender:Male
  • Location:Catching the squeezed drips downunder.

Posted 06 June 2008 - 10:14 AM

The differences are substantial but the the differences are also quite small :)

Django is a Python framework and Ruby on Rails is, suprisingly enough, a Ruby framework.

Before looking a the frameworks themselves it's probably good to consider the languages behind them. Python is the older language having originally been released in 1991 and Ruby was first put out to the public in 1995. This makes both Python and Ruby quite old in terms of programming languages and as they are both Open Source, they have a committed and enthusiastic community supporting them.

Ruby resembles Python in many ways in both syntax and programming procedures and both languages are completely Object Oriented. Every variable you create or use is simply a reference to an object. This also means that variable typing becomes an issue in both languages with varibles requirind conversion before being used as a different data type (an integer needs to be converted into a string before you can concatenate it to the end of a string literal). For me, this was one of the harder things to grasp coming from a large experience with loosley typed languages like PHP and Javascript. Python also uses whitespace in its syntax which confused the hell out of me originally before realising that this is a very good thing. When writing an IF statement, the next line must be indented. This makes for great readability in the script and a lot less curly braces.

Now, the frameworks themselves starting with the similarities:

  • As is the case with most server-side web frameworks, both Django and RoR implement their own versions of the (Model, View, Controller) MVC method of project development. This is a popular Object Oriented approach whereby the Model (data, usually dynamicall created based on the database being used in the application) is kept separate from the View (What the end user sees) which is also kept separate from the Controller (The object methods that process and manipulate the Model before passing to the View). Django uses a slightly different naming convention renaming the View to template and the Controller to View essentially implementing the (Model, Template, View) MTV. In a nutshell the development is the process of creating some class Models and pointing them (or having the Framework create and then point them in the case of Django) at the database that their properties will be filled by, writing the Controller logic that processes that data and loading the processed data into the view for display.
  • Both frameworks are great for rapid development taking the lower level operations out of your hands and letting you write the high end logic
  • It is hard to find hosting that supports them. Usually a host with Ruby &/or Python is more expensive as it takes a slightly more advanced knowledge to set up (you won't get Ruby or Python on a $10 a year package -- if you can though let me know :) )


That's a small set of the similarities, now for some of the differences.

  • RoR takes many fewer lines of code as it is a very "magic" framework that uses assumptions and specially created logic to help you out.
  • RoR is a little faster to deploy, getting Django running remotely on your host can be a touch trickier
  • From my view, RoR is less portable. Django enforces an app/project approach. You have a project, but within that you have many smaller applications. These applications are self contained little programs that can be picked up and dropped in somewhere else. Because of this there are many, many useful pre-written applications that you can include into your own without having to change a line of code.
  • Django has, quite simply, the best dynamically created administration panel I have seen in any framework. The whole admin backend is created on the fly in Django giving you a quick interface to fill your site with content. You can of course customise is easily with a few lines of code in your Models.
  • Django's documentation is impeccable. If you find an error or something missing you should probably win a prize. If that's not enough the Django userbase is almost fanatical in their support for the framework sometimes to the point of intimidation for newer users but such dedication is very useful.
  • Ruby's documentation is also fantastic with a large use of screencasts and videos to introduce new users. I haven't had much to do with teh Ruby community but I assume that they are as avid as Django's



From where I stand, I am currently loving Django but I would dearly love to give RoR a harder workout if only my host supported Ruby. As to which is the better framework? I think that this is one of those questions that cannot be answered. I reserve my judgement indefinitely because both offer many possibilities.

You can set both Django/Python and RoR up on your linux, windows or mac box so I recommend burning through a couple of tutorials in each to see how you like them.

Hope I helped a little.

#3 User is offline   Jason Icon

  • Master of the Universe
  • Icon
  • Group: Mentor
  • Posts: 2,533
  • Joined: 15-February 08
  • Gender:Male
  • Location:London, England

Posted 06 June 2008 - 10:48 AM

Thanks a lot. That is very interesting. I am going to be learning RoR but before I started I wanted some idea on what I would be missing out by ignoring Django.

It was as I suspected. Both are very similar albeit them using different languages. The differences are somewhat minor. The portability is definitely a plus point for Django but I have sampled RoR magic and my face lit up with delight. Based on what you have said it seems very much down to personal preference.

Site5 supports both Python (So I assume that means Django as well) and RoR if you are looking for a webhost. If your quick you can get it for $5 a month.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


Page 1 of 1
Trackbacks
Trackback URL Trackback Date Total Hits
No trackbacks were found
Page 1 of 1

Similar Topics
  Topic Started By Stats Last Post Info
New Replies Icon Do You Use Ruby On Rails? Jason Icon
  • 12 Replies
  • 2,293 Views
New Replies Icon Django / Python
What is it?
Jacob Icon
  • 11 Replies
  • 1,954 Views
New Replies Icon Django Book unitedcraig Icon
  • 1 Replies
  • 1,123 Views
New Replies Icon I'm Stealing Justify's Idea And Learning Ruby On Rails Jack Icon
  • 9 Replies
  • 2,131 Views
New Replies Icon If You Were Only Thinking About Django -- This Should Convert You
Especially if you're a pony with magical powers
Rakuli Icon
  • 6 Replies
  • 1,488 Views

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users