A.KingCodes

You need to understand how awesome object oriented programming is. You can make a template for ANYTHING you want. And you get to tell it how to behave. This is seriously cool coding, people!

Let’s say I want to create a flying ninja squirrel. No problem!

class FlyingNinjaSquirrel

end

rambo = FlyingNinjaSquirrel.new

Sure, Rambo doesn’t do much yet, but we just made a freaking flying ninja squirrel! Just give him some methods and he could be so awesome your eyes will pop out.

Maybe a bit more. And we should make a regular squirrel to differentiate our awesome flying ninja squirrel, right?

There we go!

Seriously though, who knew it was so easy (cough, cough) to just make anything you want? You can make your own class WizardingSchool like Hogwarts, full of your own houses, professors, students, magical creatures, and what have you. OOP is build-your-own-anything, with code.

It’s actually more intuitive than creating things in art or writing form. You can define how things should act one time, and they will always do it (hopefully). You don’t have to look back in the story to recall how a character or special item should act or look, you can just use them when you want them.

The first thing I thought of when this topic came up was LEGOs. Each LEGO brick is basically an instance of a class. Each brick can be different, but they interact in definable ways. You might even consider a LEGO build kit like a program; it’s full of object instances that fit together to make your LEGO Death Star (or what have you) when you compile them according to the instructions (or run the program).

OOP with Ruby is just plain fun. Don’t believe me? Just try it. Think of something, anything, that you like, and how you could build a representation of it in code. Now, go forth and build some fun objects for yourself!