What is Object-Oriented Programming?
Structured programming became the paradigm for most programming languages developed over the past 2 decades as implemented in C, Pascal and COBOL. The concept of structured or procedural programming is simple: the instructions or processes are executed on a “top down” fashion. Above instructions get executed first going downward. While procedural programming was proven to yield desired outputs and solved small to medium scale programming problems, this programming paradigm has its limitations in building large software systems; coding using this technique produces an inflexible program structure and code reuse is nearly impossible in structured programming.
The solution to the limitations of structured programming was a new programming paradigm, known as the object-oriented programming (OOP). As its name suggests, object-oriented programming is a paradigm that uses a new form of data structure called objects. Object is a self-contained data structure composed of data and operations or methods on the data. Unlike structured programming in which program is viewed as a list of instructions to execute, object-oriented program is viewed as a collection of collaborating objects capable of receiving values or messages from other objects, passing values to other objects and data processing. Indeed object can be thought of as an “independent” machine having unique responsibility.
Object oriented programming languages are languages that support object oriented programming concepts. Popular programming languages used by developers include C++, Java Visual Basic, PHP and more. But what makes these languages an object-oriented programming language? Well a programming language is object oriented if it has support to all the following programming concepts:
Object
Object is the basic entity in OOP. It is the key to understand object oriented programming paradigm. In an enrollment system for example, student entity is an example of an object.
Basically an object has two characteristics: state and behavior.
- State – state describes the object. In our enrollment system example, student object is being identified by the following states: student number, name, course etc. State is also known as properties or attributes.
- Behavior – or method, describes the possible actions or behavior of an object. In our student example, one method for student in an enrollment system would be register or evaluate subjects.
Class
Class is the basic structure in object oriented programming; it is the blueprint of every object created. Class is a user-defined data type consisting of data (attributes) and methods defining the characteristics of the object. An object is an instance of a class. Using the advantage of reusability, programmers can create many objects out of a single class without repeatedly writing the code.
Instance
A copy of an object created at run-time. Instantiation of an object normally calls the constructor method of the class. Many OOP languages use the keyword new to create an instance of an object.
Inheritance
Inheritance is a mechanism in which one class acquires or “inherits” the state and behavior of the other class. The class where the properties are being inherited is called the parent class or “super class”, where the class that inherits the properties of the other class is called the child class or “subclass”. In C++, you can inherit properties of one class using the colon symbol. In Java, you can use inheritance by placing the keyword extends after the class name.
Polymorphism
OOP mechanism allowing an object to assume many forms (poly means “many” and morph means “form”). In our example, Student object could be Regular Student or Irregular Student.
Encapsulation
Encapsulation is a mechanism in which the design and implementation not relevant to the object is hidden from the object. In our enrollment system example, Student object has the method register(), Student knows that he/she needs to register(), however Student does not need to know how he /she needs to register(). The register() process is hidden from the Student object.
Data Abstraction
Is a mechanism separating data type’s logical properties from its implementation. Abstract data type is an implementation of data abstraction.
Dynamic Binding
In OOP, the method to call for the particular object will be determined until runtime. This is the main advantage of OOP over structured programming.
A programming language supporting all these mechanisms is categorized as an object oriented programming language.
Other Related Topics..
- Training Courses On Programming
- What is Object-Oriented Programming?
- What is Java?
- What is the Best School that offers PHP Programming / Training
- Java Programming Training in the Philippines
- How do PHP and MySQL work better for interactive sites?
- C#.NET Programming Short Course
- Course Training For Java Programming
- Course On Visual Basic 6 Programming
- PHP Programming in the Philippines
What do you think?
Comments
No comments yet. You can be the first!