34
1/06 OOAD 1 Chapter 2: Introduction to Object-Oriented Systems Analysis and Design

Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 1

Chapter 2: Introduction to Object-Oriented Systems Analysis and Design

Page 2: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 2

Objectives

Understand the basic characteristics of object-oriented systems.Be familiar with the Unified Modeling Language (UML), Version 2.0.Be familiar with the Unified Process.Understand a minimalist approach to object-oriented systems analysis and design.

Page 3: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 3

Basic Characteristics of Object Oriented Systems

Classes and ObjectsMethods and MessagesEncapsulation and Information HidingInheritancePolymorphism and Dynamic Binding

Page 4: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 4

Classes and Objects

Object-oriented approach uses self-contained modules called objects (containing both data and processes) as the building blocks for developing a system.An object is a thing, both tangible and intangible. Account, Vehicle, Employee, etc.

Page 5: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 5

Classes and Objects (Cont.)

To create an object inside the computer program, we must provide a definition for objects—how they behave and what kinds of information they maintain —called a class.

Page 6: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 6

Classes and Objects

Class – Template to define specific instances or objectsObject – Instantiation of a class (i.e. an instance of a class)Attributes – Describes the objectBehaviors – specify what object can do

Page 7: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 7

Classes and Objects

Page 8: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 8

Methods and Messages

Methods implement an object’s behaviorAnalogous to a function or procedure

Messages are sent to trigger methodsProcedure call from one object to the next

Page 9: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 9

Messages and Methods

Page 10: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 10

Sending a Message

deposit 250.00

Message deposit with the argument 250.00 is sent to a BankAccountobject SV198.

Message deposit with the argument 250.00 is sent to a BankAccountobject SV198.

SV198 : BankAccount

Page 11: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 11

Sending a Message and Getting an Answer

current balance

getCurrentBalance()

Ask for the current balance of this particular account.

Ask for the current balance of this particular account.

SV198 : BankAccount

The current balance of SV198 is returned.

The current balance of SV198 is returned.

Page 12: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 12

Calling a Class Method

maximum speed

MobileRobot

getMaximumSpeed()

Ask for the maximum possible speed for all MobileRobot objects is returned.

Ask for the maximum possible speed for all MobileRobot objects is returned.

Page 13: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 13

Encapsulation and Information Hiding

Encapsulation combination of data and process into an entity

Information HidingOnly the information required to use a software module is published to the user

Reusability KeyUse an object by calling methods

Page 14: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 14

Inheritance

Superclasses or general classes are at the top of a hierarchy of classesSubclasses or specific classes are at the bottomSubclasses inherit attributes and methods from classes higher in the hierarchy

Page 15: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 15

Inheritance

Inheritance is a mechanism in OOP to design two or more entities that are different but share many common features.

Features common to all classes are defined in the superclass.The classes that inherit common features from the superclass are called subclasses.

We also call the superclass an ancestor and the subclass a descendant.

Page 16: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 16

Class Hierarchy

Page 17: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 17

Inheritance

Page 18: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 18

Polymorphism and Dynamic Binding

PolymorphismA message can be interpreted differently by different classes of objects

Dynamic BindingSometimes called late bindingDelays typing or choosing a method for an object until run-time

Static BindingType of object determined at compile time

Page 19: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 19

Polymorphish & Encapsulation

Page 20: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 20

The Unified Modeling Language, Version 2.0

Structure DiagramsBehavior DiagramsExtension MechanismsDevelopers

Grady BoochIvar JacobsonJames Rumbaugh

Page 21: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 21

Structure Diagram

Structure Diagrams includeClassObjectpackageDeploymentComponentComposite structure diagrams

Page 22: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 22

Structure Diagrams

Classrelationship between classes

ObjectRelationships between objects

PackageGroup UML elements together to form higher level constructs

Page 23: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 23

Structure Diagrams Cont.

DeploymentShows the physical architecture and software components of system

ComponentPhysical relationships among software components

Composite StructureIllustrates internal structure of a class

Page 24: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 24

Behavior Diagrams

ActivityIllustrates business workflows

SequenceTime-based ordering Behavior of objects activities in a use case

CommunicationCommunication among a set of collaborating objects of an activity

Interaction Overview TimingOverview of flow of control of a process

Page 25: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 25

State Machines

Behavioral State MachineExamines behavior of one class

Protocol State MachineShows dependencies of different interfaces of a class

Use-CaseCaptures business requirementsIllustrates interaction between system and environment

Page 26: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 26

Use Case Diagrams

Captures Business requirementsIllustrates interaction between a system and its environment

Includes end userAny external system that interacts with its information system

Documents and clarifies requirements of system being modeled

Page 27: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 27

Extension Mechanisms

StereotypesGives ability to incrementally extend UML

Tagged ValuesAdd new properties to base elements

ConstraintsPlace restrictions on use of model elements

ProfilesGroup model elements into a package

Page 28: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 28

Object-Oriented Development Approaches

• Use-case driven• Architecture Centric

• Functional view, static view, and dynamic view.

• Iterative and Incremental

Page 29: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 29

Benefits of the Object Approach

Page 30: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 30

The Unified Process

Page 31: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 31

Supporting Workflows

Page 32: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 32

A Minimalist Approach

Benefits of Object-Oriented Systems Analysis and DesignExtensions of the Unified ProcessThe Minimalist Object-Oriented Systems Analysis and Design Approach

Page 33: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 33

MOOSAD Approach

Page 34: Chapter 2: Introduction to Object-Oriented Systems ...cs.snru.ac.th/UserFiles/Unit02.pdf · Be familiar with the Unified Modeling Language (UML), Version 2.0. ... Understand a minimalist

1/06 OOAD 34

Summary

Basic characteristics of an object oriented systemUnified modeling LanguageUnified modeling systemObject oriented Systems Analysis and DesignMinimalist approach to Object oriented systems analysis and design with UML