265
An ISO 9001:2000 Certified Organization MCS-032 Object Oriented Analysis & Design

MCS-032 Object Oriented Analysis & Design

Embed Size (px)

DESCRIPTION

MCS-032 Object Oriented Analysis & Design. Block -1 Object Oriented Modeling and UML. Object Orientation. What Is Object Orientation Advantages of Object Orientation Elements of Object Model What is UML Goals Of UML Systems Phases In System Development. 3. - PowerPoint PPT Presentation

Citation preview

Page 1: MCS-032 Object Oriented Analysis & Design

An ISO 9001:2000 Certified Organization

MCS-032Object Oriented Analysis & Design

Page 2: MCS-032 Object Oriented Analysis & Design

An ISO 9001:2000 Certified Organization

Block -1Object Oriented Modeling and UML

Page 3: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

3

Object Orientation• What Is Object Orientation

• Advantages of Object Orientation

• Elements of Object Model

• What is UML

• Goals Of UML

• Systems

• Phases In System Development

Page 4: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

Object Orientation

• Object orientation is a method for organizing systems as collections of interacting objects that combine data as well as behavior.

Page 5: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

Object Orientation

• When models are constructed using object orientation in a proper way, they become easy to communicate, change, expand and validate.

Page 6: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

Object Orientation

• The object oriented paradigm focuses on real world concepts rather than realization constructs.

Page 7: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

7

Advantages of Object Orientation

• Data Abstraction

• Compatibility

• Flexibility

• Reuse

• Extensibility

• Maintenance

Page 8: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

8

Elements of Object Model• Abstraction

• Giving necessarily details only.

• Encapsulation• Hiding unnecessarily details

• Modularity• Decomposition into a set of cohesive and

loosely coupled modules.

• Hierarchy• Ranking or an ordering of abstractions.

Page 9: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

9

Class Diagram• Captures static information structure

• In O-O: also functions

• Generalization, inheritance & reuse are important issues

• Imported into CommonKADS domain- schema notation• no use made of operation box

• Can also be used in Task Model to sketch task information structure

Page 10: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

10

Objects and classes

Fokker 100:airplane

airplane

#seats: integer

Fokker 70:airplane

#seats = 80

:airplane

Page 11: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

11

Object class

• Describes a group of objects with similar properties• Abbreviation: "class"

• Rationale for introducing classes: • it provides a means for abstraction

• Terminology: “object” is often used in an ambiguous way, pointing to both objects (in the strict sense) and object classes.

Page 12: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

12

Attributes

• An attribute describes a value held by objects belonging to the class.

• Attribute specification consists of:• Class it is defined on (student)• Attribute name (name)• Admissible values (string)• Optional: default value

Page 13: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

13

Operations

• Operation is "a function or a

transformation that can be applied to

objects of a class".• Objects in a class share the same

operations.

• Method: implementation of an operation

• functional view

Page 14: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

14

Class notation

class name

attribute-1: value-setattribute-2: value-set

operation-1(Par1:Type, Par2:Type): ReturnType

library book

catalog#: stringtitle: stringauthor: stringcategory: Categorycover-type: {hard-cover, paperback}

available(): Boolean

librarybook

Page 15: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

15

Associations• Associations are used to link objects to

other objects• Majority of associations:

• binary (between two objects)• directional (should be read in a

particular direction• Ternary associations come up

occasionally.• Associations between more than three

objects are rare.

Page 16: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

16

Association notation

man woman0-1 0-1

wifehusband

man womanhusband wife

married-to

General notation for association

Notation for a binary association

married-to 0-10-1

Page 17: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

17

Multiplicity examples

student course

person

major

address<< has address

married-to

major subject >>

enrolled in >>

0+

0-1

1+

Page 18: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

18

Multiplicity• Also called: "cardinality".

• Always connected to one of the classes involved.

• Typical types of multiplicity:

• 0-1 Zero or one (optional).

• 1 Precisely one.

• 0+ Zero or more,

• 1+ One or more.

Page 19: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

19

Association class

• Modeling an association as a class if the association has an internal information structure

• Advantage: associations become first-class objects.

• Attributes and methods can be defined for the association class.

Page 20: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

20

Notation association class

man woman0-1 0-1

wifehusband

marriage

date: Date

cityregistered in >>

Page 21: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

21

Associations with specific semantics

• Associations provide a general, "neutral", way of connecting object classes.

• Semantics of the association are defined through argument typing, multiplicity and (implicitly) the name of the association.

• Class diagrams provide specific types of associations, with predefined semantics:• generalization ("is a").• aggregation ("part of").

Page 22: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

22

Generalization

• Purpose: sharing similarities while preserving differences

• Is an association between a class that acts as super-class and one or more classes called the sub-classes.

• Super-classes show the features that the sub-classes have in common.

• Each sub-class inherits the attributes and operations defined on its super-class(es).

Page 23: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

23

Notation for generalization

agent

humancomputerprogram

man woman

taskexecutor-of >>

1+ 0+

Page 24: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

24

Aggregation

• Aggregation denotes a binary association in which one side is an "assembly" and the other side a "part".

• "Assembly" and "part" act as predefined roles involved in the aggregation association.

• Cardinality of a part can be defined • precisely one; optional (0-1); many, ...

Page 25: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

25

Notation for aggregation

audiosystem

tape deck

CD player

tuner

amplifier

speakerheadphones

recordplayer

0-1

0-1

0-1

0-1 0-1 2,4

Page 26: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

26

Composition

• Sub-type of aggregation

• Existence of part depends on aggregate

document

nametype

openprint

paragraph

style0+

Page 27: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

27

Aggregation and generalization

• Similarities:• Tree-like structure• Transitive properties

• Differences:• AND-tree (aggregation) vs. OR-tree

(generalization)• instance tree (aggregation) vs. class tree

(generalization)

Page 28: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

28

Combined Aggregation and Generalization

audiosystem

tape deck

CD player

tuner

amplifier

speakerheadphones

recordplayer

0-1 2,4input

system

1+

Page 29: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

29

Use-case Diagram• shows services that can be expected from a

system• provides outsider view (customer)• terminologyuse case service provided by systemactor agent using a system service

• used in early phases of system analysis• use in CommonKADS: way to present possible

solutions to customer

Page 30: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

30

Use cases for a library

library system

lend book

make bookreservation

search librarycatalog

add bookto catalog

remove bookfrom cataloglender librarian

Page 31: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

31

Inheritance Hierarchy

MAMALS

CatsDogs Humans

LionsLeopards

Tigers

Page 32: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

Block – 2

Object Oriented Design

Page 33: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

33

• Define Analysis• Define Design• Why to study OOAD• Difference between-

Procedural Analysis & Design

Object Analysis & Design Component Analysis & Design

• Models Used by OOAD

Analysis & Design

Page 34: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

34

Define Analysis

• Analysis is a detailed study of the various operations performed by a system and their relationships within and outside of the system.

Page 35: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

35

Define Analysis

• During analysis data are collected on the available files, decision points, and transactions handled by the present system

Page 36: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

36

Define Analysis

• Data Flow Diagrams, interviews, on-site observations, and questionnaires are some examples of tools that are used in analysis.

Page 37: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

37

• Once the Analysis is completed the analyst has a firm understanding of what is to done. The next step is to decide how the problem might be solved. Thus, in systems design, we move from the logical to the physical aspects of the life cycle.

Page 38: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

Design

• Design refers to the technical specifications that will be applied in implementing the candidate system. This involves input/output, file, and processing design Refers to the technical specifications that will be applied in implementing the candidate system. This involves input/output, file, and processing design

Page 39: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

39

Steps in System Design

Output Design

Input Design

Processing

Design

File Design

Design submitted to management for approval

Design Accepted

DetailedDocumentation

Test Program

Abandonproject

No

Yes

From Analysis

Cost Justification & candidate

Systemdesign

Go toimplementation

2

1

Page 40: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

Why OOAD• Object Oriented approach to software

development based on modeling objects from the real world & then using the model to build a language independent design organized around those objects.

Page 41: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

OOAD Provides/Promotes• Better understanding of

requirements

• Cleaner designs

• Easy to make changes in the system

Page 42: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

42

Report published in JAPAN

The software industry still relies mainly on the informal paper and pencil approach in the upstream development phases.

Page 43: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

Why to use MODELS

• The process of problem-solving using a computer is an intricate process requiring much thought, careful planning, logical precision, persistence, and attention to detail.

Page 44: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

Evolution of Models

• Procedural Model

• Object Oriented Model

• Component Model

Page 45: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

Procedural Model

• Each problem is divided into smaller problem and solved using specified modules that act on data.

Page 46: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

46

Procedural Model• This approach to software

development is process centric or procedural

• Not ideal for developing complex software coz, concentrates on the processes

Page 47: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

47

Procedural Model

• Modules are tightly interwoven and interdependent, that it is difficult to separate one module from another

• Reusability of software becomes difficult as complexity increases with processes

Page 48: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

Object Oriented Model

• It perceives the entire software system as a collection of objects which contain attributes and behaviors

Page 49: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

49

Why Object Oriented Model

• Realistic Modeling

• Reusability

• Resilience to change

Page 50: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

50

Component Based Model

• Software development is done based on a standard that allows software components to communicate with one another.

Page 51: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

51

Component Based Model

• A reusable software that can be easily plugged in or unplugged from an application.

Page 52: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

52

Object Oriented Methodology

• Consists of building a model of an application domain and then adding implementation details to it during the design of a system.

• This approach is called Object Modeling Technique

Page 53: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

53

Stages of methodology

• Analysis

• System Design

• Object Design

• Implementation

Page 54: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

Block -3

Modeling

Page 55: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

55

Models used by OOAD

• Object Model

• Dynamic Model

• Functional Model

Page 56: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

56

Object Model

• Describes the static structure of the objects in a system– • Their identity• Their relationships to other objects• Their attributes • Their operations

Page 57: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

57

Dynamic Model• Describes those aspects of a system

concerned with time and the sequencing of operations—• events that mark changes • sequences of events • states that define the context for events• the organization of events and states

Page 58: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

58

Dynamic Model• Describes those aspects of a system

concerned with time and the sequencing of operations—• events that mark changes • sequences of events • states that define the context for events• the organization of events and states

Page 59: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

59

Dynamic Model• Captures control, that aspect of a

system that describes • the sequence of operations that occur• without regard for what the operations do,

what they operate on• how they are implemented

Page 60: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

60

Functional Model

• Describes those aspects of a system concerned with transformations of values—• Functions

• Mappings

• Constraints

• Functional dependencies

Page 61: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

61

What is Unified Modeling Language

• Is a third-generation method for

• specifying

• Visualizing

• documenting

the artifacts of an object-oriented system under development.

Page 62: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

62

What is Modeling

• Modeling is the designing of software applications before coding.

• Modeling is an Essential Part of large software projects, and helpful to medium and even small projects as well.

Page 63: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

63

What is Modeling

• A model plays the analogous role in software development that blueprints and other plans (site maps, elevations, physical models) play in the building of a skyscraper.

Page 64: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

64

What is Modeling

• Using a model, those responsible for a software development project's success can assure themselves that business functionality is complete and correct

Page 65: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

65

What is Modeling

End-user needs are met, and program design supports requirements for scalability, robustness, security, extensibility, and other characteristics, before implementation in code renders changes difficult and expensive to make.

Page 66: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

66

The UML

• Helps to specify, visualize, and document models of software systems, including their structure and design, in a way that meets all of these requirements.

• Can be used UML for business modeling and modeling of other non-software systems too.

Page 67: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

67

The UML

• Using any one of the large number of UML based tools, one can analyze future application's requirements and design a solution that meets them, representing the results using UML’s twelve standard diagram types

Page 68: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

68

UML’s Twelve standard diagram types

• Four diagram types represent static application structure

• Five represent different aspects of dynamic behavior

• Three represent ways you can organize and manage your application modules. 

Page 69: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

69

UML’s twelve standard diagram types

• Structural Diagrams include:• Class Diagram• Object Diagram• Component Diagram• Deployment Diagram

Page 70: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

70

UML’s twelve standard

• Behavior Diagrams include:• Use Case Diagram

• Sequence Diagram

• Activity Diagram

• Collaboration Diagram

• Statechart Diagram. 

Page 71: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

71

UML’s twelve standard

• Model Management Diagrams include:• Packages

• Subsystems

• Models

Page 72: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

72

Systems

• Technical System

• Information System

• Distributed System

• Embedded System

• System Software

• Business System

Page 73: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

73

Phases In System Development• Requirement Analysis

• Analysis

• Design

• Programming

• Testing

Page 74: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

74

Exercise• What is Object Orientation. Mention its

advantages.

• What is UML. Explain.

• What are the goals of UML.

• What are systems. Give the various types.

• Describe the phases of system Development

Page 75: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

75

UML

Views

A system is described with a number of different aspects:1. Functional

2. Non-Functional

3. Organizational Aspects

Page 76: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

76

Views

• The system is described in a number of views, where each view represents a projection of the complete system description

Page 77: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

77

Use-case View Models the functionality as perceived by

the external users known as actors.

Lists the actors and use- cases, and show which actor participates in each use-case.

Page 78: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

78

Use-case View• Use-case View is for

• customers

• designers

• developers

Page 79: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

79

Use-case View

• Composed of :• Use-case diagrams

• Goal is to provide functionality along with non-functional properties.

Page 80: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

80

Logical View• Is for designers and developers

• Describes both the static structure and the dynamic collaborations that occur when the message is send to each other to provide a given function.

Page 81: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

81

Logical View• Static Structure is composed of:

• Class diagram and object diagram• Dynamic structure is composed of:

• State diagrams• Sequence diagrams• Collaboration diagrams• Activity diagrams

Page 82: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

82

Logical View

• Logical view is also known as Structural Model View or Static View

Page 83: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

83

Component View• Is for developers

• Is a implementation of modules and dependencies

• Composed of component diagram

Page 84: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

84

Component View

• Can have information like:• Resource allocation

• Administrative information

• Progress Report

• Also known as implementation view or development view.

Page 85: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

85

Concurrency View

• Is for developers and integrators

• Deals with the division of the system into processes and processors.

Page 86: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

86

Concurrency View

• Allows efficient:• Resource usage

• Parallel execution

• Handling Asynchronous events.

Page 87: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

87

Concurrency View• Composed of

• Sequence diagrams• Collaboration diagrams• State diagrams• Activity diagrams

• Also know as dynamic, process or behavioral model.

Page 88: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

88

Deployment View

• Is for developers, integrators and testers.

• Represented by the deployment diagram

Page 89: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

89

Deployment View

• Shows the physical deployment of the system such as:• the computers

• devices(nodes) and the connection between them.

Page 90: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

90

Deployment View

• Permits the consequences of distribution and resource allocation to be assessed.

Page 91: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

91

Diagrams Use Case Diagram Class Diagram Object Diagram State Diagram Sequence Diagram Collaboration Diagram Activity Diagram Component Diagram Deployment Diagram

Page 92: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

92

Use Case Diagrams

• Describes the functionality of a system and users of the system.

• Contains:• Actors

• Use-cases

• and their relationship

Page 93: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

93

Use Case Diagrams

• Actors represent the users of the system, human users and other systems

Page 94: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

94

Use Case Diagrams

Manages Resource

Manages Projects

Resource Manager

Resource Manager

Project & Resource Management System

Page 95: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

95

Class Diagram• Shows the static structure of

classes in the system.

• Is a schema, pattern,or template for describing many possible instances of data

• Describes object classes

Page 96: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

96

Class Diagram

• Contain:• Represents attributes, operations

and associations• Associations representing

relationships that relate 2 or more classes

Page 97: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

97

Class Diagram

• Classes Can be related to each other in number of ways:• Associated classes(connected to

each other)• Dependent classes(one class

depends/uses another class)

Page 98: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

98

• Specialized classes(one class is specialization of another class)

• Packaged classes(grouped together as a unit)

Class Diagram

Page 99: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

99

Class Diagram

Person

name: string

age : integer

change-jobchange-address

Class Name

Attributes

Operations

Page 100: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

100

Object Diagram• Describes static structure at a particular

time

• Describes particular situation

Where as class diagram describes all possible situations.

Page 101: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

101

Object Diagram• Contain:

• Represents particular entities which are instances of classes.

• Links representing the particular relationships between objects which are instances of associations

Page 102: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

102

Object Diagram

(Person)Hari

52

(Person)Sita24

Page 103: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

103

Author Computer

name: string name: string

age: integer age: integerUses

age : 32name: “John”

John:Author

Work PC:Computer

name: “John”

name: “John”

age : 32

age : 32

Home PC:ComputerObject Diagram

Class Diagram

Page 104: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

104

State Diagram

• Describes the behavior of a class in response to an external stimuli

• Describes the life cycle of object

• It relates events and states

Page 105: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

105

State Diagram

• Contains:• States representing the situations

during the life cycle of an object in which it satisfies some condition, performs some activity or waits for some occurrence

Page 106: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

106

State Diagram

• Transitions representing relationships between the different states of an object

Page 107: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

107

State Diagram

• Are not drawn for all the classes, only for those that have a number of well defined states and where the behavior of the class is affected and changed by different states.

Page 108: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

108

Dialing

Idle

Dial tone

Connecting

Ringing

Connected

Disconnected

Busy tone

Fast busy tone

Time Out

Recorded message

called phone hangs up

called phone answers

routed

valid number

trunk busy

number busy

on-hook on-hook

off-hook time outtime out

invalid number

message done

digit(n)digit(n)

Page 109: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

109

Sequence Diagram

• Describe the interactions among classes

• Focuses on classes and the messages they exchange to accomplish some behavior

Page 110: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

110

Sequence Diagram• Contain:

• class roles representing roles that objects may play within the interaction

• lifelines representing the existence of an object over a period of time

Page 111: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

111

Sequence Diagram• activations representing the time

which as object is performing an operation

• Messages representing communication between object, active object

Page 112: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

112

insert card

request kind

enter passwordrequest password

enter kindrequest amountenter amount

dispense cashrequest take cash

take cashrequest continuation

verify accountverify card with bank

bank account okaccount ok

process transaction

process bank transaction

bank transaction succeed

transaction succeed

User ATM Consortium Bank

Page 113: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

113

terminate

print receipt

eject card

request take card

take card

display main screen

User ATM Consortium Bank

Page 114: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

114

Collaboration Diagram• Describes the interactions among

classes and associations.

• These interactions are modeled as exchanges of messages between classes through their associations.

Page 115: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

115

Collaboration Diagram

• Contain the elements:• Class roles representing roles that

objects may play within the interaction

• Association roles representing roles that links may play within the interaction

Page 116: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

116

Collaboration Diagram• Message flows representing the

messages sent between the objects via links.

Page 117: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

117

:Computer

Collaboration Diagram

:Printer

:Queue

:Printer Server

1:Print(file)

[printer busy] 1.2:Store(file)

[printer free] 1.1:Print(file)

Page 118: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

118

Activity Diagram• Describes

• sequential flow of activities.

• the behavior of a class in response to internal processing rather than external events.

Page 119: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

119

Activity Diagram

• Contains the following elements:

swimlanes representing the responsibility of one or more objects for actions with in an overall activity

Page 120: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

120

• Action states representing actions of entities or steps in the execution process

• action flows representing relationships between the different action states of an entity

Page 121: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

121

Activity Diagram• Object flows representing the

utilization of objects by action states and the influence of action states on objects

Page 122: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

122

Activity DiagramShow

MessageBox “Disk Full” on

screen

Show MessageBox “Printing” on

screen

Remove MesageBox

Create Postscript file

PrintFile( ) [diskfull( )]

[free disk space]

^Printer.Print(file)

Page 123: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

123

Component Diagram

• Describes the organization of and dependencies among the software implementation components

Page 124: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

124

Component Diagram• Contain components which

represent distributable physical units, including:• Source code component

• Object code component

• Executable code component

Page 125: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

125

Activity Diagram

Main Class Client Program

Page 126: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

126

Deployment Diagram

• Describes• the environmental view of the

system

• The physical architecture of the hardware and software in the system.

Page 127: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

127

Deployment Diagram• Contains:

• Nodes

• Components

• and their relationships

Different views of the system are are used to give a coherent description of the system as a whole.

Page 128: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

128

Deployment Diagram

Client A: Compaq PC

Client B: Compaq PC

Application Server: SG O2

Database Server: VAX

Page 129: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

129

UML

Model elements General mechanisms Extending the UML Modeling with UML

Page 130: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

130

Model Elements

Attributes

Class

Operations

Object

Attributes

Operations

Package Note

State Node

Use Case

Component

Page 131: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

131

Model Elements

Association Aggregation

Dependency Generalization

Page 132: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

132

Model Elements

Some different relationships are:

1. Association: Connects elements and links instances.

2. Generalizations: It means that an element can be a specialization of another element. Also called inheritance.

Page 133: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

133

Model Elements

• Dependency: Shows that one element depends in some way or another element

• Aggregation: A form of association in which an element contains other elements.

Page 134: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

134

nameCountry

nameCity

(Country) Canada

(Country) France

(Country) Senegal

(City) Ottawa

(City) Dakar

(City) Paris

Class Diagram

Instance Diagram

Has Capital

Has Capital

Has Capital

Has Capital

One to One association

Page 135: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

135

Many to Many Association

nameLine Point

name2+

(Point) P1

(Point) P2

(Line) L1

(Line) L3

(Line) L4

(Line) L5

(Line) L2

Class diagram

Instance diagram

Page 136: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

136

Role

• Is a name that uniquely identifies one end of an association

• Provides a way of traversing associations from an object at one end, without explicitly mentioning the association.

Page 137: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

137

Role Names For Association

Works-forCompanyPerson employee employer

Personname

Social security noaddress

Companynameaddress

Works-for

worker Job titlesalary

boss

Manages

performance rating

Page 138: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

138

Ordering

• The ordering is an inherent part of the association.

• An ordered set of objects on the “many” end of an association is indicated by writing “{ordered}” next to the multiplicity dot for the role.

Page 139: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

139

Ordered sets in an association

Window Screen{ordered}

Visible-on

Page 140: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

140

Qualification

• A qualified association relates two object classes and a qualifier.

• The qualifier is a special attribute that reduces the effective multiplicity of an association.

Page 141: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

141

A Qualified Association

Directory file name file

Stock Exchange Stock Exchange

Companythicker symbol Company

thicker symbol

Unqualified and Qualified

Lists

Page 142: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

142

Paragraph SentenceDocument

Microcomputer

Monitor MouseSystem Box keyboard

FanChassis CPU RAM

1+

Aggregation

Page 143: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

143

WindowsX2Y1X2Y2

displayundisplayraiselower

Scrolling windowX-offset Y-offsetscroll

Text windowstringInsert delete

CanvasCX1

CX2CY1

CY2

add-element

delete-element

Scrollingcanvas

Shapecolorlinewidth

Panelitem name

windowelements

Page 144: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

144

What is -----------?• Use Case Diagram• System• Actors• Use Cases

• Communicates Relationships• Extends Relationships• Uses Relationships• Relationships between Use Cases• Grouping

• Describing Use Case• Testing Use Cases• Walking The Use Cases

Page 145: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

145

Background UML• Nineties: number of popular object-

oriented methods

• Unified Modeling Language: proposal for set of standard notations

• wide attention• see www.rational.com

• mainly meant for analysis phase

Page 146: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

146

UML notations used• Class diagram

• static information structure (“data”)

• Activity diagram• combined function/control view

• Use-case diagram• high level view of system services (functional)

• State diagram• highly interactive control

Page 147: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

147

Activity diagram• Model control and information flow of a

procedure or process• Useful if control is mainly synchronous

• otherwise: use state diagram

• Use in CommonKADS: modeling the organizational process• worksheet OM-2 of the organization model

• Can also be used to model control flow within a task method (knowledge model)

Page 148: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

148

Action state• State in which some work is being done

• activity, task

• State terminates when the work is finished• difference with state diagrams

• After termination the action state can lead to another action state• “state transition”

• Special symbols for being and end of a procedure or process

Page 149: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

149

Basic notation for activity diagram

data entry

processinggenerateoutput

Page 150: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

150

Decision

• Sate transition is deterministic

• If transition depends on outcome of the work, then introduce a decision

data entry

dump in waste basket

furtherprocessing

[data correct]

[data incorrect]

Page 151: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

151

Introducing concurrency

buy foodand drinks

cook dinneropen wine

bottle

have dinner

Page 152: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

152

Swim lanes• Process can sometimes be distributed

over several agents or organizational units

• Notation: use compartments

• In particular useful when modeling a business process (e.g. in organization model)

Page 153: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

153

Notation for swim lanes

write tender

get customerinformation

SALESDEPARTMENT

calculatecost

DESIGNDEPARTMENT

designelevator

Page 154: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

154

Object flow

standarddesign

write tender

get customerinformation

SALESDEPARTMENT

decide about design type

customdesign

costcalculation

elevatordesign

DESIGNDEPARTMENT

non-standard standard

CUSTOMER

tender

customerinformation

Page 155: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

155

Signals

receiverequest

archive(request)

archive(request)

processrequest

archive

Page 156: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

156

Business process “Housing”primaryprocess

secondaryprocess

data entryof applications

magazineproduction

applicationassessment

residenceassignment

statisticalanalysis

policyinformation

:residenceassignments

Page 157: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

157

Activity diagram of method control

cover

predict

obtain compare

[no more solutionsof cover]

[new solutionof cover]

[result = equal]

[result = not equal]

solution found

no solution found

startdiagnosisthrough

generate-and-test

Page 158: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

158

State diagrams

• Synonyms: “state chart”, “state-transition diagram”

• Purpose: model of dynamic behavior• Use if control is heavily influenced by

“external” events• Draw a state diagram for object classes with

interesting behavior• Activity diagram is alternative

• internal control• object flow

Page 159: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

159

State

watching football match

duration

entry/switch on TVdo/watchexit/turn off TV

state name

state variables

state actions& activities

Page 160: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

160

State transition

• Event: comes from outside the object modeled

• Message: generates event for another object• Guard: outcome of internal object

computation

ready fortake off

check: boolean

entry/final check

airborne

do/fly

permission-from-control-tower[check -= OK] / take-off control-tower.confirm-takeoff(flightID)

Page 161: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

161

Actions and activities• Action: instantaneous, not interruptible

• on transition• on state entry = action on all incoming

transitions• on state exit = action on all outgoing

transitions • on event

• Activity: takes time, interruptible

Page 162: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

162

State Diagram of Ticket Machine

idle inserting money

timerbalance

insert(coin)/add to balance

processing selection

do/compute change

dispensingchange

do/dispense change

dispensingticket

do/dispense ticket

cancelling

do/return balanceselect(ticket)

cancel buttonpressed

time out

[balance < ticket price]

insert(coin)/new balance

[balance = ticket price]

[balance > ticket price]

Page 163: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

163

State concurrency

enteringtransaction

dataprocessing

take outcash

take outcard

idle

cash cardentered

cash taken card taken

Page 164: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

164

State Generalization

• If Object A is in super-state S, then the object us in precisely one of the sub-states

• Cf. concurrency: “and”-states

whiteto move

blackto move

playing chess

Page 165: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

165

State diagrams in CommonKADS

• Communication modeling (Ch. 8)

• Asynchronous reasoning control• real-time applications

• Control specification for the business process

• Overlap with activity diagrams• state with no outgoing events = action state

Page 166: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

166

State diagram “Housing”

applicationassessment

waiting for case data

application received/order assessment

data needed/ask

data received / reply

assessment finished/report decision

Page 167: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

167

Class diagram• Captures static information structure

• In O-O: also functions

• Generalization, inheritance & reuse are important issues

• Imported into CommonKADS domain- schema notation• no use made of operation box

• Can also be used in Task Model to sketch task information structure

Page 168: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

168

Objects and classes

Fokker 100:airplane

airplane

#seats: integer

Fokker 70:airplane

#seats = 80

:airplane

Page 169: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

169

Object class

• Describes a group of objects with similar properties• Abbreviation: "class"

• Rationale for introducing classes: • it provides a means for abstraction

• Terminology: “object” is often used in an ambiguous way, pointing to both objects (in the strict sense) and object classes.

Page 170: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

170

Attributes• An attribute describes a value held by

objects belonging to the class.

• Attribute specification consists of:• Class it is defined on (student)• Attribute name (name)• Admissible values (string)• Optional: default value

Page 171: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

171

Object and Value• Most O-O approaches distinguish between

objects and values.• Difference: a value does not have an

identity • it "lives” only in connection to a certain object.

• RULE 1: an object is not allowed as a possible value of an attribute!

• RULE 2: attribute names need only to be unique within a class.

Page 172: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

172

Values and Value Sets• Values are the primitive things with no internal

structure from the viewpoint of the application• Admissible values are defined through a value

set• Typical predefined value-sets:

• string, number, integer, real, range, boolean, ….

• User-defined:• set or list of strings

Page 173: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

173

Object Identifiers• In O-O modeling you assume that every

object has an identity.

• Consequence: introduce only attributes that act as identifiers, iff the identifier is something that exists in the real world.

• Examples: student card number, social security number.

Page 174: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

174

Operations• Definition:

• operation is "a function or a transformation that can be applied to objects of a class".

• Objects in a class share the same operations.

• Method: implementation of an operation

• = functional view

Page 175: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

175

Class notation

class name

attribute-1: value-setattribute-2: value-set

operation-1(Par1:Type, Par2:Type): ReturnType

library book

catalog#: stringtitle: stringauthor: stringcategory: Categorycover-type: {hard-cover, paperback}

available(): Boolean

librarybook

Page 176: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

176

Associations• Associations are used to link objects to other

objects• Majority of associations:

• binary (between two objects)• directional (should be read in a particular direction

• Ternary associations come up occasionally.• Associations between more than three objects

are rare.

Page 177: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

177

Association notation

man woman0-1 0-1

wifehusband

man womanhusband wife

married-to

General notation for association

Notation for a binary association

married-to 0-10-1

Page 178: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

178

Multiplicity examples

student course

person

major

address<< has address

married-to

major subject >>

enrolled in >>

0+

0-1

1+

Page 179: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

179

Multiplicity• Also called: "cardinality".

• Always connected to one of the classes involved.

• Typical types of multiplicity:• 0-1 Zero or one (optional).• 1 Precisely one.• 0+ Zero or more,• 1+ One or more.

Page 180: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

180

Association class• Modeling an association as a class if the

association has an internal information structure

• Advantage: associations become first-class objects.

• Attributes and methods can be defined for the association class.

Page 181: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

181

Notation association class

man woman0-1 0-1

wifehusband

marriage

date: Date

cityregistered in >>

Page 182: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

182

Use of an association class

company

name

person

namesocial security #addresssalaryjob title

person

namesocial security #address

company

name

<< works for

employer employee

1+1

employer employee

1+ 1+

works for

salary:job title

if you want to model thata person can work for

more than one company,then change to

Page 183: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

183

Associations with specific semantics

• Associations provide a general, "neutral", way of connecting object classes.

• Semantics of the association are defined through argument typing, multiplicity and (implicitly) the name of the association.

• Class diagrams provide specific types of associations, with predefined semantics:• generalization ("is a").• aggregation ("part of").

Page 184: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

184

Generalization• Purpose: sharing similarities while

preserving differences• Is an association between a class that acts

as super-class and one or more classes called the sub-classes.

• Super-classes show the features that the sub-classes have in common.

• Each sub-class inherits the attributes and operations defined on its super-class(es).

Page 185: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

185

Notation for generalization

agent

humancomputerprogram

man woman

taskexecutor-of >>

1+ 0+

Page 186: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

186

Aggregation• Aggregation denotes a binary association

in which one side is an "assembly" and the other side a "part".

• "Assembly" and "part" act as predefined roles involved in the aggregation association.

• Cardinality of a part can be defined • precisely one; optional (0-1); many, ...

Page 187: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

187

Notation for aggregation

audiosystem

tape deck

CD player

tuner

amplifier

speakerheadphones

recordplayer

0-1

0-1

0-1

0-1 0-1 2,4

Page 188: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

188

Composition• Sub-type of aggregation

• Existence of part depends on aggregate

document

nametype

openprint

paragraph

style0+

Page 189: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

189

Aggregation and generalization

• Similarities:• Tree-like structure• Transitive properties

• Differences:• AND-tree (aggregation) vs. OR-tree

(generalization)• instance tree (aggregation) vs. class tree

(generalization)

Page 190: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

190

Combined aggregation and generalization

audiosystem

tape deck

CD player

tuner

amplifier

speakerheadphones

recordplayer

0-1 2,4input

system

1+

Page 191: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

191

Use-case diagram• shows services that can be expected from

a system• provides outsider view (customer)• terminologyuse case service provided by systemactor agent using a system service• used in early phases of system analysis• use in CommonKADS: way to present

possible solutions to customer

Page 192: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

192

Use cases for a library

library system

lend book

make bookreservation

search librarycatalog

add bookto catalog

remove bookfrom cataloglender librarian

Page 193: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

193

A small case study• Course administration system (CAS)• Context: university department• Required services:STUDENT: update personal data, inspect

exam results, inspect course info, enroll in course

TUTOR: inspect exam results, update course info, inspect enrollments

ADMIN STAFF: enter exam results, inspect exam results, update personal data students, inspect enrollments

Page 194: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

194

Use cases

student

tutor

updatestudent data

inspectcourse info

updatecourse info

enrollin course

enterexam results

browseenrollments

browseexam results

browseindividual

results

browsecourseresults

administrativestaff

Page 195: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

195

Class diagram

student

student-card#: stringname: stringaddress: stringdate-of-birth: datamajor: Major.........

course

course-code: stringyear: integertrimester: 1-3study-points: integerlearning-goals: stringdescription: textliterature: text

maximum-#students: integer

exam

date: dateresult: [0..10]

enrollment

date: date

universitystaff member

title: stringposition: stringdepartment: stringtelephone: stringroom: stringe-mail: string

0+ 0+

course-exam1

0+

tutor

0+

1+

0+

requires

Page 196: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

196

Activity diagram for course enrollment procedure

submitenrollment

request

checkstudent limit

checkpreconditions

inform aboutprerequisites

inform aboutstudent limit

registerenrollment

inform aboutenrollment

[preconditionsOK]

[preconditionsnot OK] [above limit]

[limit notyet reached]

Page 197: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

197

State diagram:“update student data”

waiting fornotification

timer

received(new student data) send message to

central university database

localprocessing

do/update local databasedo/display results

OK message received from central database

[timer = time-out or not OK]/notify failure

Page 198: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

198

Dynamic Model• Describes those aspects of a system

concerned with time, changes and the sequencing of operations—• events that mark changes • sequences of events • states that define the context for events• the organization of events and states

Page 199: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

199

Dynamic Model• Captures control, that aspect of a

system that describes • the sequence of operations that occur• without regard for what the operations do,

what they operate on• how they are implemented

Page 200: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

200

Dynamic ModelAn object model describes the possible patterns of objects, attributes, and links that can exist in a system.

Over time, the objects stimulate each other, resulting in a series of changes to their states. An individual stimulus from one object to another is an event.

The pattern of events, states, and state transitions for a given class can be represented as a state diagram.

Page 201: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

201

EventAn event is something that happens at a point of time, such as user depressed left button or Flight 123 departs from Chicago.

An event has no duration.

One event may logically precede or follow another, or the two event may be unrelated.

An event is a one-way transmission of information from one objects to another. It is not like a subroutine call that returns a value.

Page 202: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

202

Scenarios and Event Trace

A scenario is a sequence of events that occurs during one particular execution of a system.

Page 203: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

203

caller lifts receiverdial tone beginscaller dials digits (5)dial tone endscaller dials digit (5)----------------------called phone begins ringingringing tone appears in calling phonecalled party answerscalled phone stops ringingringing tone disappears in calling phonephones are connectedcalled party hangs upphones are disconnectedcaller hangs up

Scenario for phone call

Page 204: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

204

Scenarios and Event TracesThe next steps after writing a scenario is to identify the sender and receiver objects of each event.

The sequence of events and the objects exchanging events can both be shown in an augmented scenario called an event trace diagram.

This diagram shows each object as a vertical line and each event as a horizontal arrow from the sender object to the receiver object.

Page 205: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

205

Caller Phone line Callee

Caller lifts receiver

Dial tone begins

Dials (5)

Dial tone ends

Dials (1)

Dials (2)

Ringing tone Phone rings

Answer phone

Tone stops Ringing stops

Phone connected Phone connected

Callee hangs up

Connection broken Connection broken

Caller hangs up

Page 206: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

206

StatesA State is an abstraction of the attribute values and links of an object in other words you can say that the attribute values and links held by an object are called its state.

A State corresponds to the interval between two events received by an object. Events represent point in time , states represent intervals of time. For example, after the receiver is lifted and before the first digit is dialed, the phone line is in state Dial tone.

Page 207: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

• A State has duration. It occupies an interval of time. A State is often associated with a continuous activity, such as ringing of a telephone.

• A State is often associated with the value of an object satisfying some condition. For example, water is liquid is equivalent to saying “the temperature of water is greater than 0 C and less than 100 C.

• A State specifies the response of the object to input event

Page 208: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

208

State Diagram

• Describes the behavior of a class in response to an external stimuli

• Describes the life cycle of object

• It relates events and states

Page 209: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

209

State Diagram• Contains:

• States representing the situations during the life cycle of an object in which it satisfies some condition, performs some activity or waits for some occurrence

Page 210: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

210

State Diagram

• Transitions representing relationships between the different states of an object

• A change of state caused by an event is called a transition.

Page 211: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

211

State Diagram• A State diagram is a graph whose nodes are

states and whose directed arcs are transition. A State diagram is a graph whose nodes are states and whose directed arcs are transitions labeled by event names.

• A State is drawn as a rounded box containing an optional name. A transition is drawn as an arrow from the receiving state to the target state. The label on the arrow is the name of the event causing the transition.

Page 212: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

212

Dialing

Idle

Dial tone

Connecting

Ringing

Connected

Disconnected

Busy tone

Fast busy tone

Time Out

Recorded message

called phone hangs up

called phone answers

routed

valid number

trunk busy

number busy

on-hook on-hook

off-hook time outtime out

invalid number

message done

digit(n)digit(n)

Page 213: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

213

One Shot State DiagramOne-shot diagrams represents objects with finite lives.

A One-shot diagram has initial and final states.

The initial state is entered on creation of an object, entering the final state implies destruction of the object.

An initial state is shown by a solid circle. The circle can be labeled to indicate different initial conditions.

A final state is shown by a bull’s-eye. The bull’s-eye can be labeled to distinguish final conditions.

Page 214: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

214

StartWhite’s turn

Black’s turn

black moves

white moves

checkmate

checkmate

stalemate

stalemate

Black wins

Draw

White wins

One-shot State Diagram for chess game

Page 215: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

215

ConditionsA Condition is a boolean function of object value.

Condition can be used as guards on transitions.

A guarded transition fires when its events occurs, but only if the guarded condition is true. For example – When you go out in the morning(event), if the temperature is below freezing (condition), then put on your gloves (next state).

A guarded condition on a transition is shown as boolean expression in brackets following the event name.

Page 216: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

216

North/south may go straight

North/south may go straight

North/south may go straight

North/south may go straight

time-out [cars in N/S left lanes]

time-out

time-out [cars in E/W left lanes]

time-out

time-out [no cars in N/S left lanes]

time-out [no cars in E/W left lanes]

State Diagram with Guarded Transition

Page 217: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

217

OperationsState diagram would be of little use if they just described patterns of events. A behavioral description of an object must specify what the object does in response to events.

There are two types of Operation.

(a)Activity(b)Action

Activity :- An activity is an operation that takes time to complete. An activity is associated with a state. Activity include continuous operations, such as displaying a picture on a television screen.

Page 218: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

• The notation “do: A” within a state box indicates that activity A starts on entry to the state and stops on exit.

Action :- An action is an instantaneous operation. An action is associated with an event.

• The notation for an action on a transition is a slash (‘ / ’) and the name (or description) of the action, following the name of the event that causes it.

Page 219: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

219

State1

do: activity1

State2

do: activity2

event1 (attribs) [condition1]/action1

Page 220: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

220

Dialing

Idle

Dial tonedo:sound dial tone

Connectingdo: find connection

Ringingdo: ring bell

Connected

Disconnected

Busy tonedo: slow busy tone

Fast busy tonedo: fast busy tone

Time Outdo: sound loud beep

Recorded message

do: play message

called phone hangs up / disconnect line

called phone answers / connect line

routed

valid number

trunk busy

number busy

on-hook on-hook

off-hook time outtime out

invalid number

message done

digit(n)digit(n)

on-hook / disconnect line

on-hook

Page 221: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

221

UMLThe Unified Modeling Language™ - UML - is OMG's most-used specification, and the way the world models not only application structure, behavior, and architecture, but also business process and data structure.

Page 222: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

222

UML Is a LanguageApplies to Modeling and Systems

Result of Unifying the Info. System and Tech. Industry’s Best

engg. Practices (Principles, Techniques, Methods and Tools)

Page 223: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

223

UMLIt is used for specifying, visualizing, constructing, and documenting the

systems.

Page 224: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

224

UML Diagrams

Use case D

Class D.

Object D.

Sequence D.

Collaboration D.

Statechart D.

Activity D.

Component D.

Deployment D.

Page 225: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

225

Creators of UML

Grady BoochJames Rumbaugh

Ivar Jacobson

Page 226: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

226

UML notations used

• Class diagram• static information structure (“data”)

• Activity diagram• combined function/control view

• Use-case diagram• high level view of system services (functional)

• State diagram• highly interactive control

Page 227: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

227

Activity diagram• Model control and information flow of a

procedure or process• Useful if control is mainly synchronous

• otherwise: use state diagram

• Use in CommonKADS: modeling the organizational process• worksheet OM-2 of the organization model

• Can also be used to model control flow within a task method (knowledge model)

Page 228: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

228

Action state

• State in which some work is being done• activity, task

• State terminates when the work is finished• difference with state diagrams

• After termination the action state can lead to another action state• “state transition”

• Special symbols for being and end of a procedure or process

Page 229: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

229

Basic notation for activity diagram

data entry

processinggenerateoutput

Page 230: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

230

Decision• Sate transition is deterministic

• If transition depends on outcome of the work, then introduce a decision

data entry

dump in waste basket

furtherprocessing

[data correct]

[data incorrect]

Page 231: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

231

Introducing concurrency

buy foodand drinks

cook dinneropen wine

bottle

have dinner

Page 232: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

232

State diagrams

• Synonyms: “state chart”, “state-transition diagram”

• Purpose: model of dynamic behavior• Use if control is heavily influenced by

“external” events• Draw a state diagram for object classes with

interesting behavior• Activity diagram is alternative

• internal control• object flow

Page 233: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

233

State

watching football match

duration

entry/switch on TVdo/watchexit/turn off TV

state name

state variables

state actions& activities

Page 234: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

234

State transition

• Event: comes from outside the object modeled

• Message: generates event for another object• Guard: outcome of internal object

computation

ready fortake off

check: boolean

entry/final check

airborne

do/fly

permission-from-control-tower[check -= OK] / take-off control-tower.confirm-takeoff(flightID)

Page 235: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

235

Actions and activities• Action: instantaneous, not interruptible

• on transition• on state entry = action on all incoming

transitions• on state exit = action on all outgoing

transitions • on event

• Activity: takes time, interruptible

Page 236: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

236

State diagram of ticket machine

idle inserting money

timerbalance

insert(coin)/add to balance

processing selection

do/compute change

dispensingchange

do/dispense change

dispensingticket

do/dispense ticket

cancelling

do/return balanceselect(ticket)

cancel buttonpressed

time out

[balance < ticket price]

insert(coin)/new balance

[balance = ticket price]

[balance > ticket price]

Page 237: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

237

State concurrency

enteringtransaction

dataprocessing

take outcash

take outcard

idle

cash cardentered

cash taken card taken

Page 238: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

238

A small case study

• Course administration system (CAS)• Context: university department• Required services:STUDENT: update personal data, inspect exam results,

inspect course info, enroll in courseTUTOR: inspect exam results, update course info,

inspect enrollmentsADMIN STAFF: enter exam results, inspect exam

results, update personal data students, inspect enrollments

Page 239: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

239

Use cases

student

tutor

updatestudent data

inspectcourse info

updatecourse info

enrollin course

enterexam results

browseenrollments

browseexam results

browseindividual

results

browsecourseresults

administrativestaff

Page 240: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

240

Class diagram

student

student-card#: stringname: stringaddress: stringdate-of-birth: datamajor: Major.........

course

course-code: stringyear: integertrimester: 1-3study-points: integerlearning-goals: stringdescription: textliterature: text

maximum-#students: integer

exam

date: dateresult: [0..10]

enrollment

date: date

universitystaff member

title: stringposition: stringdepartment: stringtelephone: stringroom: stringe-mail: string

0+ 0+

course-exam1

0+

tutor

0+

1+

0+

requires

Page 241: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

241

Activity diagram enrollment proceduresubmit

enrollmentrequest

checkstudent limit

checkpreconditions

inform aboutprerequisites

inform aboutstudent limit

registerenrollment

inform aboutenrollment

[preconditionsOK]

[preconditionsnot OK] [above limit]

[limit notyet reached]

Page 242: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

242

State diagram“update student data”

waiting fornotification

timer

received(new student data) send message to

central university database

localprocessing

do/update local databasedo/display results

OK message received from central database

[timer = time-out or not OK]/notify failure

Page 243: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

Block -4

Implementation

Page 244: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

244

Database • A database is a collection of related data

or operational data extracted from any firm or organization.

• Here are several examples of databases.Manufacturing companyBank HospitalUniversityGovernmentDepartment

Page 245: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

245

• DBMS:- stands for Database Management System. Collection of records in systematic way so that data can be create, manipulate and delete in proper manner. Or A database management system (DBMS) is a software application system that is used to create, maintain and provide controlled access to user databases.

Page 246: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

246

Database HierarchyDATABASE MANAGEMENT SYSTEM

APPLICATION PROGRAMS

End Users

Page 247: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

247

Hierarchy of DatabaseBit0,1

Bit 10101011 (8-bits)

Field(Attribute name like name, Age, Address)

Record(One or more rows in a table)

File(Table or collection of all files)

Database (Collection of files or tables)

Page 248: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

248

• Object-based logical models: Are used to describe data at the conceptual and view level. Example of these are the

• Entity-Relationship model and object-oriented model

Record-based logical models : Are used to describe data at the conceptual and view level.

Example of these are: Network model, Hierarchical model, and relational model.

Page 249: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

249

Benefits of Database System

• Redundancy and duplication can be reduced.

• Inconsistency can be avoided.

• Transaction support can be provided.

• Security can be enforced.

Page 250: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

• Conflicting requirements can be balanced.

• The data can be shared.

• Standards can be enforced.

• Inconsistency can be avoided (to some extent).

• Integrity can be maintained.

Page 251: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

251

Data Independent• The ability to modify a schema definition in one level

without affecting a schema definition in the next higher level is called data independence. There are two levels of data independence.

Physical Data Independence It is the ability to modify the physical schema without

causing application programs to be rewritten.

Logical Data Independence It is the ability to modify the logical schema without

causing application programs to be rewritten.

Page 252: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

252

Interface Between physical Database / user request

• The DBMS responds to a query by invoking the appropriate sub-programmers, each of which performs its special function to interpret the query, or to locate the desired data in the database and insert it in the designed order. Thus DBMS shields database users from the tedious programming they would have to do, organize data for storage, or to gain access to it once it has been stored

Page 253: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

253

DBMS Architecture EXTERNAL

VIEW

EXTERNAL

VIEW

CONCEPTUAL SCHEMA

INTERNAL SCHEMA

EXTERNAL LEVEL

External/Conceptual mapping

CONCEPTUAL LEVEL

INTERNALLEVEL

Conceptual/ Internal Mapping

Page 254: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

254

Relational ModelThe relational model uses a

collection of tables to represent both data and the relationships among those data. Each table has multiple columns, and each column has a unique name.

Page 255: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

255

The Relational modelThe Relational model

Page 256: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

256

Network Model• collections of records• Relationship among data is

represented by links.

Page 257: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

257

Hierarchical Data Model• Records and links represent data

and relationships among the data, respectively.

• The records are organized as collections of trees rather than arbitrary graphs.

Page 258: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

258

Hierarchical Database

Page 259: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009

Physical data Physical data models :models :

• Physical data model are used to describe Physical data model are used to describe data at the physical level (bytes and data at the physical level (bytes and words). It is mainly deal with hardwarewords). It is mainly deal with hardware..

Page 260: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

260

why to use Relational Model?

1. Independence of the physical data storage and logical database structure. 2. Variable and easy access to all data. 3. Flexible in database design (simple tables and relationships)

Page 261: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

261

Define Primary / Foreign Key?

• Relational database use primary keys and foreign keys to allow mapping of information from one table to another A foreign key is column or group of columns in a table whose value matches those of the primary key of another table

Page 262: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

262

Types of Rlationship

• ONE TO ONE• ONE TO MANY• MANY TO MANY

Page 263: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

263

Examples of Relationships?

• One-to-One : One customer to one account number

• One-to-Many: One Complex Building to many owners  

Page 264: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

264

DDL

• DDL stands for Data Definition Language

• DDL store files that contains data about data (metadata).

• For example storage of structure in data dictionary 

Page 265: MCS-032 Object Oriented Analysis & Design

© Copyright PCTI Group 2009Presentation Title | July 27, 2010 | <document classification>

265

DML

• Define Data Manipulation Language (DML)?

• DML enable users to access or manipulate data (retrieval, insertion, deletion).

• The part of DML that involves information retrieval is called a query language (QL) (structured Query Language- SQL)