OOP Explained

Preface

OOP is a way of thinking / design pattern. It can be understood by way of a number of different analogs. Not all the analogs described here are perfect but it makes some of the concepts easier to understand.

Blueprints:

Blueprints tell people how to make things, from your stove to your car. It has a clearly planned out way making sure everything works the way it is supposed to, and makes sure it satisfies it purpose.

You can think about “Classes” in the same way, expect what it builds is not something material, but an entity in computer. So if you wanted to make a car class you would thing about the things it should do. Such as accelerate, brake, turn on and off, open the door, and etc. Notice how all these things involve a verb , these actions that the car can take can be thought of as the methods in class. And then you have the stats of the care, such as the make, model, owner, and etc. These are all nouns and can be thought of as the variables of the classes.

There for when you instantiate a class, your telling the computer to build that objects using the guide (“Class”)

Collections of things:

People collect a lot of different things, from action figures, to stamps. These things all have common figures. Action figures are usually of a fictional character, are made of plastic, can be moved into different positions, and are usually a certain height .

And classes are the same, they hold variables and methods that come together since they are all kind of related. For example a coin classes could have a variable called “metal type” and a method called “flip”.

Cookie Cutters:

Cookie Cutters let you take cookie dough and make interestingly shaped cookies. Which is same thing as what a class does, except the cookie dough is your computers memory, and the cookie cutter is your class. Every time you instantiate a class,  your take some memory forcing it through the classes and making a object.

5 thoughts on “OOP Explained

  1. Excellent blog here! Also your site so much up very fast! What web host are you the usage of? Can I am getting your associate hyperlink to your host? I desire my site loaded up as quickly as yours lol

    Like

  2. You actually make it appear really easy together with your presentation but I find this topic to be actually one thing that I think I might never understand. It seems too complicated and extremely broad for me. I’m taking a look ahead in your subsequent submit, I’ll try to get the cling of it!

    Liked by 1 person

  3. you’re really a good webmaster. The website loading pace is incredible. It kind of feels that you’re doing any unique trick. Furthermore, The contents are masterpiece. you’ve done a wonderful job on this matter!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s