How does Object Oriented Programming work? What does it do and how is it effective?

1.12K views

How does Object Oriented Programming work? What does it do and how is it effective?

In: Technology

10 Answers

Anonymous 0 Comments

Instead of step-by-step instructions *to the computer* about what to do, you create objects and instructions for each object for how to calculate things internally, and how to interact (externally) with other objects.

For example, instead of generating this web page from top to bottom:

* Write “Get new reddit, My Subreddits, Home, Popular, All, Random, Users, etc.”

* Write “Reddit, explainlikei’mfive, Comments”

* Write ELI5: How does Object Oriented Programming Work?”

* etc.

You instead:

* Create a Get_Header object, and put code inside about how to make that menu at the top, with all your subscribed reddits.

* Create a Navigation object, and put code inside about figuring out which subreddit the user is viewing (explainlikeimfive) and what tabs (comments).

* Create a Get_Topic object, and put code inside about getting the title of the post, and getting all the replies, and sorting them in order.

* And then you create a Main object, that says, on click, get the user name, and for that user Get_Header(for user), Navigation(for user), Get_Topic(for user), etc.

Advantages are that you don’t have to repeat the steps for every user, you can just use the objects that are there. You can also copy and “inherit the properties” of objects to create more objects. The code is organized better, logically.

You are viewing 1 out of 10 answers, click here to view all answers.