Ruby Object Orientation

Kelvin Lanier
2 min readDec 6, 2020

There’s a first time for everything. When we are faced with the challenges of learning new things, we are all reluctant to change. First, the brain has to process something new, then the memory has to eternalize the new concepts. For me, learning the new concepts of a programming language was that ‘first time’ challenge for me. Ruby Object Orientation was a new logic for me.

Programming languages often need directions and guidance from prewritten codes. These codes allow the program to perform the necessary task it needs for the user. Ruby is language that allows a developer to utilize the object orientation concept. For example, everything is an object in Ruby. Objects are largely sorted by classes and modules to distinguish the unique attributes and characteristics. The ability to give an object attributes to function as separate entities makes Ruby one of the more dynamic programming language available.

For my first completed project with Ruby, I had to develop a CLI program. Command Line Interface are very common and were used before GUIs. You input text into the terminal and you would receive output in that terminal. I chosed to use data from a mythology website and give users the ability to learn about each mythology. I used some of Ruby’s key features like using multiples classes to create and operate the program. Also, I parsed data from an external source to used for the program.

The last thing I wanted to discuss was the Object Orientation concept. To understand the concept you have to understand the default object, ‘self’. Self is always the current object within a definition block. For example, ‘self’, can become the class , module, or class/instance method object. Knowing where the current object is within a program or file is essential to knowing how to orient your object to the correct attributes. Also, ‘self’ is the default object. You can use self to call a method which enables you to change a class name without having to rename the class each time you want the name changed.

--

--