Ruby && Python
Published: 2022-02-24 16:49:26

Only after a few days working with Ruby I personally felt like there was a lot of similarity between Ruby and Python. After writing some Ruby code and learning the syntax my initial perception started to seem true. Although it has been some time that I wrote Python code my familiarity of the language has not completely gone away. After looking back at some past Python projects my initial thought started to change. I thought I would be able to understand a lot of my past work but after spending sometime looking at the Python code I started to see some key differences  between Ruby and Python. 

## Brief History
Ruby was introduced into the world in 1995 only 4 years later than Python was. Both languages did not start gaining true popularity until the 21st century. But for different reasons. Ruby starting to gain popularity due to the creating on Rails. Rails is a framework built from Ruby that focused on building backend web development. Python also saw a spike in popularity around but for different reasons. Although Python also has a framework called Django which purpose is similar to Rails thats not the main reason Python saw a spike in its popularity. Python thrived in academic settings which focused around math, science, AI, and machine learning. With Python having an overall bigger use case and a stronger community Python has become one of the most popular languages today. 


## Syntax
Python syntax is made to be programmer friendly meaning it's easier on the eyes and easier to read. The cost of this is that for more complex programs it becomes harder to truly understand what the program is doing "Behind the scenes". Although understanding the "Behind the scenes" processes is a bit harder converting Python code to english is where Python excels. Ruby is similar in this aspect in that Ruby is easy on the eyes. Ruby has clean code with syntax similar to Python. The lack of brackets and semicolons are both seen in Ruby and Python

## Figure 1
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x5v34ylezlkkjafrcf4f.png)

## Figure 2
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gy1dsmh9bsvpj08s4plz.png)


## Functionality 
The first picture is Python code I wrote the gets user input and sets it to a variable. The second picture is written in ruby that does something very similar. Both are lines of code that have somewhat the same functionality. But where Python thrives is the speed at which is runs at. Python is known to be one of the fastest running languages which is one of the main factors that make it very popular. Although at this scale the speed is almost immeasurable. Where Python strives is being able to do more functionality  within a single line. In the Python code I am able to grab the user input, setting it to a variable, while showing an output all with a single line. In Ruby it is a bit different with having to print to the terminal in one line after that grab the user input in another. These subtle difference go a long way in more complex programs. Ruby thrives in a web development environment as its main use case stems from backend development. In terms of functionality I believe Python can do what Ruby can but Ruby cant do everything that Python can. 

Ruby's main aspect in terms of syntax and readability are very similar to Python. Both are focused on backend development and can do similar things. But do to Python popularity it has been able to grow enormously with having a much larger library already built into the language.

## Sources
https://learn.onemonth.com/ruby-vs-python/