Ruby is an object oriented language, which might sound a little confusing at first, but let’s break it down. Let’s take that first word; object. What is an object? Well, it’s just a thing. A thing in our world that we can interact with, manipulate, and perhaps it’s a completely unique thing, or one of many of its kind. Ruby’s code is manipulated through creating virtual objects that we can play with, tell what to do, and classify. VIRTUAL THINGS. Pretty cool right? But how do we grasp that idea more clearly…

Objects themselves, as we know, have components. Think about the chair we we mentioned earlier as an object; how does that come together? It has legs, a seat, etc. All of these components make the object come together as a whole, kind of like a framework or blueprint! A framework of these objects is called a “class” in Ruby. A class can therefore be thought of as a type of object, and an instance is one of those objects individually. Ok, we’re jumping ahead here with instances. Let’s wrap up the idea of components first; how pieces come together to make a class whole.

Parts of a Whole

Image for postOk, so we know a Ruby class is a framework or blueprint of what a type of object is, and it requires essential pieces to come together to exist. Let’s look at how its written so we can visualize the syntax side of things along with the conceptual side of it.

Image for post

Bzzt bzzt what is up homo sapiens!

Its that easy! We made a class! In this example, we’ll use a robot. Now remember, a class is a framework of our objects here, so we haven’t created a robot. What we have created, though, is the beginning to a blueprint of what a robot is. Ah ha!

#objects #class #ruby #programming #orientation

Conceptual Understanding of Ruby Classes and Objects for Beginners
3.80 GEEK