Top Banner
A Presentation on- OBJECT ORIENTED PROGRAMMING
24
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Object oriented programming

A Presentation on-

OBJECT ORIENTED PROGRAMMING

Page 2: Object oriented programming

O.O.P. is favoured so much as it overcomes the limitations of other programming paradigms.

LIMITATION OF PROCEDURAL PROGRAMMING-

As it focuses on the procedure taken rather than the data, it is susceptible to design changes and leads to increased time and cost overheads during these. It doesn’t incorporate data reusability.

LIMITATION OF OBJECT BASED PROGRAMMING-

It is a subset of OOP, but, it fails to represent real world relationships that exist b/w objects as it doesn’t incorporate “inheritance”.

Why Object Oriented

Programming ?

Page 3: Object oriented programming

HOW DOES O.O.P. WORK

The concepts that O.O.P. incorporates helps it work on the limitations of other programming paradigms. These are-

Data abstraction

Data encapsulation

Modularity

Inheritance

Polymorphism

Page 4: Object oriented programming

The general concepts of

Object Oriented

Programming concepts in

C++

Page 5: Object oriented programming

DATA ABSTRACTIONDefinition-

The act of representing essential features without including the background details or explanations.

Levels of abstraction-

Physical level: The lowest level of abstraction describes how a system actually stores data.

Logical level: The next higher level of abstraction describes what data the database stores, and what relationships exist among those data .

View level: The highest level of abstraction describes only part of the entire database

Page 6: Object oriented programming

Diagram showing the levels of abstraction

Page 7: Object oriented programming

Example of Data Abstraction

A Sales Person

Real world

Genetic history Name

Cars sold

Talents

Credit record

Family

Commission rate

Medical history

Page 8: Object oriented programming

Example of Data Abstraction

A Sales Person

Cars sold

Name

Commission rateAbstraction for sales tracking system

Page 9: Object oriented programming

DATA ENCAPSULATIONDefinition –

The wrapping up of data and functions into a single unit (which is called class).

Encapsulation means that some or all of an object's internalstructure is "hidden" from the outside world.

Hidden information may only be accessed through theobject's methods, called the object's public interface.

Access to object is safe, controlled.

Page 10: Object oriented programming

Example of Data Encapsulation

HR dept.

AccountsDept.

Purchase dept.

Production dept.

Sales dept..

Head of dept.Supervisors

WorkersClerks

Records and folders

Internal structure of dept.

Quality Dept.

Various departments of a company

Page 11: Object oriented programming

Encapsulation for class builders and class users.

Page 12: Object oriented programming

MODULARITYDefinition-

It is the property of a system that has been decomposed into a set of cohesive and loosely coupled modules.

Importance-

1) It reduces the complexity to some degree.

2) It creates a number of well-defined, documented boundaries within the program (known as sub-routines).

How it is implemented in C++ -

In C++, it is implemented through separately compiled files, namely, the header files. These can be used in programs through the #include directive.

Page 13: Object oriented programming

Example of Modularity

Home theatre

Even though the parts of the home theater are complete units in themselves, yet they are a subpart of the home theater.

Page 14: Object oriented programming

Example of Modularity in C++

The use of data as

is also modularity.

Page 15: Object oriented programming

INHERITANCEDefinition-

It is the capability of one class to inherit capabilities or properties from another class.

Importance-

1) It ensures closeness with the real world.

2) It implements the idea of reusability.

3) It is transitive in nature.

Major advantage-

If a class B is inheriting from another class A and class C is inheriting from class B (thus, A becomes the base class).If we later find a mistake in class A and rectify it, it is automatically reflected in the classes B and C too. This reduces overhead costs and time which were a major problem in Procedural Programming.

Page 16: Object oriented programming

Inheritance Schemes

Page 17: Object oriented programming

Example of Inheritance

Vehicles

Automobiles(motor driven)

Pulled vehicles

Rickshaw

CartBusCar

Page 18: Object oriented programming

POLYMORPHISMDefinition-

The ability for a message or data to be processed in more than one form

The simplest way to define it is- “ONE ENTITY, MANY FORMS”

Means the same name can be assigned to differentfunctions/methods: the actual function triggered by thename is determined by the types of the arguments.

It is sometimes called overloading.

It allows designers to use the most "natural" and understandablenames for functions. Example-

Page 19: Object oriented programming

Example of Polymorphism

Mammals Mammals

Whale

Man

Dog

Rat

Cat

RatCat

See through daylight See through darkness

Page 20: Object oriented programming

Polymorphism for class builders and class users.

Page 21: Object oriented programming

Advantages and

disadvantages of Object Oriented

Programming concepts

Page 22: Object oriented programming

Advantages of OOP

•Quick development as parallel development of classes is possible.•Reusability.•Easier to test manage and maintain•Easy to understand.•Models the real world well.

Page 23: Object oriented programming

Disadvantages of OOP

•Design is tricky.•Overly generalized classes.•Proper planning and design is required•Artificial at times.•Needs proper skills such as programming skills, thinking in terms of objects..

Page 24: Object oriented programming

Thank

You