23
1 Welcome Special Thanks To Md. Sharif Hossen Lecturer Department of ICT

Object oriented vs. object based programming

Embed Size (px)

Citation preview

Page 1: Object oriented vs. object based  programming

1

Welcome

Special Thanks To

Md. Sharif Hossen Lecturer Department of ICT Comilla University.

Page 2: Object oriented vs. object based  programming

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 :

Page 3: Object oriented vs. object based  programming

Outline3

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

programmingConclusion

Page 4: Object oriented vs. object based  programming

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?

Page 5: Object oriented vs. object based  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.

Page 6: Object oriented vs. object based  programming

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.

Page 7: Object oriented vs. object based  programming

Example of Class and Object. 7

Page 8: Object oriented vs. object based  programming

Example of Class and Object Programmatically

8

Page 9: Object oriented vs. object based  programming

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#

Page 10: Object oriented vs. object based  programming

Requirements for OOP10

To be object oriented, a language must support

Encapsulation

Inheritance

Polymorphism

Page 11: Object oriented vs. object based  programming

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

Page 12: Object oriented vs. object based  programming

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.

Page 13: Object oriented vs. object based  programming

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.

Page 14: Object oriented vs. object based  programming

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

Page 15: Object oriented vs. object based  programming

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

Page 16: Object oriented vs. object based  programming

Polymorphism contd.

16

Page 17: Object oriented vs. object based  programming

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

Page 18: Object oriented vs. object based  programming

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

Page 19: Object oriented vs. object based  programming

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

Page 20: Object oriented vs. object based  programming

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

Page 21: Object oriented vs. object based  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.

Page 22: Object oriented vs. object based  programming

Question ?

22

Page 23: Object oriented vs. object based  programming

23