-->

What is OOP (Object-Oriented Programming)?

What is OOP (Object-Oriented Programming)?

What is OOP (Object-Oriented Programming)?


 You must have heard of OOP (Object-Oriented Programming). Because Most of the popular programming languages follow the object-oriented programming paradigm. In this article, we will discuss what OOP is and what the concept of OOP is.



What is OOP?


OOP (Object-Oriented Programming) is a programming language paradigm or a special way of designing programs created by Alan Kay. In object-oriented programming, code can be structured as reusable components, such as sharing properties or behavior. The main goal of OOP is to unify data and the functions that operate on them so that no other part of the code can access this data except those functions.


OOP concept


When programming in an object-oriented programming language, you should remember the following four key concepts.

* Encapsulation – Grouping functions and their associated data ( variables ) together into an object to help reduce complexity and allow parts of code to be reused.

* Abstraction – Show only the essentials to reduce the abstraction of changes.

* Inheritance – Eliminate redundant code by inheriting functions and data from other classes.

* Polymorphism – Changing the way an object functions depending on data or classes.


Common OOP Examples


Let's say you are programming a video game in which players control and drive vehicles. If you are using an object-oriented programming language, you can define a class of an object named "vehicle." This class can contain the quality and behavior definitions shared by all vehicles. For example, all vehicles speed up and slow down, and consume fuel. Within this class definition, you can define methods (similar to functions) called “accelerate” and “decelerate,” and properties (a type of variable) called “fuel,” whose value you can get or set.


Then, you can define a subclass, also called a derived class or child class , that inherits the methods and properties of the "vehicle" class. For example, you could define a subclass called "motorcycle" which has two wheels, and a subclass called "car" which has four wheels. Their shared qualities (acceleration, deceleration and fuel consumption) are already defined in "vehicle," so you don't have to write that down again.


Then, you can instantiate these subclasses to define individually playable vehicles. Each instance of a subclass inherits the methods and properties of all the parent classes, and has its own properties and methods. For example, unique traits might include paint color (“red,” “blue,” etc.), and price (if the player wants to purchase them with in-game currency).


Then, when you want to change the code specifically for motorcycles, you don't need to change the "vehicle" parent class. The “vehicle” code has been tested, and works fine, so modifying your program requires less work. Also, as fewer lines of code are being modified, there is less chance that a bug will be introduced somewhere in the new code. If a bug occurs, you don't have to wonder if it's in the “vehicle” code class, because that class isn't modified. Therefore Development and maintenance of software may be more efficient, saving time and effort.


The advantages and disadvantages of OOP


Object-oriented programming contributes to greater programmer productivity, better software quality and lower maintenance costs.


Excess


1. Make use of inheritance, redundant code is removed, and existing classes are extended.

2. Easy to maintain and modify existing code as new objects can be created with slight differences.

3. Provides a good framework for code libraries where the software components provided can be easily adapted and modified by programmers.

4. Through data hiding, programmers can build secure programs that cannot be attacked by code in other parts of the program.

5. The system can be easily upgraded from small to large systems.

6. Code reuse is much easier than conventional programming languages.


Lack


1. Due to the large size of the program the execution speed becomes slow. In fact, many coding instructions make program execution slower and effect efficiency.

2. Object-oriented programming programs are larger in size compared to traditional procedural programming.

3. If a programmer does not have sufficient knowledge and skills about programming, then it becomes difficult for them to code and manage it.

4. Designing and implementing the concept of object-oriented programming correctly is quite complicated and burdensome for programmers.


Examples of Object Oriented Programming Languages


There are many different languages that use object oriented programming. Among others are:

* Java developed in 1995 by Sun Microsystems, now Oracle

* Python was created in 1991 and emphasizes code readability

* C ++ which features imperative, object-oriented and generic programming and is an extension of the C programming language

* Objective-C which adds Smalltalk style messaging to C and is the primary programming language for OSX and iOS.


Conclusion


So What is OOP? OOP (Object-Oriented Programming) is a programming paradigm, or a specific way of designing programs. This allows us to think of the data in our programs in terms of real world objects, with their properties and behaviors. There are 4 main principles that make an object-oriented language. These are Encapsulation, Abstraction, Inheritance and Polymorphism . These are also referred to as the four pillars of Object-Oriented Programming.

________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ ________


So many articles What is OOP (Object-Oriented Programming)?. Look forward to other interesting articles and don't forget to share this article with your friends. Thank you…


Resa Risyan


Just an ordinary person who wants to share a little knowledge, hopefully the knowledge I provide can be useful for all of us. Keep in mind! Useful knowledge is an investment in the afterlife.


Also, read the article about What is OSI Layer 7? Here's the explanation. And see you in another article. Bye
Read Also :
DotyCat - Teaching is Our Passion