Object oriented vs. object based programming

Preview:

Citation preview

1

Welcome

Special Thanks To

Md. Sharif Hossen Lecturer Department of ICT Comilla University.

2

Object-Oriented Vs. Object based Programming

Id Name1109025 Partha Chakrabarty 1109026 Md. Mujibur Rahman Majumder1109028 Md. Natik Alam Bhuyan Tahsin1109031 Md. Al Fahad1109032 Md. Rashedul Islam

Presented By :

Outline3

OverviewClass and Object. Object- oriented ProgrammingObject based ProgramingObject based vs. object-oriented

programmingConclusion

Overview

4

What is a Class?

What is a Object?

What is an Object-Oriented Programming?

Requirements of Object-Oriented language.

What is an Object Based Programming?

Why we use object based instead of object oriented programming?

Difference between Object based and Object-Oriented Programming?

What is a Class? 5

A class can be defined as a template/blueprint that describes the state or behavior of objects of certain kinds.

Class Contain Properties and Function. Example : Student , Animal, Car etc.

What is an Object? 6

Object refers to a particular instance of a class where the object can be a combination of variables, functions, and data structures.

An object consists of data of its own.

Example of Class and Object. 7

Example of Class and Object Programmatically

8

Object-Oriented Programming9

The basic idea behind an Object Oriented Programming language is to combine into a single unit both data and the methods (functions) that operate on the data.

Some of the popular OOP languages are - C++ Java C#

Requirements for OOP10

To be object oriented, a language must support

Encapsulation

Inheritance

Polymorphism

Encapsulation11

The whole idea behind the data encapsulation is to hide the implementation details from users. This is achieved through the state (the private fields) and the behaviors (the public methods) of a Class.

Often, for practical reasons, an object may wish to expose some of its variables or hide some of its methods.

Encapsulation uses three common types of modifier to encapsulate data.

Public Private Protected

Inheritance

12

Inheritance is a fundamental feature of an Object-Oriented programming. It is the process of creating a new Class, called the Derived Class, from the existing class, called the Base Class

Inheritance is a very elegant way to reuse and modify the data and functionality that has already been defined in the Base Class, also we can add new data and functionality to the Derived Class.

Inheritance Contd.

13

Since the Derived Class inherits all properties of the Base Class, the Derived Class has a larger set of properties than the Base Class.

However, the Derived Class may override some or all the properties of the Base Class.

Types of Inheritance

14

A

B

C

A B

C

A-1

A-2

B-1

B-2

AB

Multi-level Inheritance

Multiple Inheritance

Multiple Multi-level Inheritance

Polymorphism

15

The ability to appear in many forms. In object-oriented programming, polymorphism refers to a

programming language's ability to process objects differently depending on their data type or class.

Polymorphism allows us to invoke derived class methods through a base class reference during runtime.

E.g. e-bike Acceleration system. Electronically / Mechanically

Polymorphism contd.

16

Object Based Programming

17

Object Based Programming is based on the idea of encapsulating state and operations inside “objects”.

Object-based languages need not support inheritance or polymorphism . While Object oriented language support all feature of OOPS i.e. Inheritance, polymorphism etc.

Object Based Language Build in type object are available like window object in JavaScript .

Example: JavaScript, VB

Why we use Object based instead of OOP

18

The main benefit of Object based Programming is that it can be understood by the common human.

Object Based is much easier and more robust than Object Oriented.

It allows for fast creation of web page events. It allows more freedom in the creation of

objects.

http://www.htmlgoodies.com/beyond/javascript/article.php/3470971

Drawbacks of object based programming

19

Object based programming is less secure. Because the code executes on the user’s computer, in some cases it can be exploited for malicious purposes.

Object based programming sometimes interpreted differently by different browsers.

http://www.htmlgoodies.com/beyond/javascript/article.php/3470971

Object based Programming Object oriented Programming

Object-based language doesn't support all the features of OOPs like Polymorphism and Inheritance.

Object-based language has built-in object like JavaScript has window object.

Examples : JavaScript, VB etc.

Object-oriented language supports all the features of OOPs

.Object-oriented language

doesn't have built-in object.

Examples : C++, C#, Java etc.

20

Object based vs. Object-oriented programming

Conclusion 21

From the above discussion, we clearly understand about the difference between Object Based and Object Oriented Programming and also when we use Object based instead of Object Oriented Programming.

Question ?

22

23

Recommended