What is OOP ?
OOP stands for Object-oriented programming . the computer programming model based on the concept of "objects" . in OOP software is organized around data or object instead of function and logic .
In OOP projects are divided into groups .plus benefits of OOP include code reusability, scalability and efficiency.
The structure of object-oriented programming
The structure building blocks of object-oriented programming are four as follows:
- Classes- OBJECTS
- Methods
- Attributes / properties
- Classes are user-defined data types that act as the blueprint for individual objects, attributes and methods.
- Objects are instances of a class created with specifically defined data. Objects can correspond to real-world objects or an abstract entity. When class is defined initially, the description is the only object that is defined.
- Methods are functions that are defined inside a class that describe the behaviors of an object. Each method contained in class definitions starts with a reference to an instance object. Additionally, the subroutines contained in an object are called instance methods. Programmers use methods for reusability or keeping functionality encapsulated inside one object at a time.
- Attributes are defined in the class template and represent the state of an object. Objects will have data stored in the attributes field. Class attributes belong to the class itself.
There are four main principles of OOP:
1- Encapsulation.
2- Abstraction.
3- Inheritance.
4- Polymorphism.
1- Encapsulation.
This principle states that all important information is contained inside an object and only select information is exposed.
2- Abstraction.
Objects only reveal internal mechanisms that are relevant for the use of other objects, hiding any unnecessary implementation code.
3- Inheritance.
Classes can reuse code from other classes. Relationships and subclasses between objects can be assigned, enabling developers to reuse common logic while still maintaining a unique hierarchy.
4- Polymorphism.
Objects are designed to share behaviors and they can take on more than one form. The program will determine which meaning or usage is necessary for each execution of that object from a parent class, reducing the need to duplicate code .
Popular pure OOP languages include:
- Ruby
- Scala
- JADE
- Emerald
Programming languages designed primarily for OOP include:
- Java
- Python
- C++
In any next blog we will Discuss about OOP benefits .
Programming languages designed primarily for OOP include:
No comments:
Post a Comment