OOPS characteristics in java programming, Lecture notes of Java Programming

Introduction to Object Oriented Design

Typology: Lecture notes

2018/2019

Uploaded on 06/26/2019

radhipriya
radhipriya 🇮🇳

1 document

1 / 47

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Introduction to Object
Oriented Design
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f

Partial preview of the text

Download OOPS characteristics in java programming and more Lecture notes Java Programming in PDF only on Docsity!

Introduction to Object

Oriented Design

Overview

Understand Classes and Objects.

Understand some of the key

concepts/features in the Object

Oriented paradigm.

Benefits of Object Oriented Design

paradigm.

Examples of Objects

Figure 1. 9 : Examples of objects

CAR

VDU

BOY GIRL

BOOK TREE

CLOCK

TRIANGLE

Classes: Objects with the same

attributes and behavior

Person Objects Vehicle Objects Polygon Objects

Abstract Person^ Class

Attributes:

Operations:

Name, Age, Sex Speak(), Listen(), Walk()

Into

Abstract Vehicle^ Class

Attributes:

Operations:

Name, Model, Color Start(), Stop(), Accelerate()

Into

Abstract

Polygon Class

Attributes:

Operations: Draw(),^ Erase(),^ Move()

Vertices, Border,

Into^ Color,^ FillColor

Figure 1. 12 : Objects and classes

Java’s OO Features

OOP

Paradigm

Encapsulation

Multiple Inheritance

Genericity

Delegation

Persistence

Polymorphism

Single Inheritance

Data Abstraction

Java

Encapsulation

It associates the

code and the data

it manipulates into

a single unit; and

keeps them safe

from external

interference and

misuse.

OOP

Paradigm

Encapsulation

Multiple Inheritance

Genericity

Delegation

Persistence

Polymorphism

Single Inheritance

Data Abstraction

Data

Functions

Abstract Data Type (ADT)

A structure that contains both

data and the actions to be

performed on that data.

Class is an implementation of an

Abstract Data Type.

Class- Example

class Account {

private String accountName;

private double accountBalance;

public withdraw();

public deposit();

public determineBalance();

} // Class Account

Objects

An Object Oriented system is a

collection of interacting Objects.

Object is an instance of a class.

Classes/Objects

Student

:John

:Jill

John and Jill are

objects of class

Student

Circle

:circleA

:circleB

circleA and

circleB are

objects of class

Circle

Object

Objects have state and classes don’t.

John is an object (instance) of class Student.

name = “John”, age = 20, studentId = 1236

Jill is an object (instance) of class Student.

name = “Jill”, age = 22, studentId = 2345

circleA is an object (instance) of class Circle.

centre = (20,10), radius = 25

circleB is an object (instance) of class Circle.

centre = (0,0), radius = 10

Encapsulation

All information (attributes and methods)

in an object oriented system are stored

within the object/class.

Information can be manipulated through

operations performed on the object/class

– interface to the class. Implementation is

hidden from the user.

Object support Information Hiding – Some

attributes and methods can be hidden

from the user.

Data Abstraction

The technique of creating new data

types that are well suited to an

application.

It allows the creation of user defined

data types, having the properties of

built in data types and more.

Abstraction - Example

class Account {

private String accountName;

private double accountBalance;

public withdraw();

public deposit();

public determineBalance();

} // Class Account

Creates a data

type Account

Account acctX;