+ All Categories
Home > Documents > 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant...

1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant...

Date post: 25-Dec-2015
Category:
Upload: sandra-baldwin
View: 213 times
Download: 0 times
Share this document with a friend
Popular Tags:
82
1 Spring 2005 Specification and Analysis of Information Systems based on the presentation at http://www.technion.ac.il/~erant Modeling Class Architecture with UML Class Diagrams Hoang Huu Hanh, PhD [email protected]
Transcript
Page 1: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

1Spring 2005Specification and Analysis of Information Systems

based on the presentation at http://www.technion.ac.il/~erant

Modeling Class Architecturewith UML Class Diagrams

Hoang Huu Hanh, PhD

[email protected]

Page 2: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

2

Outline

• Introduction• Classes, attributes and operations• Relations• Generalization• Guidelines for effective class modeling

Page 3: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

3

System Development Process

Phase Actions Outcome

Initiation Raising a business needBusiness documents

Requirements Interviewing stakeholders, exploring the system environment

Organized documentation

Analysis & Specification

Analyze the engineering aspect of the system, building system concepts

Logical System Model

Design Define architecture, components, data types, algorithms

Implementation Model

Implementation Program, build, unit-testing, integrate, documentation

Testable system

Testing & Integration

Integrate all components, verification, validation, installation, guidance

Testing results, Working sys

Maintenance Bug fixes, modifications, adaptationSystem versions

Intro | Classes | Relations | Generalization | Guidelines

Page 4: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

5

Elements of Modelling Language

• Symbols: Standard set of symbols

• Syntax: Acceptable ways of combining symbols

• Semantics: Meaning given to language expressions

C

C

C2

C1 sends a message to C2

C

C1

Intro | Classes | Relations | Generalization | Guidelines

Page 5: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

6

Advanced Properties

• Expressiveness: What the language can say

• Methodology: Procedures to be followed

• Guidelines: Suggestions on how to build effective models

OK: C1 sends messages to C2

Not OK: C1 sends messages to C2, after all messages of C2 were recieved

1. Model all classes2. Model all relations3. Model all inheritance

Try to model classes with a balanced number of associations

Intro | Classes | Relations | Generalization | Guidelines

Page 6: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

7

Modeling Approaches

Modeling approaches differ from each other according to their view of the world

Object-Oriented Process-Oriented State-Oriented

Focused on objects, which are concrete elements, combining information and actions

Focused on processes, which are patterns of transformation (of something). Processes can be concrete or abstract)

Focused on the different states – values and status of the system, and how and why these states change.

Intro | Classes | Relations | Generalization | Guidelines

Page 7: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

8

legend

Design Process

Activity/SequenceDiagram

ComponentDiagram

StateChart

ClassDiagram

Use CaseModel

System requirements

DeploymentDiagram

Structural

Behavioral

Intro | Classes | Relations | Generalization | Guidelines

Page 8: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

9

From Requirements to Structure

1. Administrator enters course name, code and description

2. System validates course code

3. System adds the course to the data base and shows a

confirmation message

Requirements Document

Structure (what’s the constant things of the system)

Course code (validation)

Course name

Course description

Data base

Intro | Classes | Relations | Generalization | Guidelines

Page 9: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

10

What is Structural Modeling?

A structural design defines the artifact unchanging characteristics, which do not change over time.

Intro | Classes | Relations | Generalization | Guidelines

Page 10: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

11

Structural Modeling in Information Systems

• Static structure of the model– the entities that exist (e.g., classes, interfaces, components,

nodes)– relationship between entities– internal structure

• Do not show– temporal information– Behavior– Runtime constraints

Intro | Classes | Relations | Generalization | Guidelines

Page 11: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

12

Outline

• Introduction• Classes, attributes and operations• Relations• Generalization• Guidelines for effective class modeling

Page 12: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

13

Object-Oriented Approach

• Objects are abstractions of real-world or system entities

Reality Domain Model Domain

vehicle

car

bus

cup

models

models

models

Intro | Classes | Relations | Generalization | Guidelines

Page 13: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

14

Classes

buy()display()

serialNumbernameprice

Produt

Intro | Classes | Relations | Generalization | Guidelines

Class Name

Attributes

Operations

• A class is a template for actual, in-memory, instances

Page 14: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

15

Attributes - Signature

[visibility] name [[multiplicity]] [: type] [=initial value] [{property}]

• visibility: the access rights to the attribute - multiplicity: how many instances of the attribute are they:

- middleName [0..1] : String, phoneNumber [1..*]

- Type: the type of the attribute (integer, String, Person, Course)

- initial value: a default value of the attribute- salary : Real = 10000, position : Point = (0,0)

- property: predefined properties of the attribute- Changeable, readOnly, addOnly, frozen (C++: const, Java: final)

Intro | Classes | Relations | Generalization | Guidelines

Page 15: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

16

Attributes - Examples

+ isLightOn : boolean = false- numOfPeople : intmySport+ passengers : Customer[0..10]- id : long {readOnly}

Intro | Classes | Relations | Generalization | Guidelines

Page 16: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

17

Operations - Signature

[visibility] name [(parameter-list)] [: return-type] [{property}]

• An operation can have zero or more parameters, each has the syntax:– [direction] name : type [=default-value]– Direction can be: in (input paremter - can’t be modified), out (output

parameter - may be modified), inout (both, may be modified)

• Property:– {leaf} – concrete operation– {abstract} – cannot be called directly– {isQuery} – operation leaves the state of the operation unchanged– …

Intro | Classes | Relations | Generalization | Objects | Guidelines

Page 17: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

18

Operations - Examples

+ isLightOn() : boolean+ addColor(newColor : Color)+ addColor(newColor : Color) : void# convertToPoint(x : int, y : int) : Point- changeItem([in] key : string, [out] newItem :

Item) : int

What’s the difference?

Intro | Classes | Relations | Generalization | Guidelines

Page 18: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

19

Visibility

• public (+) – external objects can access the member• private (-) – only internal methods can access the

member• protected (#) – only internal methods, or methods of

specialized objects can access the member

+ buy()+ display()- swap(x:int,y: int)

- serialNumber- name# price

Produt We will try to keep the visibility as minimal as

possible

Intro | Classes | Relations | Generalization | Guidelines

Page 19: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

20

Full Blown Class

Window

+default-size:Rectangle#maximum-size:Rectangle

+create ()

+display ()

+size:Area = (100,100)#visibility:Boolean = invisible

+hide ()

-xptr: XWindow

-attachXWindow(xwin:Xwindow*)

{transientstatus=tested} Constraints

<<abstract>>

Stereotype

Intro | Classes | Relations | Generalization | Guidelines

Page 20: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

21

Object Diagram

• In an Object Diagram, class instances can be modeled

buy()display()

serialNumbernameprice

Produt Apple Ipod : Product

name = “IMac 1C”price = 1456 $serialNumber = 184934

Apple IMac : Product

name = “Vaio Portable”price = 2999 $serialNumber = 113234

Sony Vaio : Product

In runtime

Class Diagram Object Diagram

Intro | Classes | Relations | Generalization | Guidelines

Page 21: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

22

Outline

• Introduction• Classes, attributes and operations• Relations• Generalization• Guidelines for effective class modeling

Page 22: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

23Intro | Classes | Relations | Generalization | Guidelines

Page 23: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

24

Relations

• A relation is a template for a connection between two instances.

• Relations are organized in a Hierarchy:– Dependency: dynamic relations– Associations: consistent relations– Composition: whole-part

relations

Intro | Classes | Relations | Generalization | Guidelines

Dependency

Association

Composition

Page 24: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

25

Associations

buy()display()

serialNumbernameprice

Produt

checkout()addProduct(Product p)clearAll()

orderIDdate

Order

includes

* *

MultiplicityIndicates cardinality• – 1:1default• 3 – exactly 3 object• * (or n) - unbounded• 1..* - 1 to eternity • 3..9 – 3 to 9

Intro | Classes | Relations | Generalization | Guidelines

• Objects on both sides of the association can find each other

• The relation is consistent in time (unless removed)

Page 25: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

26

Navigation

• If an association is directed, messages can pass only on that direction

• If the association does not have directions, then it’s a bidirectional association

• By default, all relations should be directed, unless the requirements dictate a bidirectional relation

Folder File

Intro | Classes | Relations | Generalization | Guidelines

Given a folder, we want to know the files of each folder. However, we do not have a requirement for knowing the folder of each file.

Page 26: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

27

Association Classes

Denoted as a class attached to the association, and specify properties of the association

buy()display()

serialNumbernameprice

Produt

checkout()addProduct(Product p)clearAll()

orderIDdate

Order

* *

addAnother()removeOne()

numberOfProducts : intgiftWrap : boolean

OrderLine

Intro | Classes | Relations | Generalization | Guidelines

According to the requirements, each product can appear is several orders, and each order may include several products

An association class is a “normal” class, and may include relations, inheritance etc.

Page 27: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

28

Association Class - Objects

Links should be verified, according to the association multiplicity

For each link, an association class instance should be declared

Intro | Classes | Relations | Generalization | Guidelines

Page 28: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

29

Class Normalization

• Classes should be normalized, if:1. Attributes are selected from large or infinite sets

2. Relations with attributes are in n:n form

3. Groups of attributes are related

Intro | Classes | Relations | Generalization | Guidelines

3

1

2

Before After

Page 29: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

30

Relations & Attributes

• Relations are denoted with associations, not attributes.

• Implementation (pointers, arrays, vectors, ids etc) is left to the detailed design phase.

Intro | Classes | Relations | Generalization | Guidelines

What is the problem?

Page 30: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

31

Role Names

• Names may be added at each end of the association

• Provide better understanding of the association meaning

• Especially helpful in self-associated classes

Person

Manager

Worker

Manages

Companyemployee employer

*

1..0

..*1 *

Intro | Classes | Relations | Generalization | Guidelines

Page 31: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

32

PlayerTeam

Year

Record

goals forgoals againstwinslosses

goalkeeper

season

team

ties

Ternary Associations

Intro | Classes | Relations | Generalization | Guidelines

Page 32: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

33

Qualifiers

• A qualifier is an attribute or list of attributes whose values serve to partition the set of objects associated with an object across an association

• The qualifier limits the multiplicity of the target object according to the qualifier attribute. Thus, even though a Bank has many persons, it has one or zero person with a particular account #

Intro | Classes | Relations | Generalization | Guidelines

Qualifier

College

Student

Student ID

1

1..*

Chessboard

Square

rank : intfile : int

1

1

Page 33: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

34

Constraints

• Constrains are simple properties of associations, classes and many other things in UML

• Specify limitations that implementers need to satisfy

Windowlengthwidth

{0.8 £length/width£1.5}

Dictionary Language Word{ordered}

*

1

Property Constraints

Denotes explicit order of instance

Intro | Classes | Relations | Generalization | Guidelines

Page 34: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

35

Constraints - cont’d

Project

Task

Outsource

{xor}

Employeesalary

boss

{salary < boss.salary}*

Intro | Classes | Relations | Generalization | Guidelines

Only one of the associations can exist for a given instance (what is the meaning of “or”?)

Committee*

**

memberOf

chairOf{subset}

*

0..1

{ordered}

A full order on associated objects

Page 35: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

36

Constraints

• Constraints can be applied to almost every element in UML diagrams, using:– natural language – mathematical notation – OCL (Object Constraint Language)

• Expressing:– Invariants: interest > 3%– Preconditions: before loan() takes place, salary > 5,000$– Postconditions: after loan() takes place, dayCollect = 1 or 10

See http://www.klasse.nl/ocl/index.html

Intro | Classes | Relations | Generalization | Guidelines

Page 36: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

38

Dependency

• Notated by a dotted line • The most general relation between classes• Indicates that an object affects another object

AccountingSystem

Reciept

<<creates>>

Order

SecurityControl

<<modifies>>

Intro | Classes | Relations | Generalization | Guidelines

AccountingSystem creates a Receipt object

Page 37: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

39

Dependency – cont’d

• Dependencies are the most abstract type of relations.

• Properties:– Dependencies are always directed (If a given class depends

on another, it does not mean the other way around).– Dependencies do not have cardinality.

• If instances of two classes send messages to each other, but are not tied to each other, then dependency is appropriated.

• Types:– «call»– «create»

Intro | Classes | Relations | Generalization | Guidelines

Page 38: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

40

Aggregation

• “Whole-part” relationship between classes• Assemble a class from other classes

– Combined with “many” - assemble a class from a couple of instances of that class

Intro | Classes | Relations | Generalization | Objects | Guidelines

AuthorfileNamePermission

Word Processing Document

Picture

name

Folder

*

*

*

Page 39: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

41

Composition

• Composition is a stronger form of aggregation

• Contained objects that live and die with the container

• Container creates and destroys the contained objects

Intro | Classes | Relations | Generalization | Objects | Guidelines

close()move()

Window

Operating System

Slider Header Panel

0..2 1

Page 40: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

42

Composition vs. Aggregation

Aggregation Composition

Part can be shared by several wholes

Part is always a part of a single whole

Parts can live independently (i.e., whole cardinality can be 0..*)

Parts exist only as part of the whole. When the wall is destroyed, they are destroyed

Whole is not solely responsible for the object

Whole is responsible and should create/destroy the objects

0..4category document

*Window Frame

*

Intro | Classes | Relations | Generalization | Objects | Guidelines

Page 41: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

43

Outline

• Introduction• Classes, attributes and operations• Relations• Generalization• Guidelines for effective class modeling

Page 42: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

44

Generalization – Definitions

• Super Class (Base class)– Provides common functionality and

data members

• Subclass (Derived class)– Inherits public and protected

members from the super class

– Can extend or change behavior of super class by overriding methods

• Overriding– Subclass may override the behavior

of its super class

Super Class

Subclass

Intro | Classes | Relations | Generalization | Guidelines

Page 43: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

45Intro | Classes | Relations | Generalization | Guidelines

Page 44: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

46

Generalization – advantages

• Modularity: – Eliminate the details– Find common

characteristics among classes

– Define hierarchies

• Reuse:– Allow state and behavior

to be specialized

paint()repaint()

x : inty : int

GraphicComponent

press()

caption : String

Button

paint()

picture : File

Image

clickImage()

ImageButton

Intro | Classes | Relations | Generalization | Guidelines

Multiple Inheritance

Overriding

Page 45: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

47

Generalization Guidelines

• Look carefully for similar properties between objects, sometimes they are not so obvious

What’s the problem here?

Intro | Classes | Relations | Generalization | Guidelines

id : longname : Stringdesc : StringSalary : FloatworkYears : int

Worker

getCategory() : Category

id : longname : Stringdesc : Stringavailability : int

Product

name : Stringimportance : int

Category

id : longname : Stringdesc : Stringdate : Date

Order

getCategory() : Category

id : longname : Stringdesc : Stringsubject : Subject

Document

updateName(...)updateDesc(...)

User Interface

** | includes

*

*Done by }

*

*

*

*

Page 46: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

48

id : longname : Stringdesc : String

Resource

Salary : FloatworkYears : int

Worker

availability : int

Product

getCategory() : Category

CategorizedResource

name : Stringimportance : int

Category

subject : Stringdate : Date

Document

date : Date

Order

updateName(...)updateDesc(...)

User Interface

** includes }

* *Done by }

**

Generalization – cont’d

ID and name are common to all classes

Intro | Classes | Relations | Generalization | Guidelines

Association is the same as any other attribute

Page 47: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

49

Content

<<abstract>>

Article Picture

News Article

MagazineArticle

has picture

1..*

1..*

Abstract Class

• A class that has no direct instances

Denoted by an Italics name

Or by the stereotype “abstract”

Intro | Classes | Relations | Generalization | Guidelines

Page 48: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

50Intro | Classes | Relations | Generalization | Guidelines

Models and Sets

Page 49: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

51

Generalization and Sets

paint()repaint()

x : inty : int

GraphicComponent

press()

caption : String

Button

paint()

picture : File

Image

clickImage()

ImageButton

GraphicComponent

ImageButton

ImageButtonClass

Instances

Class Representation Set Representation

Intro | Classes | Relations | Generalization | Guidelines

Page 50: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

52

What Relations are Missing?

• Union– We cannot define a class such as:allPeopleInTheTechnion = students Staff

• Complementary– We cannot create classes which take some of the super-class

properties but omit some of them:

MultiMedia = Content \ TextualContent

Textual

StudentsStaff

Intro | Classes | Relations | Generalization | Guidelines

Multimedia

Page 51: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

53

Dynamic Relations

• Dynamic Intersection– We cannot create classes by dynamically intersecting

between class properties

WorkerSecureWorker

Worker.security_status > 3

Those with security_status > 3

Workers

Intro | Classes | Relations | Generalization | Guidelines

Page 52: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

55

Interface

Encapsulation & Information Hiding

• Encapsulation is the separation between the external aspects of an object and its internals

• An Interface is:– A collection of method definitions for a set of behaviors – a

“contract”.– No implementation provided.

ImplementationOperation 1

Operation 2

Data

Operation 1 Impl’

Operation 2 impl’

External Object

Operation 1Operation 1Operation 1 Declaration

Operation 2 Declaration

Intro | Classes | Relations | Generalization | Guidelines

Page 53: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

56

Class

Interface Terminology

Interface

Operation 1

Operation 2

Data

Operation 1 Impl’

Operation 2 impl’

Operation 1 Declaration

Operation 2 DeclarationRealizes

• Realization relation:

Intro | Classes | Relations | Generalization | Guidelines

Page 54: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

57

Example: Microsoft’s Common Object Model

0

10

20

30

40

50

60

70

80

90

1st Qtr 2nd Qtr 3rd Qtr 4th Qtr

EastWestNorth

4 53 2

..0

1

Intro | Classes | Relations | Generalization | Guidelines

Thg3 2007Thg3 2007

CN Hai Ba Tư Năm Sau Bay

25 26 27 28 1 2 3

4 5 6 7 8 9 10

11 12 13 14 15 16 17

18 19 20 21 22 23 24

25 26 27 28 29 30 31

1 2 3 4 5 6 7

Page 55: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

58

Interfaces Notation

Realization: The object guarantees to carry out the contract specified by the interface

Intro | Classes | Relations | Generalization | Guidelines

create()move()delete()display()

uniqueID : IDwidth : intheight : int

«interface»ICommonObject Client

Application

EquationPowerPoint Document

Excel Document

Page 56: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

59

Interfaces Notations - cont’d

• Another way to notate interfaces:

Client

ICommonObject

Equation. . .

. . .

Provided Interface

Required

Intro | Classes | Relations | Generalization | Guidelines

Page 57: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

60

Outline

• Introduction• Classes, attributes and operations• Relations• Generalization & Encapsulation• Guidelines for effective class modeling

Page 58: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

61

How to Model?

Delete order

type Product price

buy category

preview

Product

Buying Actions

Viewing Actions

Customer name

View old orders

Bottom-up Process Top-down Process

Starting with throwing all classes on the page, and then combining them:

Starting with an overview ofthe system, and then splittingclasses

Customer Management

Intro | Classes | Relations | Generalization | Guidelines

Page 59: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

62

CRC Cards

• CRC Cards:– Class,

Responsibility, Collaboration

Intro | Classes | Relations | Generalization | Guidelines

Page 60: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

63

Guidelines for Effective Class Diagram

• Identifying classes– Very similar to identifying data repositories in DFD. Identify data

elements, and model them.– Plus, think of classes that handle processes. If operations are

complicated enough, we might want to model them separately.– Plus, think of the actors. Are all their needs covered by existing

operations?

Intro | Classes | Relations | Generalization | Guidelines

Page 61: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

64

General Assumptions

• Access– Users can execute any public operation of the classes

(except when using specialized stereotypes).

• Lifespan– Objects (except transient objects) have an endless life span. – We don’t need to bother with their serialization.

• Simplicity– No need for get/set.– No need for constructors / distracters .

Intro | Classes | Relations | Generalization | Guidelines

Page 62: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

65

Finding Objects

• Objects can be found, browsed through and located without any aggregating class.

Intro | Classes | Relations | Generalization | Guidelines

That’s enough for Loan Service to access all instances of Book

Page 63: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

66

Guidelines – Modeling Actors

• A common mistake is to model actors as classes• Remember -

– Actors interact with the system directly, they don’t need to be represented a priory

– Sometimes, the system saves data about customers, but it does not mean that they do all their actions through this class

Intro | Classes | Relations | Generalization | Guidelines

Page 64: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

67

Guidelines – User Interfaces

• If the user has complicated interactions with the system, then we may want to dedicate a special class as a “user interface”

• Remember – it’s not the same class as the class that contains data about the actor

Intro | Classes | Relations | Generalization | Guidelines

Page 65: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

68

Summary

Introduction– Structural modeling

Classes– Attributes and operations

Relations– Associations, constraints– Dependencies, compositions

Generalization– Inheritance– Interfaces

Object Diagrams Guidelines for effective class modeling

Page 66: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

69

OBJECT AND CLASS CONSTRUCTING

Page 67: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

70

Objectives

• Provide guidelines on how to determine the classes/objects in the system

• Define class/object structuring criteria

Page 68: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

71

Categorization of Application Classes

Page 69: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

72

External Classes and Interface Classes

• External classes are classes that are external to the system and that interface to the system.

• Interface (boundary) classes are classes internal to the system that interface to the external classes.

Page 70: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

73

Categorization of External Classes

Page 71: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

74

Identifying Interface Classes

• Each of the external classes interfaces to an interface class in the system.

– An external user class interfaces to a user interface class– An external system class interfaces to a system interface

class– An external input device class interfaces to an input device

interface class– An external output device class interfaces to an output device

interface class– An external I/O device class interfaces to an I/O device

interface class– An external timer class interfaces to an internal timer class

Page 72: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

75

Banking System: External Classes and Interface Classes

Page 73: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

76

Entity Classes

• Store information

• Often mapped to relational database during design

Page 74: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

77

Control Classes

• A control class provides the overall coordination for execution of a use case.

• Makes overall decision

• Control objects decides when, and in what order, other objects participate in use case– Interface objects– Entity objects

• Simple use cases do not need control objects.

Page 75: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

78

Kinds of Control Classes

• Coordinator class– Provides sequencing for use case– Is not state dependent

• State dependent control class– Defined by finite state machine

• Timer class– Activated periodically

Page 76: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

79

Example: Coordinator Object

Page 77: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

80

Example: State Dependent Control Object

Page 78: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

81

Example: Timer Object

Page 79: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

82

Application Logic Classes

• Business logic class– Defines business-specific application logic (rules) for

processing a client request– Usually accesses more that one entity object

• Algorithm class– Encapsulates algorithm used in problem domain– More usual in scientific, engineering, real-time domains

Page 80: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

83

Example: Business Logic Object

Page 81: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

84

Example: Algorithm Object

Page 82: 1Spring 2005 Specification and Analysis of Information Systems based on the presentation at erant Modeling Class Architecture.

85

Tips

• Don’t try to use all the various notations.• Don’t draw models for everything, concentrate on

the key areas.• Draw implementation models only when illustrating

a particular implementation technique.


Recommended