Ruby vs Python

Differences

Ruby

Ruby is made with flexibility for programmers, it is an easy language to learn and sometimes the flexibility makes the language feel like magic. But, this flexibility can also make it hard to find bugs when your code doesn't work.

Python

Python on the other hand is very direct, everything is visible to the programmer. This can make it a little harder to learn but also makes it a little easier to debug quicker. Below we will look at an example of both to do the same thing.

Ruby
require 'active_support/all'
new_time = 12.month.from_now
Python
from datetime import datetime
from dateutil.relativedelta import relativedelta
new_time = datetime.now() + relativedelta(months=12)

Popularity

Python and Ruby are both very popular, but where they are popular are very different. Python has blossomed when it comes to math and science applications, also it is the preferred language on Linux computers because it comes pre-installed on most Linux computers and servers. Popular companies that use or have used Python are Google, Pinterest, Instagram, Mozilla Firefox, and The Washington Post.

Similarities

Frameworks

You might look at this and say how is this a similarity when they both use different frameworks but as you will see it is different but the same in a sense. When building your web applications both languages have frameworks that will help Python uses Django and Ruby uses Rails. Since both languages are scripting languages they both behave and have similar performance. They will both follow the MVC (Model, View, Controller) concept. Obviously, the implementation is different but When using them you will feel very familiar between the two languages.

Documentation

Both Ruby and Python have a vast community of coders, and that means that you can find tons of information and documentation when writing your code, there are many libraries that are available for use.

Which to Choose

So with the information, which should you choose. Well all depends on what you want to do with your application and which you feel more comfortable with. I would say that if you do not know either and are going to be learning I would learn Python first because then Ruby will come more easier. Also more and more jobs are using Python than Ruby. If you want to make web applications I would choose Ruby, If you want to get better at working with data and learn a language that is used more often then I would go with Python. But whichever you choose you can’t go wrong.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store