Object-oriented programming, is a programming paradigm that was designed as a better way to organize your application code. Before OOP, most programs were written in an imperative way. That means top to bottom execution of code; without standards for good code organization or DRY (don't repeat yourself) principles for code reuse.

How does OOP Promote Good Coding Practices?

The object-oriented programming paradigm combines state (data) and the methods that act on the state in the same object (context). For example (click on the JS button after you run the pen):

In OOP, data is called properties and functions are called methods. Methods are basically functions with context; the context being the object that contains the method. In JavaScript, we use the this keyword to access that object's context (properties and methods on the object).

When you combine properties and methods of the same category together, it helps to be able to organize and reuse them throughout your application. For example, if you had an ecommerce website, you might have one object with the methods and data for your products and another one for user preferences.

To fully understand how OOP works, we should look at its four pillars that make up the foundation for this paradigm.

What are the Four 'Pillars' of OOP?

Subscribe below so you can see next week's article on this topic.

I hope this explanation made sense. Please leave a comment below if you have any questions or want to add something to this article.