Object Oriented Programing
OOP (Object Oriented Programing)
- OOP is a programing paradigm based on Objects which can contain Data and Procedure.
- Identification Objects, Definition Objects, Making a relationship each Objects.
OOP Features
1. Classes and Instance
Class is a definition for instance. It contains meta data of member variables and method. It looks like specification for making a car. It describes parts of car and assembly process. Instance is a car which made according to specification.
2. Data Abstraction
Data abstraction is the reduction of a particular body of data to a simplified representation of the whole. Abstraction, in general, is the process of removing characteristics from something to reduce it to a set of essential elements. To this end, data abstraction creates a simplified representation of the underlying data, while hiding its complexities and associated operations
3. Encapsulation
Open or Hiding Data and methods in class as access modifier. Encapsulation is a tech that encourages decoupling. It can decrease complexity between objects. So When some code is changed, It makes easy to identify related object.
and It helps to reuse code as grouping and classification variable and operations
4. Inheritance, Composition
There are two types of Inheritance in OOP. One is from class and the other is interface. Class inheritance enables you to create new classes that reuse, extend, modify the behavior defined in other classes. It is a method of code sharing and eventually class inheritance can reduce coast of new implementation using reuse. Also it can make Instances have same type, In other words we can get polymorphism. On the other side, interface inheritance gives object specific type through implement methods of interface.
Composition is an alternative of the Class-Inheritance. Class-Inheritance defines a class through another classes existed, So It is called white-box reuse. It violates the encapsulation of OOP. Occasionally subclass implement depends on the superclass. Therefore when superclass is changed, subclass has to be changed as well, On the other side, A class own other instances for new feature. We don't need to know specific implement, It depends on the interface of the object. So We call it black-box reuse.
Comments
Post a Comment