What is Object-oriented programming (OOP)?
OOP definition
It is a programming method that abstracts the data needed in programming to create objects with 1)states and 2)behaviors. It configures logic through organic interactions between those objects.
Advantages of OOP
Through inheritance, encapsulation and polymorphism that OOP provides: 1) Reusability of code - can import and use classes 2) Easy to maintain - only need to modify the applicable part, whereas procedure-oriented programming has to find and modify it one by one 3) Suitable for large-scale projects - Possible to develop by modularizing each class
OOP keywords in Java
These concepts are explained more deeply in the Java category but simply:
Abstraction: Grouping and naming common properties or functions by hiding unnecessary information and presenting only important info
Encapsulation: Puts a collection of functions and properties into a “capsule” called a “class” and categorizes it.
Inheritance: Inheritance is to inherit and use the properties and functions of the parent class, and if a part of the function needs to be changed, the inherited child class can modify (define) the function again and use it. Multiple inheritance is not allowed (remember Deadly Diamond of Death?)
Polymorphism: One variable name, function name, etc. can be interpreted in different meanings depending on the situation. In other words, overriding and overloading are possible.
Overriding: Redefining the same name and parameters as the method of the parent class. Overloading: Defining multiple functions with the same name e.g.(int add() and double add()) and different types and numbers of parameters so that they can be called differently depending on the parameters.
Instance in OOP
From OOP view, when an object is allocated in memory and actually used, it is called an instance.