Introduction to Object Oriented Design Dumitru Radoiu Dumitru - - PowerPoint PPT Presentation

introduction to object oriented design
SMART_READER_LITE
LIVE PREVIEW

Introduction to Object Oriented Design Dumitru Radoiu Dumitru - - PowerPoint PPT Presentation

Introduction to Object Oriented Design Dumitru Radoiu Dumitru Radoiu Spring 2009 PETRU MAIOR UNIVERSITY Agenda The Characteristics of Object Oriented Design (OOD) The Characteristics of Object Oriented Design (OOD) The Use


slide-1
SLIDE 1

Introduction to Object‐Oriented Design

Dumitru Radoiu Dumitru Radoiu

Spring 2009

PETRU MAIOR UNIVERSITY

slide-2
SLIDE 2

Agenda

  • The Characteristics of Object Oriented Design (OOD)
  • The Characteristics of Object‐Oriented Design (OOD)
  • The Use of Classes in OOD
  • The use of Inheritance in OOD
  • The Use of Polymorphism in OOD
  • Creating a Class Diagram: Case Study
slide-3
SLIDE 3

Software development activities time Customer

Analysis Design Implementation

= attempt to understand = model the behavior = implement the model Requirements Deliverables Needs

Exclusions Baseline Implementation

Requirements Needs

Specifications Baseline Implementation

slide-4
SLIDE 4

Procedural approach = multiple procedures modify global data time

Analysis Design Implementation

= attempt to understand = model the behavior = implement the model Requirements Deliverables Needs

Edit Data Load Data P i t D t

Requirements Needs

View Data Save Data Print Data

Everything is exposed; Everything is exposed; updating business rules does not update the entire application.

slide-5
SLIDE 5

Object-Oriented approach: objects talk to other objects to complete a task time

Analysis Design Implementation

= attempt to understand = model the behavior = implement the model Requirements Deliverables Needs Data Requirements Needs Functionality Functionalities are Functionalities are encapsulated; only some are exposed (Interfaces)

slide-6
SLIDE 6

Object-Oriented Analysis (OOA) time

OO Analysis Design Implementation

= what abstract entities/objects are required to future system? = model the behavior = implement the model Requirements Deliverables Needs Data Requirements Needs Functionality Functionalities are Functionalities are encapsulated; only some are exposed (Interfaces)

Object

slide-7
SLIDE 7

Object-Oriented Design (OOD) time

OO Analysis OO Design Implementation

= implement the model = model the behavior for the system to exist = what abstract entities/objects are required to future system? Requirements Deliverables Needs Data Requirements Needs Functionality

Object

slide-8
SLIDE 8

Object-Oriented Programming (OOP) time

OO Analysis OO Design OO Programming

= implement the model in an Object Oriented Language (OOL) = model the behavior for the system to exist = what abstract entities/objects are required to future system? Requirements Deliverables Needs Data Requirements Needs Functionality

slide-9
SLIDE 9

Object-Oriented World time

OO Analysis OO Design OO Programming

Create the vocabulary Give vocabulary Program the model Requirements Deliverables vocabulary

  • cabu a y

behavior (model the system)

  • de
slide-10
SLIDE 10

Object-Oriented Design time

OO Analysis OO Design OO Programming

Create the vocabulary Give vocabulary Program the model Requirements Deliverables vocabulary

  • cabu a y

behavior (model the system)

  • de

Principles: 1. Classes (abstraction and encapsulation) 2. Inheritance 3. Polymorphism

slide-11
SLIDE 11

Agenda

  • The Characteristics of Object Oriented Design (OOD)
  • The Characteristics of Object‐Oriented Design (OOD)
  • The Use of Classes in OOD
  • The use of Inheritance in OOD
  • The Use of Polymorphism in OOD
  • Creating a Class Diagram: Case Study
slide-12
SLIDE 12

What makes a class: abstraction (= create a general term for an item)

transportation plane ship automobile truck car SUV

“A ____ is a type of ____.”

slide-13
SLIDE 13

What makes a class: encapsulation ( = stuff the item with data and functionality)

name data functionality functionality name

black box

name data input

  • utput

functionality input

  • utput

Interface = restricted access to functionality = lower maintenance & problem prevention

slide-14
SLIDE 14

Object-Oriented Programming (OOP) time

OO Analysis OO Design OO Programming

= implement the model in an Object Oriented Language (OOL) = model the behavior for the system to exist = what abstract entities/objects are required to future system? Requirements Deliverables Needs Data Requirements Needs Functionality

slide-15
SLIDE 15

Object-Oriented Programming (OOP) time

OO Analysis OO Design OO Programming

= implement the model in an Object Oriented Language (OOL) = model the behavior for the system to exist = what abstract entities/objects are required to future system? Di l Requirements Deliverables Needs Data Display

  • Data

+Print() Requirements Needs

  • Data

+Save() +Load() +View() Menu Load()

  • Data

+Create() +Edit()

slide-16
SLIDE 16

Agenda

  • The Characteristics of Object Oriented Design (OOD)
  • The Characteristics of Object‐Oriented Design (OOD)
  • The Use of Classes in OOD
  • The use of Inheritance in OOD
  • The Use of Polymorphism in OOD
  • Creating a Class Diagram: Case Study
slide-17
SLIDE 17

transportation

The use of Inheritance in OOD

transportation plane ship automobile truck car SUV

slide-18
SLIDE 18

The use of Inheritance in OOD

Superclass Subclass A Subclass B Subclass C Subclass C1 Subclass C2 Subclass C3

slide-19
SLIDE 19

The use of Inheritance in OOD

automobile

  • Nr OfWheels

Nr.OfWheels +Drive() +Reverse() +Park() Park() truck car SUV

  • Nr.OfGears
  • Nr.OfTanks
  • TrunkSize
  • SafetyWindows
  • 4WD
  • BullBar

+ Tow() +Load() +Unload() + Trolley()

slide-20
SLIDE 20

Multiple Inheritance

Vehicle

  • FuelType
  • SeatingCapacity

Weapon

  • ArtileryCapacity
  • ArtileryType

+Drive() +Reverse() +Park() +Start() +Load() +Fire() +Aim() +Start() +Stop() Tank

  • Model

+ Ram() +Radio()

slide-21
SLIDE 21

Agenda

  • The Characteristics of Object Oriented Design (OOD)
  • The Characteristics of Object‐Oriented Design (OOD)
  • The Use of Classes in OOD
  • The use of Inheritance in OOD
  • The Use of Polymorphism in OOD
  • Creating a Class Diagram: Case Study
slide-22
SLIDE 22

The use of Polymorphism in OOD

Animal

  • Nr.OfEyes
  • Nr.OfLegs

+ Eat() +Sleep() Lion Bird + Run() +Sleep() + Fly() +Sleep() Polymorphism = classes with the same interface operate on their data differently

slide-23
SLIDE 23

Agenda

  • The Characteristics of Object Oriented Design (OOD)
  • The Characteristics of Object‐Oriented Design (OOD)
  • The Use of Classes in OOD
  • The use of Inheritance in OOD
  • The Use of Polymorphism in OOD
  • Creating a Class Diagram: Case Study
slide-24
SLIDE 24

Creating a Class Diagram: Case study Information to build the class diagram:

  • A student can be an undergraduate student or a graduate student

g g

  • An undergraduate student can be a type of tutor
  • A tutor tutors a student
  • A teacher and a professor are two types of instructors

eac e a d a p o esso a e

  • ypes o

s uc o s

  • A teacher assistant can assist a professor and a teacher; a teacher

can be assisted by one assistant, while a professor can be assisted by up to five assistants

  • A teacher assistant is a type of graduate student
slide-25
SLIDE 25
  • A student can be an undergraduate student or a graduate student
  • A student can be an undergraduate student or a graduate student

Student U d d t G d t Undergraduate Graduate

slide-26
SLIDE 26

An undergraduate student can be a type of tutor An undergraduate student can be a type of tutor

Student T t U d d t G d t Tutor Undergraduate Graduate

slide-27
SLIDE 27

A tutor tutors a student A tutor tutors a student

Student T t tutors> U d d t G d t Tutor Undergraduate Graduate

slide-28
SLIDE 28

A teacher and a professor are two types of instructors A teacher and a professor are two types of instructors

Student T t tutors> Instructor U d d t G d t Tutor Undergraduate Graduate Teacher Professor

slide-29
SLIDE 29

A teacher assistant can assist a professor and a teacher; a teacher can b i d b i hil f b i d b be assisted by one assistant, while a professor can be assisted by up to five assistants

Student T t tutors> Instructor U d d t G d t Tutor Undergraduate Graduate Teacher Professor 1 1 TeacherAssistant 0..1 0..4

slide-30
SLIDE 30

A teacher assistant is a type of graduate student

Student tutors> Instructor Tutor tutors> Undergraduate Graduate Teacher Professor 1 1 TeacherAssistant 0..1 0..4

slide-31
SLIDE 31
slide-32
SLIDE 32

Project

Read the following scenario and perform the required activities:

The assigned project requires to build an on‐line store with the following characteristics: ‐ Customers can buy different physical objects which will be delivered f ll i t following payment ‐ Payment can be made via credit card (arrangements with a third party are already made)

Activities:

  • 1. Using BPMN (Business Process Modeling Notation) model the business

2 D th U C Di f ft t hi h t th b i

  • 2. Draw the Use Case Diagram of a software system which supports the business
  • 3. Draw the Sequence Diagram for each Use Cases
  • 4. Draw the Activity Diagram for each Use Case
  • 5. Draw the Class Diagrams for the system