You are on page 1of 20

Introduction

Topics

 Programming Languages
 Structured Programming vs Object Oriented Programming
 Structured Programming
 Object Oriented Programming
 Basics Concepts of Object Oriented Programming
 Benefits of OOP
 Applications of OOP
Programming Languages

What is a Program?
Programming Languages
A program is like a recipe. It contains a list of ingredients (called variables) and a list
of directions (called statements) that tell the computer what to do with the variables.
The variables can represent numeric data, text, or graphical images.

Let’s take an example of C program:

Recipe
Programming Languages
Let’s take an example of C program:

There are two ingredients from the above program a and b are called as
variables.
Programming Languages
Let’s take an example of C program:

There are four directions which are called as statements and tell the
computer to do these activities. They are:
1. Print the message “Enter first integer number ::”
2. Read integer value from user and store in variable a.
3. Print the message “Enter second integer number ::”
4. Read integer value from the user and store in variable b.
5. Add a + b and print message according the printf statement.
Programming Languages

Output of the above program:


Structured Programming vs Object Oriented Programming

 One characteristic that is constant in the software industry today is the “change”.
 Change is one of the most critical aspects of the software development and management.
 New tools and new approaches are announced almost every day.
 The Impact of these developments raises a number of issues that must be addressed by the
software engineers or software developers.
 Most important among them are maintainability, reusability, portability, security, and user
friendliness of software products.
Structured Programming vs Object Oriented Programming

Whether ‘C’ is a structured programing ?

Yes
Structured Programming vs Object Oriented Programming

Structured Programming:
 Structured programming is a programming paradigm aimed on improving the clarity, quality,
and development time of a computer program by making extensive use of subroutines, block
structures and for and while loops. Using of goto structure is discouraged because to the read
and maintain the code by the user will be difficult.
 C is structured programming became very popular and was the paradigm of the 1980’s.
 That enabled programmers to write moderately complex programs fairly easily.
 Code is given more importance
 As the programs grew larger, even structure approach failed in terms if bug-free, easy-to-
maintain and reusability of programs.
Structured Programming vs Object Oriented Programming

Object Oriented Programming:


 The major objective of Object oriented approach is to eliminate some of the flaws
encountered in structured programming approach.
 OOP treats data as a critical element in the program development and does not allow it to flow
freely around the system.
 It ties data more closely to the functions that operate on it and protect it from unintentional
modification by other functions.
 OOP allows us to decompose a problem into a number of entities called objects.
 The combination of data and methods make up an objects as shown in figure.

Object = Data + Method


Structured Programming vs Object Oriented Programming

Some of features of Object Oriented Programming:


 Emphasis is on data rather than procedure or function.
 Programs are divided into what are know as objects.
 Data is hidden and cannot be accessed by external functions
 Objects may communicate with each other through methods.
Structured Programming vs Object Oriented Programming

Basic Concepts of Object Oriented Programming:


 Classes and Objects
 Objects are the basic runtime entities in an object oriented programming. They may represent a
person, a place a bank account or any item that the program may handle. An object takes up space
in the memory and has an associated address like a structure in C.
 Each object contains data and code to manipulate the data.
 When a program is executed the objects interact by sending messages to one another.
 ‘customer’ and ‘account’ are two objects in a banking program. Then customer object may send a
message to the account object requesting for balance.
Structured Programming vs Object Oriented Programming

Basic Concepts of Object Oriented Programming:


 Data Abstraction and Encapsulation
 The wrapping up of data and methods into a single unit is know as encapsulation.
 The data is not accessible to the outside world and only those methods, which are wrapped in the
class can access it.
 Abstraction refers to the act of representing essential features without including the background
details or explanations.
 Classes use the concept the abstraction and are defined as a list of abstract attributes such as size,
weight and cost and methods that operate on those attributes.

MyCar is class and methods


are encapsulated with
members of the class. These
methods only work within
the class not outside the
class.
Structured Programming vs Object Oriented Programming

Basic Concepts of Object Oriented Programming:


 Inheritance
 Is the process by which objects of one class acquire the properties of objects of another class.
 The principle behind this sort of division is that each derived class shares common characteristics
with the class from which it is derived.
 The concept of inheritance provides the idea of reusability. This means we can add additional
features to an existing class without modifying it.

The Robin is a part of the class


FlyingBird, which is again a
part of the class Bird. Thus
Robin will shares the common
characteristics of the classes
FlyingBrid and Bird.
Structured Programming vs Object Oriented Programming

Basic Concepts of Object Oriented Programming:


 Polymorphism
 Polymorphism means ability to take more than one form.
 For Example: Consider the operation of addition for two numbers, the operation will generate a
sum. If the operands are strings, then the operation would produce a third string.

The figure illustrates that a single function name can be used to handle
different number and different types of augments.
Structured Programming vs Object Oriented Programming

Basic Concepts of Object Oriented Programming:


 Dynamic Binding
 Binding refers to the linking of a procedure call to the code to be executed in response to the call.
 Dynamic binding means that the code associated with a given procedure call is not known until the
time of the call at runtime.
 It is associated with polymorphism and inheritance.

 Message Communication
 As object oriented program consists of a set of objects that communicate with each other involves
the following basic steps.
1. Creating classes that define objects and their behavior.
2. Creating objects from class definition.
3. Establishing communication among objects.
 Objects communicate with one another by sending and receiving information much same way as
people pass messages to one another.
Benefits of OOP

OOP offers several benefits to both the program designer and the user. Some of the benefits are listed.

 Through inheritance, the programmer can eliminate redundant code and extend the use of existing
classes.
 The principle of data hiding helps the programmer to build secure programs that cannot be invaded
by code in other parts of the program
 It is easy to divide the work in a project based on objects.
 It is possible to have multiple objects to coexist without any interference.
 Message passing techniques for communication between objects make the interface description
with external systems much simpler.
 Software complexity can be easily managed.
Applications of OOP

The promising areas for application of OOP includes

 Real time systems


 Simulation and modeling
 Object oriented databases
 Hypertext, hypermedia
 AI and expert systems
 Neural networks and parallel programming
 Decision support and office automation systems
 CIM/CAD systems

Object oriented technology is certainly changing the way software engineers think, analyze, design and
implement systems today.
?

You might also like