Object Oriented Programming : (Principles (Liskov substitution principle…
Object Oriented Programming :
Liskov substitution principle
Let q(x) be a property provable about objects of x of type T. Then q(y) should be provable for objects y of type S where S is a subtype of T.
Every subclass/derived class should be substitutable for their base/parent class.
Interface segregation principle
A client should never be forced to implement an interface that it doesn't use
clients shouldn't be forced to depend on methods they do not use.
Objects or entities should be open for extension
but closed for modification
Dependency Inversion Principle
Entities must depend on abstractions not on concretions
The high level module must not depend on the low level module, but they should depend on abstractions.
A class should have one and only one reason to change
a class should have only one job
Encapsulation means that we want to hide unnecessary details from the user.
For example, when we call from our mobile phone, we select the number and press call button. But the entire process of calling or what happens from the moment we press or touch the call button to the moment we start having a phone conversation is hidden from us.
Abstraction means, showcasing only the required things to the outside world while hiding the details.
example, Human Being’s can talk, walk, hear, eat, but the details of the muscles mechanism and their connections to the brain are hidden from the outside world.
The concept of abstraction focuses on what an object does, instated of how an object is represented or “how it works."
Thus, data abstraction is often used for managing large and complex programs.
Polymorphism is a concept, which allows us to redefine the way something works, by either changing how it is done or by changing the parts used to get it done.
This can be done in two ways, overloading and overriding.
Inheritance is a feature of object-oriented programming that allows code reusability when a class includes property of another class.
Considering HumanBeing a class, which has properties like hands, legs, eyes, mouth, etc, and functions like walk, talk, eat, see etc.