One of the classic questions in the programming world is: “What should I choose – ruby or python?” At first glance both languages have similar advantages they’re in demand and have actively developed.
Officially Python is 4 years older of its main competitor and was developed in 1991. All these 26 years, he gradually developed and penetrating into all areas of IT from desktop applications to artificial intelligence, building up the community.
Yukihiro Matsumoto is the creator of Ruby and had enough time to evaluate all the pros and cons of not only Python but also other languages (in particular, perl). However, the first years after released it gave Ruby a hard time. For several years official documentation was being prepared and the community did not develop as rapidly as Matsumoto wanted. Significant progress was made during 2005 when Ruby on Rails appeared. A framework with rich Web capabilities. New opportunities interested the masses and from that moment on Ruby became a full competitor python in the world of the web.
Easy to learn
A single-valued answer to the question: “What is easier – python or ruby?” Does not exist. It’s like with the cinema: among the world’s blockbusters you can find both a meaningful action and films where the play of actors is at the forefront. Some do not exclude others and the devoid of stereotypes the viewer will see the perfect in every approach.
Python or ruby in this comparison is an action or a drama. Python is a straightforward, extremely simplistic language with a bunch of special effects. Ruby is more subtle, elegant but also understandable after a short acquaintance. Here’s a simple comparison of syntax with the example of time calculation:
require8 ‘active_support / all’
new_time = 1.month.from_now
from datetime import datetime
from dateutil.relativedelta import relativedelta
new_time = datetime.now () + relativedelta (months = 1)
Python is more familiar and simpler, but the Ruby approach looks more elegant and professional.
Here, an unqualified victory is gained by Python. True, it is characterized not so much by the quality and thoughtfulness of the language as it is by a greater number of spheres of application. Due to the fact that Python has a lot of mathematical and statistical libraries more questions are asked about it in student and scientific forums. The devotees of Ruby almost all resources are dedicated to the web. This topic is studied along and across, so activity is stimulated mainly by new errors of Ruby on Rails.
Scope of application
The obvious advantage of Python. As mentioned above, Python is used in:
- mobile and desktop applications;
- large data;
- artificial intelligence;
- network administration.
Ruby can respond to this only by developing on the web.
If you take the measure of success of the names of companies that officially support the language, here there is equality:
Python: Google, Instagram, Pinterest, Mozilla Firefox and National Geographic.
Ruby: Apple, Airbnb, Twitter, Github and Groupon.
So for an ordinary programmer, the question of choosing python or ruby for the web is actual. If you need width of application, then Python is the way to go.
From the point of view of the speed of writing the code, then Python is also the winner of this round. The point here in the amount of code and in general the desire of language developers to speed up the writing of programs. According to the latest reports from the forums, working with Ruby is more convenient because of the greater “humanity” of the language and the development of the Ruby on Rails platform. But the performance of executable code will help evaluate special tests. One of them is given here. Let’s take a look at the adapted comparison histogram of Perl Python Ruby PHP:
Obviously, modern Ruby greatly bypasses the productivity of its “founders”.
If you look at the dynamics of development with Ruby it’s much steeper. Moreover, if we talk about the web even despite the development of Django it’s Ruby on Rails that has great capabilities that features: speed, tools, reaction to trends. Python is increasingly moving away from the web to other disciplines. Today it is deployed hardly on every Linux-machine. Practically on equal footing with MATLAB in the field of combinatorics and neural networks, etc.
If you are considering python or ruby as the first programming language then it’s better to study both at a basic level in any order. Then you can already push off personal attachments and impressions devoting a future career to only one of them.
If this is the desire to acquire a new profitable specialization, then both languages are not useful since in Russia they are much less in demand than Java, PHP, etc.
In all other cases, the choice of a better language is directly dependent on the scope of your future activity. Today Ruby looks more promising for the web today. But if your ambitions are much wider then only Python will become for you a universal tool.