During the unprecedented events of the Covid-19, I took a leap of faith and decided to further my programming knowledge by learning a new language. I applied and was accepted into a fully funded boot camp program at Flatiron School. My cohort is almost 2 months deep with Ruby, and I have fallen in love! The simplicity, productivity and power behind Ruby has really made this journey to becoming a Software Engineer enjoyable and fun. I want to share this love for Ruby by showing a few reasons why I believe Ruby Rules!
Ruby Rules Because…
Ruby is an Object Oriented programming language. Meaning, it can transform real life ideas or nouns into objects and create dynamic applications for the world to see! These objects, also referred to as Models, can store their own attributes and actions (methods), that can be used by Programmers to create some really powerful applications. Objects are an abstraction of thought. Did you know human language is also an abstract system!
“An object-oriented approach to application development makes programs more intuitive to design, faster to develop, more amenable to modification, and easier to understand.”
— Object-Oriented Programming with Objective-C, Apple Inc.
Above is an example of writing out a class in Ruby. A class is a blueprint of an object. In this example, there is a Plant object that contains attributes and implementation of behaviors(methods). Now imagine you want to create a gardening application that displays information about plants and how to garden. Along with this Plant class, we could also create a Garden class. In this class we could write out definitions to display to a user how to garden a specific plant. There are so many different possibilities and directions we could write out this application. Ruby makes the process of writing our app easier by using Object Oriented design to keep your thoughts organized and your code readable.
One of my favorite quotes that my instructor at Flatiron keeps repeating is- “Ruby has your back” -Sylwia Vargas(Lead Instructor), and she isn’t lying! Ruby is a perfect language for beginners. I first started my journey as a programmer with Java which is a statically typed language. Ruby is a dynamically typed language which means it is less strict and you can write up a program faster.
In the example above, you can see the power and leniency of Ruby! We can declare a variable and assign it a value in the same line AND we can forget about stressing over syntax errors with missing semi-colons! Another great example of how awesome Ruby is:
Look at how much easier it is to read and understand the Ruby example than the Java! The same method can be written in one line of code. As a beginner learning to code for the first time, reading out loud 10-times-print ”Hello Ruby” will make more sense than trying to understand that scary for loop.
Ruby is an open sourced language. This means that there are developers that are constantly improving the language making it easier and more efficient to use! One of my favorite things about Ruby is how many built in methods the language comes with. There are also an abundant amount of libraries that have been created by developers ready to install into your program as you please! You can read more about these libraries and their power here: https://www.ruby-lang.org/en/libraries/
Above is a built in method that you can call using the dot notation. .methods will list for you all the different methods that you can use on your class! This is one my favorite methods and I use it all the time while building out my applications.
As you build out more complicated applications and start getting errors, you can hop into the console and use built in Ruby methods like .class and .methods to help you navigate your way to solving the error. As a programmer you will never remember every method and that is okay! By using Ruby’s built in methods, we can see what is available based on the class type, and then determine from there our next steps.
I have only covered 3 powerful reasons why I believe Ruby rules but there are PLENTY more! Ruby is dynamic, readable, and has our back! As I dive deeper into the boot camp, I am excited to learn more magic that Ruby has and why Ruby is such a popular language.
“I believe that the purpose of life is, at least in part, to be happy. Based on this belief, Ruby is designed to make programming not only easy but also fun. It allows you to concentrate on the creative side of programming, with less stress.”
-Yukihiro Matsumoto (Creator of Ruby)