Basics of Object-Oriented Programming

1084

In programming, an object is simply a ‘thing’. I know, I know…how can you define something as a ‘thing’. Well, let’s think about it – What do ‘things’ have? Attributes, right?  – A dog has four legs, a color, a name, an owner, and a breed. Though there are millions Dogs with countless names, owners, etc, the one thing that ties them all together are the very fact that every single one can be described as a Dog.

Although this may seem like a not-very informative explanation, these types of examples are what ultimately made me understand Object-oriented programing. The set of activities that an object can perform is an Object’s behavior. 

Let’s look at a common element in programming, a simple string. As you can see, after the string is defined, I’m able to call different ‘methods’ or functions on the string I created. Ruby has several built in methods on common objects(ie strings, integers, arrays, and hashes.

Read more at Dev.to