DEV Community

AidanLincoln
AidanLincoln

Posted on • Updated on

Redundancy in Ruby

When I began coding, Python was the language I started with. After learning some Python, I switched to Ruby and JavaScript because that’s what my school taught. I was soon asking the question, “Why are there multiple ways of doing the exact same thing in Ruby?”.

Yukihiro Matsumoto, the creator of ruby, wanted his language to be expressive. I understand where he was coming from, but I find it redundant to have two words represent the exact same function. I would feel the exact same if tooth brushes were also called dental polishers. You may be thinking, “what about the words ecstatic vs excited?” I would argue that those words represent feelings, and definitions for feelings can vary from person to person. I find those words to have different but similar meanings. As an example when it comes to coding, I have no problem with JavaScript having multiple ways to iterate through an array. For loops and forEach loops accomplish the same task, but have minute differences. A for loop is easy to break out of, but forEach loops are easy to read. On the other hand, Ruby’s map and collect methods are the exact same. If you look at the Ruby documentation, they are both implemented as the C rb_ary_collect method.

Now although it may seem like I hate Ruby, I don’t. Many other languages have redundancies as well. Using Ruby on Rails gets the job done, and I enjoy writing in the language (for the most part). Although, once I become equally skilled in Python, I’ll probably use Ruby less. This is partially due to the same reasons I’ve been ranting about, but also because Python is faster than ruby. I’ve heard many great points about why people enjoy Ruby’s expressiveness.

I’d love to hear other peoples opinions on this topic.

Top comments (0)