Classes With Ruby

Taylor Coon
Nov 5 · 2 min read

Guess what? I finally got a handle on classes in ruby. It took me a couple of days to sort out, but I’m very excited about it.

The variable object.

Essentially, what you can do with classes in ruby is build infrastructure around a new object classification. Not only can you create unique instances of an object with the same name, but you can set a bunch of rules that apply to that class object too. This is a very powerful tool that allows for a variety of interesting uses.

For example, let’s say you want to be able to fill a large data structure automatically while maintaining an infrastructure that allows for complicated joins, searches, or queries.

Then you can use classes to build an ORM which is basically just a tabulated database except that you can define how those tables are formatted yourself. Then you can define a bunch of methods that interact with the tables in interesting ways.

You can use the whole class shebang to mess with ruby’s duck system too.

class String#make methods that effect all strings. the world is your oysterend

That’s just the tip of the iceberg really. I’m feverishly reading anything I can get my hands on to try to see what other things can be implemented using classes. In fact, the more I read about ruby altogether the more I see this whole class business being used in basically any project. Very cool stuff.

Monkey patching

I love monkey patching. I know it’s considered bad practice for any project that involves any sort of collaboration, but I’m a bleeding heart idealist at heart.

Think about it. What if every programming language evolved? What if everybody was slowly corrupting their tools until they could barely even be called a screwdriver anymore? Imagine what kinds of things some of those tools would be able to do. It would be a creative pandamonium.

But then again, I understand the need for specific tools to maintain integrity in the colossal centralized systems that exist today. It’s a mixed bag.

Final statements

I know ruby is not the best language and I know it’s duck system is appalling at times, but at the end of the day, it has introduced an interesting technology to me that has opened quite a lot of doors. I’ve started researching the technologies and limitations that exist in other languages as well.

The programming world is a vast field of tools, trinkets, and knowledge. It’s like a sand-box the size of infinity except the sand can be abstracted into anything you could imagine with a bit of thought and work.

For me, it’s insanity to consider that most people on earth hardly even get their feet wet in this world of 1's and 0's.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade