A Brief Introduction
Django and Ruby on Rails are both excellent web frameworks. They are the source of power for many of the powerful websites like Github, Soundcloud, Bitbucket etc.
Django, based on python, came out in July 2005. It is a powerful framework following Model View Template architecture, powering websites like Bitbucket, Instagram, Pinterest, NASA etc.
Ruby on Rails, based on Ruby, came out in February 2005. It follows Model View Controller architecture. It is being used in many of the top websites like Github, Soundcloud, Hulu, etc.
I will be comparing Django and Ruby on Rails based on following criteria:
- Market Share
- Job Trends
- Technical Aspects
- Available Documentation and Tutorials
- Popular Websites based on these frameworks
#1 Market Share and Trends
Owing to its quick mutation and initial startups based on it e.g. Twitter, Rails attracted a large share of web developers.
Django on the other hand, despite its power, wasn’t quick enough to evolve and thus lagged far behind Rails.
In terms of numbers of websites
, Ruby on Rails towers over Django. According to similartech.com
, as of August 2016, Rails powers over 1.8 million websites
whereas Django is used in a little over 93k websites
Inspecting further, here is a comparison of categories of websites where these frameworks are being used:
Verdict: Ruby on Rails is the clear winner considering market share and trends among web developers.
Though Django is equally powerful, efficient and is coming into trends lately, it still has a lot of catching up to do.
#2 Job Demands
Since Ruby on Rails dominates the market share of websites, it also dominates the job share in web development sector.
There is a huge demand of Ruby on Rails developers as compared to Django developers.
Since Django is catching up with Rails and increasing its share in the number of websites. So, the demand for Django developers is very likely to increase.
Verdict: Ruby on Rails edges past Django in terms of Job demands too. But the growth of Django in web market share is likely to increase demands for its developers.
#3 Technical Aspects
Architecture and Design Principles
One of the main differences between Django and Ruby on Rails is that Django uses MTV architecture while Rails uses the MVC architecture.
MVC stands for Model View Controller.
Model represents the data in the system/server(usually Database), View defines the presentation of data and Controller is the intelligence and interface between the model and the view.
MTV stands for Model Template View.
Here Model defines the data, Template defines how the data will be presented and View acts as the interface between Model, Template, and the User.
Ruby on Rails follows the Convention-over-Configuration principle.
CoC means no config files, predefined directory structures and using naming conventions.
It features magical
auto imports, auto template naming as well as automatic passing of view instances to controllers.
These features of Ruby helps developers write a cleaner and shorter code.
Due to these magical features and shorter codes, the Rails code might be a little tough to debug sometimes.
Django follows Explicit is better than Implicit principle, a core pythonic principle. According to Django’s documentation:
Explicit is better than implicit means Django shouldn’t do too much “magic.” Magic shouldn’t happen unless there’s a really good reason for it. Magic is worth using only if it creates a huge convenience unattainable in other ways, and it isn’t implemented in a way that confuses developers who are trying to learn how to use the feature.
Basically, a Django project is a collection of many apps. Each app has its own Model, View and Template set, and is responsible for a subfeature of the project.
Django supports a more direct way of coding, defining both conventional and unconventional aspects. Django code is more readable and hence is easier to debug.
Django has Python as its parent language, which is extremely powerful and scalable. Python has tons of modules which can be used in a Django app. It has a diverse community with close ties to Linux. Python is used by companies like Google, Mozilla, National Geographic, etc.
Apart from Django, Python has a number of other web frameworks like Flask
Ruby on Rails, on the other hand, is based on Ruby. Ruby is also a very powerful language with a large number of modules. Ruby uses a magical approach to programming as compared to python which uses a more direct approach. Ruby on Rails is credited as “making Ruby popular”.
Ruby is used by Apple, Twitter, Github, etc.
Verdict: Django and Rails are both equally powerful and efficient. Django is powered by Python , used widely in academia and Linux. So it comes with a large variation of modules and libraries.
While Ruby, which powers Rails is more web focussed, making it more suitable for web app developments
#4 Documentation and Available Tutorials
Both Django and Ruby on Rails has excellent documentations.
Both documentations are suitable for novice web developers with a little background in programming.
Apart from thee official documentations tons of excellent tutorials are available on the Internet.
Few of them are-
Ruby on Rails –
Verdict: Official Documentations of both frameworks are excellent and suitable for novice as well as pros. Ruby edges past Django in terms of unofficial tutorials on the web.
#5 Popular Website on these frameworks