Originaly posted in carwow blog on medium.com
Object-Oriented Programming to me means that the system is divided into
objects. An object is just an entity that has some state and some behaviour. You
can make your object do something by sending it a message, hoping that it will
understand you.
For practical reasons, every language has some primitives; basic data types you
can use to write your program. Even though Ruby is, supposedly, a pure OO
language (everything is an object), it has some primitives nevertheless.
For instance, numbers. They look like objects, they have methods and
stuff. However, what are they really? 2 and 3 are different instances of the
Integer class, so they are supposed to have a different state. But what is that
state? Magic.
Let’s try and implement numbers on our own, without magic. Just for fun.