2009 04 phantichuse-case

Upload: dinh-brave

Post on 19-Jul-2015

162 views

Category:

Documents


0 download

TRANSCRIPT

Gio trnh Phn tch v thit k hng i tng bng UML

Phn tch Use-Case

Phn tch Use-Case Dng Anh c

1

Mc tiu Tm hiu mc ch ca cng on Use-Case Analysis v tr ca n trong chu k sng ca qui trnh pht trin phn mm Xc nh cc class thc hin mt use- case flow of events Phn phi cc hnh vi (behaviour) ca use-case v cc class ca n, thng qua vic xc nh nhim v ca cc class Pht trin cc use-case realization m hnh ha collaboration gia cc th hin ca cc class xc nh

Phn tch Use-Case Dng Anh c

2

Use-Case Analysis trong ng cnh

Architectural AnalysisReview the Architecture Architecture Reviewer

Architect

Architectural Design

Describe Concurrency

Describe Distribution

Use-Case Analysis Designer Use-Case Design

Subsystem Design Review the Design

Design Reviewer

Class Design

Phn tch Use-Case Dng Anh c

3

Tng quan Use-Case Analysis

Software Architecture Glossary Use-Case Document Modeling Guidelines Supplementary Specifications

Analysis Classes

Use-Case Realization (identified)

Use-Case Analysis

Use-Case Realization (developed)

Use-Case ModelPhn tch Use-Case Dng Anh c

Analysis Model (optional)4

Design Model

Cc bc trong Use-Case Analysis B sung m t Use-Case Vi mi use-case realization Tm cc Class t Use-Case Behavior Phn b Use-Case Behavior v cc Class Vi mi analysis class tm thy M t nhim v ca chng M t cc Attribute v cc Association Lng gi (qualify) cc Analysis Mechanism Hp nht cc Analysis Class CheckpointsPhn tch Use-Case Dng Anh c

5

Cc bc trong Use-Case Analysis B sung m t Use-Case Vi mi use-case realization Tm cc Class t Use-Case Behavior Phn b Use-Case Behavior v cc Class Vi mi analysis class tm thy M t nhim v ca chng M t cc Attribute v cc Association Lng gi (qualify) cc Analysis Mechanism Hp nht cc Analysis Class CheckpointsPhn tch Use-Case Dng Anh c

6

Supplement the Use-Case Description

H thng hin th mt danh sch cc lp hc (course offerings).Phn tch Use-Case Dng Anh c

H thng truy vn v hin th mt danh sch cc lp hc ang m t CSDL course catalog k tha t h thng c.

7

Cc bc trong Use-Case Analysis B sung m t Use-Case Vi mi use-case realization Tm cc Class t Use-Case Behavior Phn b Use-Case Behavior v cc Class Vi mi analysis class tm thy M t nhim v ca chng M t cc Attribute v cc Association Lng gi (qualify) cc Analysis Mechanism Hp nht cc Analysis Class CheckpointsPhn tch Use-Case Dng Anh c

8

Review: Class L mt s tru tng ha M t mt nhm cc i tng c chung: Properties (attributes) Behavior (operations) Relationships Ng ngha (Semantics)Class Name Professor name empID create( ) save( ) delete( ) change( )

AttributesOperations

Phn tch Use-Case Dng Anh c

9

Review: Use-Case RealizationUse-Case Model Design Model

Use Case

Use-Case Realization

Sequence Diagrams

Collaboration Diagrams

Use Case Class Diagrams10

Phn tch Use-Case Dng Anh c

Tm cc Class t Use-Case Behavior Ton b hnh vi ca mt use case phi c phn b v cho cc analysis class

Phn tch Use-Case Dng Anh c

11

Th no l mt Analysis Class?

Use-case behavior coordination

System boundary

System information

Phn tch Use-Case Dng Anh c

12

Analysis Classes: A First Step Towards Executables

Use Cases

Analysis Design Classes ElementsUse-Case Analysis

Source Code

Exec

Phn tch Use-Case Dng Anh c

13

Th no l mt Boundary Class? Lm trung gian giao tip vi nhng g nm ngoi h thng Mt s kiu Cc User interface class Cc System interface class Cc Device interface class Mt boundary class cho 1 cp actor/use caseAnalysis class stereotype

Ph thuc mi trngPhn tch Use-Case Dng Anh c

14

Vai tr ca Boundary Class

Customer

M hnh ha s tng tc gia system v mi trng ca nPhn tch Use-Case Dng Anh c

15

V d: Tm cc Boundary Class Mt boundary class cho 1 cp actor/use case

Student

Register for Courses

Course Catalog System

RegisterForCoursesForm

CourseCatalogSystem

Phn tch Use-Case Dng Anh c

16

Guidelines: Boundary Class Cc User Interface Class Tp trung vo nhng thng tin g c th hin cho ngi dng KHNG tp trung vo cc chi tit UI Cc System v Device Interface Class Tp trung vo nhng protocols no phi nh ngha KHNG tp trung vo cch m cc protocol s c ci t Tp trung vo cc nhim v, ch khng phi chi tit!

Phn tch Use-Case Dng Anh c

17

Th no l mt Entity Class? Cc tru tng ha then cht ca systemAnalysis class stereotypeGlossary

Use Case

Business-Domain Model Architectural Analysis AbstractionsPhn tch Use-Case Dng Anh c

c lp mi trng18

Vai tr ca Entity Class

Customer

Lu tr v qun tr cc thng tin trong systemPhn tch Use-Case Dng Anh c

19

V d: Tm cc Entity Class Dng use-case flow of events nh input Cc tru tng ha then cht ca use case Hng tip cn truyn thng (nouns filtering) Gch di cc cm danh t trong flow of events Loi b cc ng vin d tha Loi b cc ng vin m h, khng r rng Loi b cc actor (ngoi phm vi) Loi b cc kin trc ci t Loi b cc attribute ( li dng sau) Loi b cc operation

Phn tch Use-Case Dng Anh c

20

V d: Candidate Entity Class Register for Courses (Create Schedule)

Student CourseOffering

Schedule

Phn tch Use-Case Dng Anh c

21

Review: Generalization Mt class chia s cu trc v/hoc hnh vi ca mt hay nhiu class Superclass Mi quan h L mt dng (parent) ca Trong phn tch, s dng mc n gin, s siAccount balance name number Withdraw() CreateStatement()

Generalization Relationship

Checking

Savings GetInterest() Withdraw()

SubclassesWithdraw()

Phn tch Use-Case Dng Anh c

22

Finding Generalization: Generalization of ClassesStock Savings Checking

Tng qut hn

RealEstate

Bond

Asset

BankAccount

Security

RealEstate

Savings

Checking

Stock

Bond

Phn tch Use-Case Dng Anh c

23

Finding Generalization: Specialization of Classes

Asset

Asset

BankAccount

Security

RealEstate

Savings

Checking

Stock

Bond

Chuyn bit hn

Phn tch Use-Case Dng Anh c

24

Example: Generalization (Chia s ng ngha)Part-timeStudent Full-timeStudentname address studentID gradDate

Khng c s tng qut ha

name address studentID numberCourses

Student

C s tng qut ha

name address studentID

FulltimeStudent gradDate

ParttimeStudent

maxNumCourses

Phn tch Use-Case Dng Anh c

25

Th no l mt Control Class? Nh iu phi cc hnh vi ca Use-case Ch mt control class cho mt use case

Use Case

Analysis class stereotype

Ph thuc use-case, c lp mi trng

Phn tch Use-Case Dng Anh c

26

Vai tr ca Control Class

Customer

iu phi cc hnh vi ca use-casePhn tch Use-Case Dng Anh c

27

V d: Tm cc Control Class Mt control class cho mt use case

Student

Register for Courses

Course Catalog System

RegistrationController

Phn tch Use-Case Dng Anh c

28

Example: Summary: Analysis Classes

Student

Register for Courses

Course Catalog System

Use-Case Model Design Model RegisterForCoursesForm RegistrationController CourseCatalogSystem

Student

Schedule

CourseOffering

Phn tch Use-Case Dng Anh c

29

Cc bc trong Use-Case Analysis B sung m t Use-case Vi mI use-case realization Tm cc Class t Use-Case Behavior Phn b Use-Case Behavior v cc Class Vi mi analysis class tm thy M t nhim v ca chng M t cc Attribute v cc Association Lng gi (qualify) cc Analysis Mechanism Hp nht cc Analysis Class CheckpointsPhn tch Use-Case Dng Anh c

30

Phn b Use-case v cc Class i vi mi use-case flow of events: Xc nh cc analysis class Gn kt cc trch nhim ca use-case cho cc analysis class M hnh ha tng tc ca cc analysis class trong interaction diagram

Sequence Diagrams Use Case

Collaboration Diagrams

Use-Case Realization

Phn tch Use-Case Dng Anh c

31

Interaction Diagrams Generic term that applies to several diagrams that emphasize object interactions Sequence Diagram Time oriented view of object interaction

Sequence Diagrams

Communication Diagram (or Collaboration Diagram) Structural view of messaging objectsCommunication DiagramsPhn tch Use-Case Dng Anh c

32

Guidelines: Allocating Responsibilities to Classes Dng cc A.Class stereotype lm guide: Cc Boundary Class Cc hnh vi lin quan n s giao tip vi actor Cc Entity Class Cc hnh vi lin quan n d liu c gi trong mt abstraction Cc Control Class Cc hnh vi c th cho mt use case hoc mt phn rt quan trng ca flow of events

(cn tip)Phn tch Use-Case Dng Anh c

33

Guidelines: Allocating Responsibilities to Classes (tt) Ai c d liu cn cho vic thc hin nhim v? Mt class c d liu, hy nhim v cng vi d liu Nhiu class c d liu : Hy nhim v trong 1 class v thm quan h vi cc class khc. To mt class mi, nhim v trong class mi ny, v thm quan h vi cc class c Hy nhim v trong control class, v thm quan h vi cc class cn thc hin nhim v

Phn tch Use-Case Dng Anh c

34

The Anatomy of Sequence DiagramsClient Object

Supplier Object

:Client

:Supplier

Object Lifeline1: PerformResponsibility y l mt script mu

Reflexive Message

Message

1.1: PerformAnother Responsibility

Hierarchical Message Numbering Focus of ControlPhn tch Use-Case Dng Anh c

35

Register for Courses Use Case Basic flow: Create a Schedule1. The Student selects "create schedule." 2. The system retrieves a list of available course 3. 4.

5. 6.

offerings from the Course Catalog System. The system displays a blank schedule form. The Student selects 4 primary course offerings and 2 alternate course offerings from the list of available offerings. Once the selections are complete the Student selects "submit." H thng to mt lch hc cha nhng hc phn sinh vin ng k. Sinh vin kim tra v xc nhn lch hc, Submit Schedule c thc thi.36

Phn tch Use-Case Dng Anh c

Analysis Classes

Phn tch Use-Case Dng Anh c

37

Example: Sequence Diagram: Student : RegisterForCoursesForm : RegistrationController : CourseCatalogSystem : Course Catalog : Schedule : Student

1. // create schedule( ) 1.1. // get course offerings( ) Student wishes to create a new schedule 1.1.1. // get course offerings(forSemester) 1.1.1.1. // get course offerings( ) 1.2. // display course offerings( )

A list of the available course offerings for this semester are displayed

A blank schedule is displayed for the students to select offerings

1.3. // display blank schedule( )

2. // select 4 primary and 2 alternate offerings( ) 2.1. // create schedule with offerings( )

2.1.1. // create with offerings( ) 2.1.2. // add schedule(Schedule)

At this, point the Submit Schedule subflow is executed.Phn tch Use-Case Dng Anh c

38

Example: Sequence Diagram (cont.): RegisterForCoursesForm : Student : RegistrationController : Schedule : : CourseOffering PrimaryScheduleOfferingInfob : Student

1. // submit schedule( ) 1.1. // submit schedule( )1.1.1. // save( )

1.1.2. // submit( ) 1.1.2.1. // is selected?( ) [ is selected ] 1.1.2.2. // has pre-requisites(CourseOffering) Repeat for all primary course offerings. An attempt is made to register the student for all selected course offerings 1.1.2.3. // still open?( ) 1.1.2.4. // any conflicts?( ) [ has pre-requisites, course offering open, and no schedule conflicts ] 1.1.2.5. // add student(Schedule) 1.1.2.6. // mark as enrolled in( )

Phn tch Use-Case Dng Anh c

39

Example: Use case Withdraw of ATMUse case: WithdrawIdentify Nouns

Actor: Client Purpose: To allow the client to withdraw money Pre-conditions: User already logged-in Post-conditions: Amount is deducted from users account Main flow:1) Client initiates this usecase by selecting 'withdraw' 2) System displays all the accounts related to the Card and prompts to select any one. 3) Client selects one account. 4) System prompts for the amount (fast cash or )40

Client User Account Amount Money Card Cash

Phn tch Use-Case Dng Anh c

Sequence Diagram Use case Withdraw

: Client

: WithdrawUI

: WithdrawControl

: Card

: Account

1: // select withdraw( ) 2: // get list accounts( ) 3: // get accounts( ) 4: // get info( )

5: // display account( )

6: // select account( ) 7: // enter money( ) 8: // withdraw( ) 9: [enough money] // withdraw( )

Phn tch Use-Case Dng Anh c

41

The Anatomy of Collaboration DiagramsClient Object Link:Client :Supplier 1: PerformResponsibility

Supplier Object

MessagePhn tch Use-Case Dng Anh c

42

Example: Collaboration Diagram1.2. // display course offerings( ) 1.3. // display blank schedule( )

1. // create schedule( ) 2. // select 4 primary and 2 alternate offerings( ) : RegisterForCoursesForm

: Course Catalog: Student 1.1. // get course offerings( ) 2.1. // create schedule with offerings( ) 1.1.1.1. // get course offerings( )

1.1.1. : RegistrationController // get course offerings(forSemester) : CourseCatalogSystem 2.1.1. // create with offerings( ) 2.1.2. // add schedule(Schedule) : Student : Schedule

Phn tch Use-Case Dng Anh c

43

Example: Collaboration Diagram (cont.)1. // submit schedule( ) : RegisterForCoursesForm

: Student 1.1. // submit schedule( )

1.1.2.4. // any conflicts?( )

1.1.1. // save( ) 1.1.2. // submit( ) : RegistrationController

1.1.2.3. // still open?( ) 1.1.2.5. // add student(Schedule) : Schedule : CourseOffering

1.1.2.1. // is selected?( ) 1.1.2.6. // mark as enrolled in( ): PrimaryScheduleOfferingInfob

1.1.2.2. // has pre-requisites(CourseOffering)

: Student

Phn tch Use-Case Dng Anh c

44

One Interaction Diagram Not Good EnoughBasic Flow Alternate Flow 1 Alternate Flow 2 Alternate Flow 3

AF3 AF1 AF2

Alternate Flow 4

Alternate Flow 5

Alternate Flow n

Phn tch Use-Case Dng Anh c

45

Collaboration Diagrams Vs Sequence Diagrams Collaboration Diagrams Ch ra cc mi quan h b sung cho cc tng tc Trc quan ha tt hn cc mu cng tc Trc quan ha tt hn cc hiu ng tc ng ln mt i tng c D s dng hn trong cc vn cn gii quyt tp th Sequence Diagrams Ch ra r rng chui cc thng ip Trc quan ha tt hn ton b lung s kin Tt hn cho cc c t real-time v cho cc scenario phc tp

Phn tch Use-Case Dng Anh c

46

Exercise: Use-Case Analysis, Part 1 Hy xy dng: Use-Case Model, c bit l cc use-case flows of events Cc tru tng ha/class then cht Hy xc nh cc thng tin sau cho mt use case c th: Cc analysis class, cng vi chng l: Brief descriptions Stereotypes Responsibilities Cc collaboration cn thit ci t use case

(cn tip)Phn tch Use-Case Dng Anh c

47

Exercise: Use-Case Analysis, Part 1 (tt) Vi mt use case c th, hy thit lp: Use-case realization interaction diagram cho ti thiu mt trong cc use-case flows of events

Phn tch Use-Case Dng Anh c

48

Cc bc trong Use-Case Analysis B sung m t Use-case Vi mI use-case realization Tm cc Class t Use-Case Behavior Phn b Use-Case Behavior v cc Classs Vi mI analysis class tm thy M t nhim v ca chng M t cc Attribute v cc Association Lng gi (qualify) cc Analysis Mechanism Hp nht cc Analysis Class CheckpointsPhn tch Use-Case Dng Anh c

49

Describe Responsibilities Trch nhim (responsibilities) l g? Lm th no tm ra chng?Interaction Diagram:Client // PerformResponsibility :Supplier

Class DiagramSupplier// PerformResponsibilityPhn tch Use-Case Dng Anh c

50

Example: View of Participating Classes (VOPC) Class Diagram RegistrationController RegisterForCoursesForm // submit schedule() // display course offerings() // display schedule() // create schedule() // select 4 primary and 2 alternate offerings() // display blank schedule() // get course offerings() // submit schedule() // create schedule with offerings() CourseCatalogSystem // get course offerings()

Schedule

ScheduleOfferingInfo status // mark as selected() // mark as cancelled() // is selected?()

Student// add schedule() // has pre-requisites()

// create with offerings() // submit() // save()

CourseOffering number : String = "100" startTime : Time endTime : Time days : Enum // add student() // still open?() // save()

PrimaryScheduleOfferingInfo grade // is enrolled in?() // mark as enrolled in()

Phn tch Use-Case Dng Anh c

51

Maintaining Consistency: What to Look For In order of criticality Redundant responsibilities across classes Disjoint responsibilities within classes Class with one responsibility Class with no responsibilities Better distribution of behavior Class that interacts with many other classes

Phn tch Use-Case Dng Anh c

52

Cc bc trong Use-Case Analysis B sung m t Use-case Vi mI use-case realization Tm cc Class t Use-Case Behavior Phn b Use-Case Behavior v cc Classs Vi mI analysis class tm thy M t nhim v ca chng M t cc Attribute v cc Association Lng gi (qualify) cc Analysis Mechanism Hp nht cc Analysis Class CheckpointsPhn tch Use-Case Dng Anh c

53

Describe Attributes and Associations nh ngha cc Attribute Thit lp cc mi quan h dng Aggregation v Association

Phn tch Use-Case Dng Anh c

54

Review: What is an Attribute?

ClassNameAttribute : Type = InitValue Attribute : Type = InitValue Attribute : Type = InitValue

CourseOfferingnumber :String=100 startTime : Time endTime: Time days: enum

Trong analysis, khng nn tn nhiu thi gian cho vic xc nh cc attribute signature

attribute

Phn tch Use-Case Dng Anh c

55

Finding Attributes Cc thuc tnh/c im ca cc class Cc thng tin c gi li bi cc class Cc danh t khng bin thnh class Cc thng tin m gi tr ca chng l quan trng Cc thng tin ddc s hu bi 1 object duy nht Cc thng tin khng c hnh vi

Phn tch Use-Case Dng Anh c

56

Review: What is an Association? M hnh ha mt lin h ng ngha gia cc th hin (instances) ca cc class StudentSimple associationis a pre-requisite of

CourseOffering

Schedule Course Reflexive association

Association l mt quan h cu trcPhn tch Use-Case Dng Anh c

57

Review: What are Roles? Nhn vt m mt class ng vai trong association CourseOffering Instructor Department head Department Professor

Role Name

Pre-requisites Course

Phn tch Use-Case Dng Anh c

58

Example: Multiple AssociationsprimaryCourses Schedule alternateCourses CourseOffering

Schedule

add student to remove student from

CourseOffering

Cc multiple association phi phn nh cc multiple rolePhn tch Use-Case Dng Anh c

59

Review: Multiplicity Khng m t Duy nht mt Zero hoc nhiu (many, unlimited)

1 0..* *

Mt hoc nhiu Zero hoc 1 Mt on Nhiu on ri nhau

1..* 0..1 2..4 2, 4..6

Phn tch Use-Case Dng Anh c

60

Example: Multiplicity

Bn s

Student

1

0..*

Schedule

0..*primaryCourses

0..4 0..* 0..2alternateCourses

CourseOffering

Phn tch Use-Case Dng Anh c

61

Review: Navigability Kh nng nh hng t associating class n target class

Hai chiu

Class1

Class2

Mt chiu

Class1

Class2

Phn tch Use-Case Dng Anh c

62

Example: Navigability RegisterForCoursesForm1

1

RegistrationController

1-way navigation

Schedule

0..* 0..*

0..4primaryCourses

0..2alternateCourses

CourseOffering

2-way navigationPhn tch Use-Case Dng Anh c

63

Review: What is Aggregation? Mt dng c bit ca association dng m hnh ha mt mi quan h ton th-b phn gia ton th v cc phn ca nWhole/aggregate part

Student

1

0..*

Schedule

0..*primaryCourses

0..4 0..*

0..2alternateCourses

CourseOffering

Phn tch Use-Case Dng Anh c

64

Association or Aggregation? Xem xt Ng cnh, cc c trng c lp ca Class2Class1 association Class2

Class1

aggregation

Class2

Khi cm thy nghi ng hy dng associationPhn tch Use-Case Dng Anh c

65

Nhn din AggregationBn ng ngha c th ca Aggregation S hu c quyn (Exclusive Owns): Book has Chapter C s ph thuc tn ti (khng c chapter nu khng c book) Khng chia s L thuc tnh c nh (mt chapter khng th chuyn sang book khc)

S hu (Owns): Car has Tire Khng chia s Khng l thuc tnh c nh (c th chuyn tire sang mt car khc)

C (Has): Department has StudentPhn tch Use-Case Dng Anh c

Khng c s ph thuc tn ti, c th chia s.66

Composition and Aggregation Aggregation c bn l bt k quan h whole part Ng ngha c th rt m h Tng ng vi ng ngha "Has" v "Member". Mt i tng thnh phn (part) c th thuc nhiu hn mt i tng bao gm (whole)

Composition l Aggregation mnh hn Ti mt thi im, mi i tng thnh phn (part) ch c th thuc ch mt i tng bao gm (whole). C s ph thuc tn ti t "part" vo "whole" Khi i tng "whole" b hy th cc "part" cng b hy67

Phn tch Use-Case Dng Anh c

Aggregation and CompositionQuan h m*n c th chp nhn Cc Student c th trong nhiu CourseOffering. Nu CourseOffering b hy, cc Student khng b hy!

CourseOffering 1..* 0..*

Student

Quan h m*n khng c php

Book 1 1..*

Chapter

Nu Book b xa, cc chng (Chapter) trong Book cng b xa!

Phn tch Use-Case Dng Anh c

68

Association Class Mt class c gn vo mt association Cha cc thuc tnh ca relationship Mt th hin / 1 link ScheduleOfferingInfo status// mark as selected() // mark as cancelled() // is selected?()

0..* Schedule 0..*

alternateCourses 0..2 CourseOffering primaryCourses 0..4

PrimaryScheduleOfferingInfob grade // is enrolled in?() // mark as enrolled in() 69 // mark as committed()

Phn tch Use-Case Dng Anh c

Finding Relationships1: PerformResponsibility

Collaboration DiagramClient

:Client

:Supplier

Link Supplier

Class Diagram

Client

0..*

0..*Prime suppliers

SupplierPerformResponsibility()

Association

To Relationship cho mi link!Phn tch Use-Case Dng Anh c

70

Example: What Associations Can You Find?1.2. // display course offerings( ) 1.3. // display blank schedule( )

1. // create schedule( ) 2. // select 4 primary and 2 alternate offerings( ) : RegisterForCoursesForm

: Course Catalog: Student 1.1. // get course offerings( ) 2.1. // create schedule with offerings( ) 1.1.1.1. // get course offerings( )

1.1.1. : RegistrationController // get course offerings(forSemester) : CourseCatalogSystem 2.1.1. // create with offerings( ) 2.1.2. // add schedule(Schedule) : Student : Schedule

Phn tch Use-Case Dng Anh c

71

Example: VOPC: Finding Relationships

RegisterForCoursesForm

1

1

RegistrationController

0..1

currentSchedule

0..1

Student

Schedule

primaryCourses

CourseOffering

1

0..*

0..*

0..4

Phn tch Use-Case Dng Anh c

72

Example: VOPC: Finding Relationships RegisterForCoursesForm // create schedule () // display course offerings () // display blank schedule // select 4 primary and 2 alternate offerings() 1 1 CourseCatalogSystem 1 0..*

RegistrationController// get course offerings() // create schedule with offerings

// get course offerings(forSemester)0..1 0..1 registrant Student // add schedule (Schedule)

0..1

1

currentSchedule

Schedule // create with offerings()

Phn tch Use-Case Dng Anh c

73

Example: What Associations Can You Find?1. // submit schedule( ) : RegisterForCoursesForm

: Student 1.1. // submit schedule( )

1.1.2.4. // any conflicts?( )

1.1.1. // save( ) 1.1.2. // submit( ) : RegistrationController

1.1.2.3. // still open?( ) 1.1.2.5. // add student(Schedule) : Schedule : CourseOffering

1.1.2.1. // is selected?( ) 1.1.2.6. // mark as enrolled in( ): PrimaryScheduleOfferingInfob

1.1.2.2. // has pre-requisites(CourseOffering)

: Student

Phn tch Use-Case Dng Anh c

74

Example: VOPC: Finding Relationships (tt) PrimaryScheduleOfferingInfob grade // is enrolled in?() // mark as enrolled in() Schedule primaryCourses CourseOffering number : String = "100" startTime : Time endTime : Time days : Enum

// cancel(theOffering : CourseOffering) // submit() // any conflicts?() // create with offerings()

0..* 0..*

0..4

alternateCourses

// add student() 0..2 // cancel() // still open?() // save()

ScheduleOfferingInfo status // mark as selected() // mark as cancelled() // is selected?()

Phn tch Use-Case Dng Anh c

75

Use-Case Analysis Steps B sung m t Use-case Vi mi use-case realization Tm cc Class t Use-Case Behavior Phn b Use-Case Behavior v cc Classs Vi mi analysis class tm thy M t nhim v ca chng M t cc Attribute v cc Association Lng gi (qualify) cc Analysis Mechanism Hp nht cc Analysis Class CheckpointsPhn tch Use-Case Dng Anh c

76

Unify Analysis Classes

Phn tch Use-Case Dng Anh c

77

Unify Analysis Classes

Phn tch Use-Case Dng Anh c

78

Evaluate Your Results

Glossary Design Model Supplementary Specification

Use-Case Model Analysis Classes

Phn tch Use-Case Dng Anh c

79

Use-Case Analysis Steps B sung m t Use-case Vi mi use-case realization Tm cc Class t Use-Case Behavior Phn b Use-Case Behavior v cc Classs Vi mi analysis class tm thy M t nhim v ca chng M t cc Attribute v cc Association Lng gi (qualify) cc Analysis Mechanism Hp nht cc Analysis Class CheckpointsPhn tch Use-Case Dng Anh c

80

Checkpoints: Analysis ClassesCc class c hp l khng? Tn ca cc class c phn nh ng vai tr ca chng? Class c biu din 1 single well-defined abstraction? Tt c cc attribute v responsibility c gn kt vi nhau v mt chc nng khng? Class c cung cp cc hnh vi c y/c? Tt c cc yu cu c th c th hin trn class cha?

(cn tip)Phn tch Use-Case Dng Anh c

81

Checkpoints: Use-Case Realizations Tt c cc lung chnh v lung con c iu khin cha, bao gm c cc trng hp ngoi l? tm thy tt c cc i tng cn thit? phn phi mt cch r rng tt c cc hnh vi v cc i tng cha? Cc hnh vi c c phn phi v ng i tng khng? Cc interaction diagrams nm u, mi quan h gwiax chng c r rng v ph hp khng?

Phn tch Use-Case Dng Anh c

82

Review: Use-Case Analysis Mc tiu ca Use-Case Analysis l g? Mt analysis class l g? Cho bit tn v m t v 3 analysis stereotype. Use-case realization l g? M t mt vi hot ng kho st when t cc trch nhim cho cc analysis class. Bao nhiu interaction diagram phi c xy dng trong giai on Use-Case Analysis?

Phn tch Use-Case Dng Anh c

83

Exercise: Use-Case Analysis, Part 2 Hy cho bit cc khi nim sau: Cc Requirements artifact, c bit l c t b sung Cc c ch phn tch c th Cc flow of events interaction diagram cho mt use case c th Vi mi use case hy xc nh cc d kin sau: Cc thuc tnh v cc mi quan h ca Analysis class Cc c ch phn tch Analysis class Xy dng cc lc sau: VOPC class diagram, cha cc analysis class, stereotype ca chng, nhim v, cc attribute, v relationship. nh x Analysis class vi cc c ch phn tchPhn tch Use-Case Dng Anh c

84