You are on page 1of 6


Procedure Oriented Programming Programs are made up of modules, which are parts of a program that can be coded and tested separately, and then assembled to form a complete program. In procedural languages (i.e. C) these modules are procedures, where a procedure is a sequence of statements. These procedures are functions. The design method used in procedural programming is called Top Down Design. i.e, start with a problem (procedure) and then systematically break the problem down into sub problems (sub procedures). This is called functional decomposition. The primary focus is on functions.

Typical structure of procedure oriented programs

Some characteristics of Procedure Oriented Programming are :1) Emphasis is on doing things(algorithms). 2) Large programs are divided into smaller programs known as functions. 3) Most of the functions share global data. 4) Data is passed from function to function. 5) Top-down approach is used in program design. Drawbacks: 1. 2.

In a large program it is very difficult to find or identify what data is being used by which function. It does not model real world problem very well.

Object Oriented Programming (OOP) :In object oriented programming, the main modules in a program are classes, rather than procedures. The object-oriented approach allows to create classes and objects that model real world objects.

a place. Program objects should be chosen such that they match closely with the realworld objects. They exhibit both state and behavior The object state is shown in the form of one or more variables and the behavior is implemented using functions. Definition of OOP An approach resulting in modular programs by creating partitioned memory are for both data and functions.Object oriented programming allows a decomposition of a problem into number entities called objects and then builds data and functions around these objects. 6) New data and functions can be easily added whenever necessary. 4) Data is hidden and cannot be accessed by external functions. a bank account. functions of one object can access the functions of other objects. Objects      Objects are the basic run-time entities in an object-oriented system. Organization of data and functions in object oriented programming Characteristics of Object Oriented Programming are :1) Emphasis is on data. a table of data or any item that the program must handle. They may represent a person. However. Basic concepts of OOP 1. 2) Programs are divided into objects. The data of an object can be accessed only by the functions associated with that object. 3) Objects contain the data and the functions that operate on the data. which can be used as templates for creating copies of such modules. 5) Objects may communicate with each other through functions. 7) Bottom-up approach is used in program design. .

Characteristics of an object are represented in a class as Properties. Class      Objects with similar properties and methods are grouped together to form a Class. Objects take up space in the memory and have an associated address like structure in C. It helps in binding data and the functions together. Class = Storage + Behaviour 3. Class represents a set of individual objects. This insulation of the data from direct access by the program is called data hiding or information hiding. The actions that can be performed by objects become functions of the class and is referred to as Methods. Data Encapsulation    The wrapping up of data and functions into a single unit is known as Encapsulation The data is not accessible to the outside world and only those functions which are wrapped in the class can access it. . Representation of an object 2.  When a program is executed the objects interact by sending messages to one another. 4. Data Abstraction   Abstraction refers to the act of representing essential features without including the background details.

Example: Operation of addition. If the operands are strings. That is an operation may exhibit different behaviours in different instances. This is known as reusability. 6. This means that we can add additional features to an existing class without modifying it. . the new class that is formed is called derived class. 9. The base class is also known as parent class or super class. The behavior depends upon the types of data used in the operation. The process of making an operator to exhibit different behaviours indifferent instances is known as operator overloading. Static binding is the binding that takes place during compilation. 7. For two numbers the operation will generate a sum. Message Communication  An object-oriented program consists of a set of objects that communicate with each other. Inheritance helps in reducing the overall code size of the program. It is also called as early binding Dynamic binding or late binding means that the code associated with a given procedure call is not known until the time of the call at run-time Dynamic binding is associated with polymorphism and inheritance. then the operation would produce a third string by concatenation. Reusability    Once a class is created and tested and ready to use. In OOP the concept of inheritance provides the idea of reusability. Polymorphism       Polymorphism means the ability to take more than one form.5. Inheritance     Inheritance is the process of forming a new class from an existing class or base class. 8. Derived class is also known as a child class or sub class. Dynamic Binding      Binding refers to the linking of a procedure call to the code to be executed in response to the call. There are two types of binding: static binding and dynamic binding. it can be distributed to other programmers for using in their own programs. Using a single function name to perform different types of tasks is known as function overloading.

The problem is solved by interfacing the objects. 2. they can be classified into the following two categories: . 6. Depending upon the features they support. since the only public interface that the external world has to a class is through the use of methods. the name of the funciton (message) and the information to be sent. Each object is responsible for a specific task. 5. Object-Oriented Languages   The languages should support several of the OOP concepts to claim that they are objectoriented. This technique reduces the complexity of the program design. It helps the programmer to build the secure programs. Modifiability: it is easy to make minor changes in the data representation or the procedures in an OO program. Reduced complexity of a problem: The given problem can be viewed as a collection of different objects. Reusability: In OOP’s programs functions and modules that are written by a user can be reused by other users without any modification. 7. 3. Changes inside a class do not affect any other part of a program. Message passing involves specifying the name of the object. Message Passing: The technique of message communication between objects makes the interface with external systems easier. Data Hiding: The programmer can hide the data and functions in a class from other classes. 4.  Object communicates with one another by sending and receiving information much the same way as people pass message to one another. Inheritance: Through this we can eliminate redundant code and extend the use of existing classes. Easy to Maintain and Upgrade: OOP makes it easy to maintain and modify existing code as new objects can be created with small differences to existing ones. Benefits of OOPs 1.

Data is not secure and can be corrupted 3. namely. Uses bottom.Oriented Programming 1. Uses top-down programming design 4. Focus is on the data 2.up programming design 4.     Object-based programming languages  Object-oriented programming languages Object-based programming is the style of programming that primarily supports encapsulation and object identify.Oriented Programming and Object-Oriented Programming Procedure. inheritance and dynamic binding. Data is secure 3. Programs are divided into functions Object-Oriented Programming 1. Models real world problems 5. Object-based features + inheritance + dynamic binding Applications of using OOP:       Real Time Systems Simulation and Modeling Object oriented databases AI and Expert System Neural Networks Decision support and office automation system etc. Object-oriented programming incorporates all of object-based programming features along with two additional features. Does not model real world problems 5. Programs are divided into objects . Comparison of Procedure. Focus is on the functions 2.  Major features: * Data encapsulation * Data hiding and access mechanisms * Automatic initialization and clear-up objects * Operator overloading They do not support inheritance and dynamic binding.