Programming, like everything else in computing, has evolved. A program is a series of instructions that a computer executes. But the style and science of programming has changed. Gone, now, are the days of line-by-line coding. Instead programs are written with procedures in mind that can be re-used. Furthermore, a new and different way has emerged that involves writing code with objects in mind, such as buttons, drop down lists, and so on. They are unique approaches. This is how you define object oriented programming (OOP); it involves objects, modeling, and some of the specifics of both types of programming models.
Take a form on a window. If there were three buttons, and a drop down list, in the traditional line-by-line method each part of the form would have a series of lines that would display the form and what to do with it.
In object oriented programming, take the same form, but now you are only programming to the objects. The supporting programming environment is richer, and the programmer only needs to know how the objects will interact with one another.
The essence of modeling is to show all pertinent details about a program. It is also to focus on responsibilities and interfaces before the implementation of the model. This modeling makes it easier to build systems that solve the right problem, work properly, are maintainable, are extensible, and are reusable.
This model has several features. A system is organized around objects, not code. Objects can send messages, called procedure calls, to each other. Data and objects are tied together. Visual models are expressive and easy to comprehend and can evolve into models of the solution. Design models, moreover, are only a small step from implementation.
Source: Object-Oriented Modeling
The Procedural Programming Model
The main motivation in the procedural model is to develop code quickly and easily. The focus is on code re-use with modules. The main characteristic of this model is that the focus is on procedures. Procedures are sections of code that are reused in different parts of the program. They work with the data, but procedures and data are clearly separated. Finally, procedures can send data to other procedures.
The focus on procedures is one part of this model, but a different focus is on data structures. These are algorithms and step sequencing. They identify what parts of the program will be developed and what steps to follow. But unfortunately with data structures there are a lack of a visual modeling techniques. These tend to be abstract.
The procedural programming model is an abstraction of machine or assembly language. It can be programming at a very low level, near the machine in fact, as opposed to high level programming which is closer to the programmer. So procedural design models are a long step from implementation. They are multiple steps that have to be passed before they reach the level of operations.
The Object Oriented Programming model
OOP, on the other hand, stresses the importance on modeling problems. Here a program is successful when it solves the real-life problems it models. These programs correspond closely to the real-world problems they are designed to solve; they model user’s activities and problem domains. This ensures better communication and visualization for everyone involved, from the designer, to the programmer, to the tester. Object oriented designs begin with a visual “object model” using both the domain experts who understand the model and the software designers who will take the model and create a program.
The problem with procedural programming is that while the domain experts talk about the problem domain in terms of the lingo, the software designers talk about structures and bytes. Many times they are not able to convey a clear meaning to each other. On the other hand, OOP enables both the domain experts and software designers to talk in terms of objects in the problem domain. Modeling improves the understanding of the designer’s goal for the program.
Concepts in Object Oriented Programming
Defining object oriented programming introduces a number of powerful concepts that make it different from the pure modular approach. The principal OOP concepts are:
Objects – They represent real or abstract objects, with a name, which have well-defined responsibilities. They exhibit well-defined behavior. They have a well-defined interface, usually one that is as uncomplicated as possible. Objects are self-consistent, coherent, and complete; plus they are not particularly complex or large. This makes the objects easier to manage.
Classes – A class is the template that specifies the characteristics that belong to a certain type of objects. Objects are instances of classes. Classes define the object’s interface to the outside world. What is an interface? Well, for example, take the buttons in front of your television set; they create an interface between you and the electrical wiring located on the other side of the plastic casing. When you press the "power" button you interface to turn the TV on or off. Classes do similar things with objects; they form an interface with other programming objects.
Encapsulation – means that only the necessary interface is exposed to the outside world. The client part of the object does not need to know the internal details of those objects to which it has interactions.
Abstraction and Generalization – Abstraction means that you try to generalize problems and their solutions. With generalization you first ignore complex details and simplify the problem.
Inheritance – a way of describing a class by showing how it differs from another class. A pet is a class and a dog and cat are objects in that class.
Polymorphism (many-forms) – comes with inheritance. This is possible because all child classes have a relationship with the parent class. For example, if we say a dog is a pet, a dog can do all of the things that a pet can do. Polymorphism is also known as dynamic binding.
Source: Basic Object Oriented Concepts
Defining object oriented programming in layman’s terms begins by saying the OOP is a way of writing programs. They are more functional than the traditional procedure-oriented programs. Object oriented programming involves modeling and programming toward objects. There are some basic concepts in OOP. These are objects, classes, encapsulation, abstraction and generalization, inheritance, and polymorphism.