Class

OOP (object-oriented programming) is the established programming procedure, especially for a complex large-scale software project. Modeling on the intuitive concept of 'objects', OOP typically involves class inheritance, data encapsulation, and abstraction. This enhances the design-and-program process, makes the code maintainable, and facilitates collaboration among programmers.

In the past, a data type is defined as a function. Motivated by the need for a cleaner syntax (eg. for inheritance), ECMAScript-2015 introduces the keyword 'class', among a few class-related keywords. The two ways of defining a class are just syntactic sugar of one another.

In object-oriented computer programming, SOLID is a mnemonic acronym for five design principles intended to make software designs more understandable, flexible, and maintainable:

1. Single-responsibility principle

A class should only have a single responsibility, that is, only changes to one part of the software's specification should be able to affect the specification of the class.

2. Open–closed principle

"Software entities ... should be open for extension, but closed for modification."

3. Liskov substitution principle

"Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program."

4. Interface segregation principle

"Many client-specific interfaces are better than one general-purpose interface."

5. Dependency inversion principle

One should "depend upon abstractions, not concretions."