How to do Object Oriented Programming the right way

Click for: original source

Article by software engineer Xiaoyun Yang about Object Oriented programming done right. Object Oriented Programming (OOP) is a software design pattern that allows you to think about problems in terms of objects and their interactions. OOP is typically done with classes or with prototypes.

Author focuses on two approaches:

  • Class-based inheritance (typical for Java, Python, Ruby…)
  • Prototypal inheritance (JavaScript)

She shows you how to use both approaches for OOP in JavaScript, discuss the advantages and disadvantages of the two approaches of OOP and introduce an alternative for OOP for designing more modular and scalable applications.

In classical (class based) OOP, classes are blueprints for objects. Objects are created or instantiated from classes.

Prototypal inheritance does not use classes at all. Instead, objects are created from other objects.

Code examples and pop quiz (with answers) provided. Good read for any fun of Object Oriented Programming!

[Read More]

Tags oop programming javascript