Object-oriented programming (OOP) is a programming language model organized around objects rather than "actions" and data rather than logic. Traditional programs are logical procedures that take input data, process it, and produce output data.
Object-oriented programming focus on objects that we want to manipulate rather than the logic required to manipulate them. Examples of objects range from human beings to buildings and floors with properties that can be described and managed
Data modeling
Identify all the objects the program will manipulate and how they relate to each other
Once an object has been identified, it is generalized as a class of objects
that defines the kind of data it contains and any logic sequences that can manipulate it.
Object Person () {
name : string
age : integer
function givename () {
return this.name
}
}
The person object has name and age properties we can assign to any person. The object has a method to get the name of the person.
Each distinct logic sequence is known as a method.
Objects communicate with well-defined interfaces called messages.
The concept of data classes allows a programmer to create any new data type that is not already defined in the language itself.
A) Polymorphism - “something having various forms”.
B) Inheritance – It is simply forming new classes from base classes
C) Encapsulation
Encapsulation is the technique to display the information in a way as to hide what should be hidden and show what’s needed.
Simula was the first object-oriented programming language. Java, Python, C++, Visual Basic .NET and Ruby are the most popular OOP languages today.