Object-oriented vs Functional (OOP (Principle (Inheritance (Benefit…
Object-oriented vs Functional
programmers define not only data type of a data structure but also the types of operations ( functions ) that can be applied to the data structure. The data structure becomes an object that included both data and functions.
A class hide details of how it does its thing, while supplying a nice, clean interface to the outside world
Hiding implementation details reduces complexity
Ensure structural changes remain local
A class define a high-level interface to the outside world, leaving the lower-level details to implementation-specific code
A child-class can modify or extend the behavior of its parent-classes
Allow child classes inherits the characteristics of existing parent class
Eliminates redundant code
Child-classes can use its own method or parent class. When child and parent classes have two different methods but have the same name, the program will pick the methods depend on which class you are referencing an instance off
Cohesion and Coupling
Describe how closely all the routines in a class or all the code in a routine support a central purpose
Math has Sin(), Cos()..
Magic has MakePizza
Describes how tightly a class or routine is related to other classes or routines
Coupling must kept loose
Modules must depend little on each other
All classes and routines must have small, direct, visible and flexible relations to other classes and routines
One module must be easily used by other modules
set of operations (methods) that given object can perform
Process of building software by composing pure functions, avoiding shared state, mutable data, and side effects.