We write most of our programs using functions in which a block of code can manipulate data. This is the procedural way of programming. Sometimes we call it procedure-oriented programming. We can write our programs using a different approach than procedural programming. i.e. Object Oriented programming in which we combine data and functionality.
What is Object-oriented programming (OOP)?
It is a model of programming languages which emphasizes on:
- Objects rather than actions
- Data rather than logic
There are two very main aspects of object-oriented programming.
Classes & Objects.
Very first step in OOP is to identify objects which we call as data modeling. When we successfully identify an object we then generalize it as a class. Objects are the instances of classes.
These objects may contain data in the form of fields often known as attributes and code (distinct logical sequence) often known as methods. Methods can access and modify data of objects.
Object-oriented programming provides different important benefits:
Inheritance: – A class/subclass can inherit some or all characteristics of another class. It represents “is a” relationship between different classes.
Data Hiding: – Object-oriented model allows the security i.e. restricted access of program data.
Polymorphism: – Object-oriented programming allows to process objects differently depending on their classes.It also provides a mechanism to create new data types that are not defined in the language already.
The very first object-oriented programming: –
In 1967 Simula was introduced as the very first formal concept of programming objects. Sometimes you may call it Simula 67 was the first object-oriented programming language.
Very famous object-oriented languages of today include:
- Visual Basic.Net
Smalltalk which was developed in the late 1960s and was released in 1972 is considered to be the only true object-oriented language.And is considered to be the one with which all other object-oriented languages must be compared.
Note: – It is virtually impossible to write a program in Smalltalk which is not objected-oriented.