Você está na página 1de 20

Introduction to Object

Oriented Programming

Evolution of Programming
Paradigms
Structured Programming
Large programming project
Emphasis on algorithm rather than data
Programs are divided into individual
procedures that perform discrete tasks
Procedures are independent of each
other as far as possible
Procedures have their own local data
and processing logic

Evolution of Programming
Paradigms
Parameter passing facility between the
procedures for information communication
Introduced the concept of user defined data
types
Support modular programming
Projects can be broken up into modules and
programmed independently
Scope of the data items is controlled across
modules
Maintenance of a large software system is
tedious and costly

Object oriented programming


language
Object oriented programming is a method of
implementation in which programs are organized as cooperative collection of objects, each of which represents
an instance of some class and whose classes are all
members of hierarchy of classes united through the
property called inheritance.
Object Based Programming Languages
Encapsulation
Object Identity

Example
Ada

Object Oriented Programming Languages


Object Based features

Object oriented programming


language
Inheritance
Polymorphism

Example
C++, Java, Smalltalk, Eiffel

Developed by Bjarne Stroustrup at


AT&T Bell Laboratories in USA
Incremented version of C
Superset of C

Evolution of Programming
Paradigms
Object Oriented Programming
OOP treats data as a critical element
Emphasis on data rather than algorithm
Decompose the problem into number of
entities namely objects
Doesnt allow data to flow freely around
the system
Data is hidden and cannot be accessed
by external function

Evolution of Programming
Paradigms
Data and the functions that operate on
the data are tied together in the data
structure
Object may communicate with each
other through functions
New data and functions can be added
whenever necessary
Follows bottom up approach

Basic Concepts of Object Oriented


Programming

Object
Classes
Data abstraction
Encapsulation
Inheritance
Polymorphism
Dynamic Binding
Message Passing

Basic Concepts of Object Oriented


Programming
Object
Objects are the basic run time entities in
an object oriented system
Object is a instance of class
We can say that objects are variables of
the type class
Objects can be student, employee, car,
book, etc

Basic Concepts of Object Oriented


Programming
Object representation

Basic Concepts of Object Oriented


Programming
Classes
A class is a user defined data type.
A class is a collection of data member and member
functions.
Variable declared in class are called data member
and functions declared in class are known as
member functions.
A class is an abstraction of the real world entities
with similar properties.
A class identifies a set of similar properties.
A class is an implementation of abstract data type.

Basic Concepts of Object Oriented


Programming
Data Abstraction
Abstraction refers to the act of
representing essential features without
including the background details or
explanations.
Classes use the concept of abstraction
and are defined as a list of abstract
attributes such as size, weight, cost etc.

Basic Concepts of Object Oriented


Programming
Encapsulation
The wrapping 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.

Basic Concepts of Object Oriented


Programming
Inheritance
Inheritance is the process by which
objects of one class acquire the
properties of objects of another class.
Create a new class from existing class.
The main benefits of the Inheritance is
code reusability.
Add additional features to an existing class
without modifying it.

Basic Concepts of Object Oriented


Programming
Polymorphism
Polymorphism is a Greek term.
It means the ability to take more than one form.
An operation may exhibit different behaviors in
different instances.
The behavior depends upon the type of data
used in the operation.
For adding two number operation will generate sum
of two number.
For adding two string operation will concate two
string.

Basic Concepts of Object Oriented


Programming
Dynamic Binding(Late Binding)
Binding refers to the linking of a
procedure call to the code to be
executed in response to call.
Dynamic binding means that the code
associated with a given function call is not
known until the time of the call at run time.

Basic Concepts of Object Oriented


Programming
Message Passing
Objects communicate with one another
by sending and receiving information.

Student.setData(Id, Name);

Object

Messag
e

Informati
on

Advantages of OOP
Through inheritance, redundant code is
eliminated and extend the use of existing
classes.
One can build programs from the standard
working modules that communicate with one
another.
No need to write from scratch.
Save the development time and increase the
productivity.

The principal of data hiding helps the


programmer to build the secure program.

Advantages of OOP
The data centered design approach enable
programmer to get details of a model in
implementable form.
Possible to map objects in the problem
domain to those in the program.
It is easy to partition the work in project
based on objects.
Easily upgradable from small system to large
system.
Software complexity can be easily managed.

Application of OOP
What are the applications of OOP?
What are the application of C++?

Você também pode gostar