Python vs Ruby
Tags: python, ruby
Published: 2019-11-04 11:54:05

---
title: Python vs Ruby
cover_image: https://thepracticaldev.s3.amazonaws.com/i/e19tluvgj83zu63oeoo2.png
tags: python, ruby
published: true
---
Thinking about enrolling into programming courses? 

Congratulations for making this decision; it is an amazing and a fun road. There are so many programming languages out there; as a matter of fact there are thousands of them, if not hundreds. 

The first and very useful languages are <a href="https://www.ruby-lang.org/en/">Ruby</a> and <a href="https://python.org">Python</a>. They are useful and almost similar in many aspects but they are quite different in many ways. 

The answer to the question of *which one between the two is better* lies in the field and profession where you look forward to pursue. 

<img src="https://thepracticaldev.s3.amazonaws.com/i/e19tluvgj83zu63oeoo2.png" alt="python vs ruby">

So we ask ourselves, how different are they? We can tell their differences by looking at some of these few aspects.

## Community

Both python and ruby command huge communities, each of which determine the direction that each of these languages take. They also determine updates and the way each software is built. 

Python has been used in so many fields of academic uses for example in <a href="https://pythonprogramminglanguage.com/python-machine-learning/">machine learning</a> and for this reason it continues to thrive with this magnitude. 

*Python* commands a larger community than ruby which could explain the reason *it is installed in almost every Linux computer by default*. In the terminal you can just type:

```bash
    ➜  ~ python3
    Python 3.7.3 (default, Oct  7 2019, 12:56:13) 
    [GCC 8.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 
```

For this reason, it is known to be the perfect language for using with Linux servers which are known to be the most preferred to servers in the world.

Since its introduction into the market in 2005, <a href="https://ruby-lang.co/all-you-need-to-know-about-ruby-on-rails/">ruby has been widely used in web development</a> and has experienced more diverse popularity to date. However, it has not come any closer to popularity and usage of python. 

<img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FaBN66chr4Y9na%2Fgiphy.gif&f=1&nofb=1">

## Language

The two languages may seem similar in many ways but when it comes to their usage in solving problems, they are in two different worlds. It is important to note however, none of the two is better than the other. They both focus on different things; 

Ruby stresses on flexibility of the language while python pays more attention to directness and readability of the language.

    #!/usr/bin/ruby
    # Ruby count to 10
    
    $i = 0
    $num = 11
    
    while $i < $num  do
       puts("Inside the loop i = #$i" )
       $i +=1
    end

versus the code in Python

    #!/usr/bin/python
    # Python count to 10
    i = 0
    num = 11
    while i < num:
        print("Inside the loop i = " + str(i))
        i = i + 1

For example, ruby programming language has been used to <a href="https://rubyonrails.org/">build Ruby on Rails web framework</a> while the python programming language has been used in the making of <a href="https://www.djangoproject.com/">Django web framework</a>. 

<img src="https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fcompsci.ca%2Fblog%2Fwp-content%2Fuploads%2F2007%2F04%2Fruby_logo.gif&f=1&nofb=1">

Ruby has been designed in a unique way that makes it desirable for people who are new to programming (<a href="https://ruby-lang.co/">Ruby tutorial</a>) . It is flexible in a way that allows programmers to perform so many small tricks when making a web. 

While this may seem and feel magical, at times it becomes a real problem especially when they trying to trace the source of bugs. The same flexibility that makes it easy in web designing also makes it hard for debugging.

<img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ftechendo.com%2Fupload%2F000%2Fu1%2F8%2F6%2Fwhat-is-python-programming-language-photo-normal.png&f=1&nofb=1">

Python on the other hand takes a different approach when it comes to development (<a href="https://pythonprogramminglanguage.com/">Python tutorial</a>). It is basically aimed at making everything visible to a programming student, unlike ruby, which is primarily aimed at making things elegant. 

Python bypasses this elegance when designing a web but it becomes so easy to work with, when it comes to performing tasks such as coding and debugging effectively.

## Web frameworks

The process of learning how to design modern web applications is not easy. Thanks to ruby, it is now an easy  and fun encounter since it encompasses everything you  need to learn in order to achieve this; by <a href="https://rubyonrails.org/">use of ruby rails</a>. 

This is open source software, which means it is not only free but it also makes it possible for programmers to make it even better by contributing codes to it. 

Research shows that more than 5,000 people have already contributed codes to rails; hence you too have a chance to become one of those. Ruby operates on a repository known as rubygems.

### Python Django

<img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fwww.ostechnix.com%2Fwp-content%2Fuploads%2F2016%2F05%2FDjango-Framework.png&f=1&nofb=1">

Python on the other hand relies on <a href="https://www.djangoproject.com/">Django as its web framework</a>. This framework encourages clean and pragmatic fast web development and design. 

It alleviates much of the long processes of web development, hence making if a faster option when it comes to developing applications and websites. 

Unlike with ruby on rails, Django pays more attention to security, probably the reason it is more popular among programmers. Just like ruby on rails, it is also an open source software which means it is free and you can contributes codes to it, to make it even better. 


### Python Web Frameworks

Except for Django, Python has many other web frameworks like <a href="https://pythonbasics.org/flask-tutorial-hello-world/">Flask</a>, <a href="https://bottlepy.org/">Bottlepy</a> and others.

The advantage they have over Django is that they are more lightweight. You can quickly fire up an app, add whatever database you want (SQL queries, ORM or other) and get started faster.

### Ruby Rails

<img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ftse3.mm.bing.net%2Fth%3Fid%3DOIP.pVwCUKP74pg3-slSdZioMwHaFQ%26pid%3DApi&f=1"> 

The <a href="https://rubyonrails.org/">rails framework of ruby</a> makes it possible to abstract and simplify common repetitive tasks, hence making it easier when developing websites and applications. 

It has been known to rely on a key  principle known as convention over configuration which means that ruby on rails comes with a set of conventions offloads the burden a programmer spending so much time trying to configure files in order to get a setup. 

Examples of the websites that have been made using ruby include; Airbnb, Github, Twitter, Shopify, Apple, Groupon among many others.

Python is a high level general purpose and high level programming language that allows you to develop so many <a href="https://pythonbasics.org/pyqt-hello-world/">desktop GUI applications</a> and since it is also a high level language, it focuses on core functionality by allowing you to bypass some tasks that would otherwise make web development so challenging. 

In addition to the syntax rule, it makes the applications readable and maintainable. National Geographic, Google, Mozilla Firefox, Pinterest, Washington Post and Instagram are some of the many renowned websites that have been made using python as a programming language.

<img src="https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fopensource-robotics.tokyo.jp%2Fwordpress%2Fwp-content%2Fuploads%2F2018%2F01%2FVID_20180111_151725-ANIMATION-1.gif&f=1&nofb=1" alt="final thoughts">

## Final thoughts

The choice of either of the two languages will be determined by the industry where you intend to use it. If you are in an industry that requires usage of ruby, then ruby is choice. 

If you are in a profession that requires usage of python, then python is your choice. I recommend that you learn the two languages since both of them allow you to perform just any task, only that they are applied in different fields of profession. 

If you are planning to be in a field that concentrates on web applications, then you might want to consider ruby on rails. If you are in a profession that heavily relies on data analytics, then you might want to pay much attention to python.

**Related links:**
* <a href="https://pythonbasics.org/">Python tutorial</a>
* <a href="https://python.org">Download Python</a>
* <a href="https://rubyonrails.org/">Ruby on rails</a>