ccmtptpm 07 phantichuse-case
TRANSCRIPT
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 1
Công cụ và môi trường phát triển phần mềm
Phân tích Use-Case
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 2
Mục tiêu
w Tìm hiểu mục đích của công đoạn Use-Case Analysis vị trí của nó trong chu kỳ sống của qui trình phát triển phần mềm
w Xác định các class thực hiện một use- case flow of eventsw Phân phối các hành vi (behaviour) của use-case về các class
của nó, thông qua việc xác định nhiệm vụ của các classw Phát triển các use-case realization mô hình hóa collaboration
giữa các thể hiện của các class đã xác định
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 3
Architect
Designer
ArchitecturalAnalysis
ArchitectureÔn lạier
Ôn lại theDesign
Ôn lại theArchitecture
Use-CaseAnalysis
ArchitecturalDesign
DescribeConcurrency
DescribeDistribution
ClassDesign
Subsystem Design
Use-CaseDesign
DesignÔn lạier
Use-Case Analysis trong ngữ cảnh
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 4
SupplementarySpecifications
Glossary
Use-Case Model
Use-CaseAnalysis
Use-CaseModeling Guidelines
Use-Case Realization(identified)
Use-Case Realization(developed)
Design Model
Analysis Classes
Analysis Model (optional)
Tổng quan Use-Case Analysis
Software ArchitectureDocument
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 5
Các bước trong Use-Case Analysis
w Bổ sung mô tả Use-Casew Với mỗi use-case realization § Tìm các Class từ Use-Case Behavior § Phân bổ Use-Case Behavior về các Class
w Với mỗi analysis class đã tìm thấy§ Mô tả nhiệm vụ của chúng§ Mô tả các Attribute và các Association§ Lượng giá (qualify) các Analysis Mechanism
w Hợp nhất các Analysis Classw Checkpoints
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 6
Các bước trong Use-Case Analysis
w Bổ sung mô tả Use-Casew Với mỗi use-case realization § Tìm các Class từ Use-Case Behavior § Phân bổ Use-Case Behavior về các Class
w Với mỗi analysis class đã tìm thấy§ Mô tả nhiệm vụ của chúng§ Mô tả các Attribute và các Association§ Lượng giá (qualify) các Analysis Mechanism
w Hợp nhất các Analysis Classw Checkpoints
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 7
• Hệ thống hiển thị một danh sách các lớp học (courseofferings).
• Hệ thống truy vấn vàhiển thị một danh sách các lớp học đang mở từ CSDL course catalog kếthừa từ hệ thống cũ.
Supplement the Use-Case Description
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 8
w Bổ sung mô tả Use-Casew Với mỗi use-case realization § Tìm các Class từ Use-Case Behavior § Phân bổ Use-Case Behavior về các Class
w Với mỗi analysis class đã tìm thấy§ Mô tả nhiệm vụ của chúng§ Mô tả các Attribute và các Association§ Lượng giá (qualify) các Analysis Mechanism
w Hợp nhất các Analysis Classw Checkpoints
Các bước trong Use-Case Analysis
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 9
ProfessornameempIDcreate( )save( )delete( )change( )
Class Name
Attributes
Operations
Ôn lại: Class
w Là một sự trừu tượng hóaw Mô tả một nhóm các đối tượng có chung:§ Properties (attributes)§ Behavior (operations)§ Relationships§ Ngữ nghĩa (Semantics)
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 10
Class Diagrams
Sequence Diagrams
Use Case
Use-Case Model Design Model
Use Case Use-Case Realization
Collaboration Diagrams
Ôn lại: Use-Case Realization
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 11
<<boundary>>
<<boundary>><<control>>
<<entity>>
<<entity>>
Tìm các Class từ Use-Case Behavior
w Toàn bộ hành vi của một use case phải được phân bổ về cho các analysis class
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 12
<<control>>
<<boundary>>
<<entity>>
System boundary
Use-case behavior coordination
System information
Thế nào là một Analysis Class?
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 13
Use Cases AnalysisClasses
SourceCode
ExecDesignElements
Use-Case Analysis
Analysis Classes: A First Step Towards Executables
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 14
Phụ thuộc môi trường
<<boundary>>Analysis class stereotype
Thế nào là một Boundary Class?
w Làm trung gian giao tiếp với những gì nằm ngoài hệ thốngw Một số kiểu§ Các User interface class§ Các System interface class§ Các Device interface class
w Một boundary class cho 1 cặp actor/use case
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 15
Mô hình hóa sự tương tác giữa system và môi trường của nó
Customer
<<boundary>>
<<boundary>>
<<control>><<boundary>>
<<entity>> <<entity>>
Vai trò của Boundary Class
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 16
Course Catalog SystemRegister for CoursesStudent
<<boundary>>RegisterForCoursesForm
<<boundary>>CourseCatalogSystem
Ví dụ: Tìm các Boundary Class
w Một boundary class cho 1 cặp actor/use case
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 17
Tập trung vào các nhiệm vụ, chứ không phải chi tiết!
Guidelines: Boundary Class
w Các User Interface Class§ Tập trung vào những thông tin gì được thể hiện cho người
dùng§ KHÔNG tập trung vào các chi tiết UI
w Các System và Device Interface Class§ Tập trung vào những protocols nào phải định nghĩa§ KHÔNG tập trung vào cách mà các protocol sẽ được cài đặt
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 18
Glossary
Business-Domain Model
Độc lập môi trường
<<entity>>
Analysis class stereotype
Use Case
Architectural Analysis Abstractions
Thế nào là một Entity Class?
w Các trừu tượng hóa then chốt của system
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 19
Lưu trữ và quản trị các thông tin trong system
Customer
<<boundary>>
<<boundary>>
<<control>><<boundary>>
<<entity>> <<entity>>
Vai trò của Entity Class
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 20
Ví dụ: Tìm các Entity Class
w Dùng use-case flow of events như input w Các trừu tượng hóa then chốt của use casew Hướng tiếp cận truyền thống (nouns filtering)§ Gạch dưới các cụm danh từ trong flow of events§ Loại bỏ các ứng viên dư thừa§ Loại bỏ các ứng viên mơ hồ, không rõ ràng§ Loại bỏ các actor (ngoài phạm vi)§ Loại bỏ các kiến trúc cài đặt§ Loại bỏ các attribute (để lại dùng sau)§ Loại bỏ các operation
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 21
Student
CourseOffering
Schedule
Ví dụ: Candidate Entity Class
w Register for Courses (Create Schedule)
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 22
Accountbalancenamenumber
Withdraw()CreateStatement()
Checking
Withdraw()
Savings
GetInterest()Withdraw()
Superclass (parent)
Subclasses
Generalization Relationship
Ôn lại: Generalization
w Một class chia sẻ cấu trúc và/hoặc hành vi của một hay nhiều class
w Mối quan hệ “Là một dạng của”
w Trong phân tích, sử dụng ởmức độ đơn giản, sơ sài
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 23
Finding Generalization: Generalization of Classes
Savings CheckingStock
BondRealEstate Asset
RealEstate
Savings
BankAccount
Checking Stock
Security
Bond
Tổng quát hơn
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 24
Finding Generalization: Specialization of Classes
Asset
Asset
RealEstate
Savings
BankAccount
Checking Stock
Security
BondChuyên biệt hơn
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 25
Studentnameaddress
FulltimeStudent
studentID
gradDate
ParttimeStudent
maxNumCourses
Part-timeStudentnameaddress
numberCourses
Full-timeStudentnameaddressstudentIDgradDate
Không có sựtổng quát hóa
Có sự tổng quát hóa
studentID
Ví dụ: Generalization (Chia sẻ ngữ nghĩa)
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 26
Use Case
Phụ thuộc use-case, độc lập môi trường
<<control>>
Analysis class stereotype
Thế nào là một Control Class?
w Nhà điều phối các hành vi của Use-casew Chỉ một control class cho một use case
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 27
Vai trò của Control Class
Điều phối các hành vi của use-case
Customer
<<boundary>>
<<boundary>>
<<control>><<boundary>>
<<entity>> <<entity>>
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 28
Course Catalog SystemRegister for CoursesStudent
<<control>>RegistrationController
Ví dụ: Tìm các Control Class
w Một control class cho một use case
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 29
Student Course Catalog SystemRegister for Courses
Use-Case Model
Design Model
<<boundary>>RegisterForCoursesForm
<<boundary>>CourseCatalogSystem
<<control>>RegistrationController
<<entity>>Student
<<entity>>Schedule
<<entity>>CourseOffering
Ví dụ: Summary: Analysis Classes
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 30
w Bổ sung mô tả Use-casew Với mỗI use-case realization § Tìm các Class từ Use-Case Behavior § Phân bổ Use-Case Behavior về các Class
w Với mỗi analysis class đã tìm thấy§ Mô tả nhiệm vụ của chúng§ Mô tả các Attribute và các Association§ Lượng giá (qualify) các Analysis Mechanism
w Hợp nhất các Analysis Classw Checkpoints
Các bước trong Use-Case Analysis
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 31
Use Case Use-Case RealizationSequence Diagrams Collaboration Diagrams
Phân bổ Use-case về các Class
w Đối với mỗi use-case flow of events: § Xác định các analysis class § Gắn kết các trách nhiệm của use-case cho các analysis
class§ Mô hình hóa tương tác của các analysis class trong
interaction diagram
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 32
Guidelines: Allocating Responsibilities to Classes
w Dùng các A.Class stereotype làm guide:§ Các Boundary Class
• Các hành vi liên quan đến sự giao tiếp với actor§ Các Entity Class
• Các hành vi liên quan đến dữ liệu được gói trong một abstraction
§ Các Control Class• Các hành vi đặc thù cho một use case hoặc một phần rất
quan trọng của flow of events
(còn tiếp)
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 33
Guidelines: Allocating Responsibilities to Classes (tt)
w Ai có dữ liệu cần cho việc thực hiện nhiệm vụ?§ Một class có dữ liệu, hãy để nhiệm vụ cùng với dữ liệu§ Nhiều class có dữ liệu :
• Hãy để nhiệm vụ trong 1 class và thêm quan hệ với các class khác.
• Tạo một class mới, để nhiệm vụ trong class mới này, vàthêm quan hệ với các class cũ
• Hãy để nhiệm vụ trong control class, và thêm quan hệvới các class cần để thực hiện nhiệm vụ
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 34
1: PerformResponsibility
Client Object Supplier Object
Message
:Client :Supplier
Focus of Control
Đây là một script mẫu
Reflexive MessageObject Lifeline
1.1: PerformAnotherResponsibility
The Anatomy of Sequence Diagrams
Hierarchical MessageNumbering
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 35
Ví dụ: Sequence Diagram
: Student:
RegisterForCoursesForm:
RegistrationController: Schedule : Student
: Course Catalog:
CourseCatalogSystem
A list of the available course offerings for this semester are displayed
Student wishes to create a new schedule
1. // create schedule( )
1.2. // display course offerings( )
1.1. // get course offerings( )
1.1.1. // get course offerings(forSemester)
1.3. // display blank schedule( )
At this, point the Submit Schedule subflow is executed.
2. // select 4 primary and 2 alternate offerings( )
2.1. // create schedule with offerings( )2.1.1. // create with offerings( )
A blank schedule is displayed for the students to select offerings
2.1.2. // add schedule(Schedule)
1.1.1.1. // get course offerings( )
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 36
Ví dụ: Sequence Diagram (cont.)
: CourseOffering: Student
: RegisterForCoursesForm : RegistrationController : Schedule : Student: PrimaryScheduleOfferingInfob
Repeat for all primary course offerings.
An attempt is made to register the student for all selected course offerings
1. // submit schedule( )
1.1. // submit schedule( )
1.1.2. // submit( )
1.1.2.3. // still open?( )
1.1.2.5. // add student(Schedule)
1.1.2.2. // has pre-requisites(CourseOffering)
1.1.2.4. // any conflicts?( )
1.1.2.1. // is selected?( )
1.1.2.6. // mark as enrolled in( )
1.1.1. // save( )
[ has pre-requisites, course offering open, and no schedule conflicts ]
[ is selected ]
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 37
1: PerformResponsibility
Client Object
Supplier Object
Message
Link
:Client
:Supplier
The Anatomy of Collaboration Diagrams
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 38
Ví dụ: Collaboration Diagram
: Student
: RegisterForCoursesForm
: RegistrationController
: Schedule
: Student
: CourseCatalogSystem
1.2. // display course offerings( )1.3. // display blank schedule( )
: Course Catalog
1. // create schedule( )2. // select 4 primary and 2 alternate offerings( )
1.1. // get course offerings( )2.1. // create schedule with offerings( )
2.1.1. // create with offerings( )
1.1.1. // get course offerings(forSemester)
2.1.2. // add schedule(Schedule)
1.1.1.1. // get course offerings( )
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 39
Ví dụ: Collaboration Diagram (cont.)
: CourseOffering
: Student
: RegistrationController
: Schedule
: Student
: PrimaryScheduleOfferingInfob
1.1.2.4. // any conflicts?( )
: RegisterForCoursesForm1. // submit schedule( )
1.1. // submit schedule( )
1.1.2. // submit( )1.1.1. // save( ) 1.1.2.3. // still open?( )
1.1.2.5. // add student(Schedule)
1.1.2.1. // is selected?( )1.1.2.6. // mark as enrolled in( )
1.1.2.2. // has pre-requisites(CourseOffering)
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 40
Alternate Flow 4 Alternate Flow 5 Alternate Flow n
Alternate Flow 1 Alternate Flow 2 Alternate Flow 3
AF1
AF2
AF3
Basic Flow
Một lược đồ tương tác là chưa đủ
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 41
Collaboration Diagrams Vs Sequence Diagrams
w Collaboration Diagrams§ Chỉ ra các mối quan hệ
bổ sung cho các tương tác
§ Trực quan hóa tốt hơn các mẫu cộng tác
§ Trực quan hóa tốt hơn các hiệu ứng tác động lên một đối tượng cụ
§ Dễ sử dụng hơn trong các vấn đề cần giải quyết tập thể
w Sequence Diagrams§ Chỉ ra rõ ràng chuỗi các
thông điệp§ Trực quan hóa tốt hơn
toàn bộ luồng sự kiện§ Tốt hơn cho các đặc tả
real-time và cho các scenario phức tạp
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 42
(còn tiếp)
Exercise: Use-Case Analysis, Part 1
w Hãy xây dựng:§ Use-Case Model, đặc biệt là các use-case flows of events§ Các trừu tượng hóa/class then chốt
w Hãy xác định các thông tin sau cho một use case cụ thể:§ Các analysis class, cùng với chúng là:
• Brief descriptions• Stereotypes• Responsibilities
§ Các collaboration cần thiết để cài đặt use case
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 43
Exercise: Use-Case Analysis, Part 1 (tt)
w Với một use case cụ thể, hãy thiết lập:§ Use-case realization interaction diagram cho tối thiểu một
trong các use-case flows of events
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 44
w Bổ sung mô tả Use-casew Với mỗI use-case realization § Tìm các Class từ Use-Case Behavior § Phân bổ Use-Case Behavior về các Classs
w Với mỗI analysis class đã tìm thấy§ Mô tả nhiệm vụ của chúng§ Mô tả các Attribute và các Association§ Lượng giá (qualify) các Analysis Mechanism
w Hợp nhất các Analysis Classw Checkpoints
Các bước trong Use-Case Analysis
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 45
// PerformResponsibility
:Client :Supplier
Supplier
// PerformResponsibility
Interaction Diagram
Class Diagram
Miêu tả các trách nhiệm
w Trách nhiệm (responsibilities) là gì?w Làm thế nào để tìm ra chúng?
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 46
RegisterForCoursesForm
// submit schedule()// display course offerings()// display schedule()// create schedule()// select 4 primary and 2 alternate offerings()// display blank schedule()
<<boundary>>
PrimaryScheduleOfferingInfograde
// is enrolled in?()// mark as enrolled in()
<<entity>>
CourseCatalogSystem
// get course offerings()
<<boundary>>RegistrationController
// get course offerings()// submit schedule()// create schedule with offerings()
<<control>>
Student
// add schedule()// has pre-requisites()
<<entity>>
ScheduleOfferingInfostatus
// mark as selected()// mark as cancelled()// is selected?()
<<entity>>
CourseOfferingnumber : String = "100"startTime : TimeendTime : Timedays : Enum
// add student()// still open?()// save()
<<entity>>
Schedule
// create with offerings()// submit()// save()
<<entity>>
Ví dụ: View of Participating Classes (VOPC) Class Diagram
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 47
Quản lý sự toàn vẹn: những điều quan tâm
w Xét theo trình tự§ Dư thừa trách nhiệm giữa các lớp§ Các trách nhiệm bị tách rời giữa các lớp§ Lớp chỉ có một trách nhiệm§ Lớp không có trách nhiệm§ Sự phân tán các hành vi§ Lớp có quá nhiều tương tác với các lớp khác
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 48
w Bổ sung mô tả Use-casew Với mỗI use-case realization § Tìm các Class từ Use-Case Behavior § Phân bổ Use-Case Behavior về các Classs
w Với mỗI analysis class đã tìm thấy§ Mô tả nhiệm vụ của chúng§ Mô tả các Attribute và các Association§ Lượng giá (qualify) các Analysis Mechanism
w Hợp nhất các Analysis Classw Checkpoints
Các bước trong Use-Case Analysis
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 49
Miêu tả các thuộc tính và các mối quan hệ
w Định nghĩa các Attributew Thiết lập các mối quan hệ dạng Aggregation và Association
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 50
ClassName<<stereotype>>
Attribute : Type = InitValueAttribute : Type = InitValueAttribute : Type = InitValue
CourseOffering<<entity>>
number :String=“100”startTime : TimeendTime: Timedays: enumattribute
Trong analysis, không nên tốn nhiều thời gian cho việc xác định các attribute signature
Ôn lại: thế nào là thuộc tính ?
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 51
Cách tìm các thuộc tính
w Các thuộc tính/đặc điểm của các classw Các thông tin đc giữ lại bởi các classw Các “danh từ” không biến thành class§ Các thông tin mà giá trị của chúng là quan trọng§ Các thông tin ddc sở hữu bởi 1 object duy nhất§ Các thông tin không có hành vi
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 52
Ôn lại: thế nào là một mối quan hệ
w Mô hình hóa một liên hệ ngữ nghĩa giữa các thể hiện (instances) của các class
Simple association
<<entity>>Student
<<entity>>Schedule
<<entity>>CourseOffering
Reflexive association
is a pre-requisite of
<<entity>>Course
Association là một quan hệ cấu trúc
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 53
Ôn lại: thế nào là các vai trò ?
w Nhân vật” mà một class “đóng vai” trong association
Department head
Pre-requisites
Instructor
<<entity>>CourseOffering
<<entity>>Professor
<<entity>>Department
<<entity>>Course
Role Name
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 54
CourseOffering<<entity>>
Schedule<<entity>>
primaryCourses
alternateCourses
CourseOffering<<entity>>
Schedule<<entity>> add student to
remove student from
Các multiple association phải phản ánh các multiple role
Ví dụ: quan hệ đa kết hợp
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 55
Ôn lại: bản số (Multiplicity)
2..4
0..1
1..*
0..*
1
*
w Không mô tảw Duy nhất mộtw Zero hoặc nhiều (many,
unlimited)
w Một hoặc nhiềuw Zero hoặc 1w Một đoạnw Nhiều đoạn rời nhau 2, 4..6
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 56
Bản số
0..4
0..2primaryCourses
alternateCourses
0..*
0..*0..*1
<<entity>>Student
<<entity>>Schedule <<entity>>
CourseOffering
Ví dụ: Multiplicity
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 57
Hai chiều
Một chiều
Class1 Class2
Class1 Class2
Ôn lại: Navigability
w Khả năng định hướng từ associating class đến target class
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 58
2-way navigation
0..4
0..2
primaryCourses
alternateCourses
0..*
0..*
<<entity>>Schedule
<<entity>>CourseOffering
1-way navigation
1 1<<boundary>>
RegisterForCoursesForm<<control>>
RegistrationController
Ví dụ: Navigability
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 59
Whole/aggregate part
0..4
0..2primaryCourses
alternateCourses
0..*
0..*0..*1<<entity>>
Student<<entity>>Schedule <<entity>>
CourseOffering
Ôn lại: Quan hệ Aggregation?
w Một dạng đặc biệt của association dùng để mô hình hóa một mối quan hệ toàn thể-bộ phận giữa toàn thể và các phần của nó
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 60
Khi cảm thấy nghi ngờ hãy dùng association
association
aggregation
Class1 Class2
Class1 Class2
Association hay Aggregation?
w Xem xét§ Ngữ cảnh, các đặc trưng độc lập của Class2
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 61
Lớp kết hợp (Association Class)
w Một class “được gắn” vào một associationw Chứa các thuộc tính của relationshipw Một thể hiện / 1 link
ScheduleOfferingInfostatus
// mark as selected()// mark as cancelled()// is selected?()
<<entity>>
CourseOffering<<entity>>
Schedule<<entity>>
0..*0..4
primaryCourses
alternateCourses0..* 0..2
PrimaryScheduleOfferingInfobgrade
// is enrolled in?()// mark as enrolled in()// mark as committed()
<<entity>>
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 62
1: PerformResponsibility
Link
Association
CollaborationDiagram
ClassDiagram 0..*
Prime suppliers0..*
Client Supplier
:Client :Supplier
Client Supplier
PerformResponsibility()
Tạo Relationship cho mọi link!
Xác định các mối quan hệ
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 63
1 0..*
1
1
Schedule
// create with offerings()
<<entity>>
1
0..1
RegisterForCoursesForm
// create schedule ()// display course offerings ()// display blank schedule// select 4 primary and 2 alternate offerings()
<<boundary>>
RegistrationController
// get course offerings()// create schedule with offerings
<<control>>
// get course offerings(forSemester)
CourseCatalogSystem<<boundary>>
Student
// add schedule (Schedule)
<<entity>>
currentScheduleregistrant
0..1
0..1
Ví dụ: VOPC: Xác định các quan hệ
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 64
ScheduleOfferingInfostatus
// mark as selected()// mark as cancelled()// is selected?()
<<entity>>
PrimaryScheduleOfferingInfobgrade
// is enrolled in?()// mark as enrolled in()
<<entity>>
CourseOfferingnumber : String = "100"startTime : TimeendTime : Timedays : Enum
// add student()// cancel()// still open?()// save()
<<entity>>
Schedule
// cancel(theOffering : CourseOffering)// submit()// any conflicts?()// create with offerings()
<<entity>>
0..* 0..4
primaryCourses
alternateCourses0..* 0..2
Ví dụ: VOPC: Xác định các quan hệ (tt)
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 65
w Bổ sung mô tả Use-casew Với mỗi use-case realization § Tìm các Class từ Use-Case Behavior § Phân bổ Use-Case Behavior về các Classs
w Với mỗi analysis class đã tìm thấy§ Mô tả nhiệm vụ của chúng§ Mô tả các Attribute và các Association§ Lượng giá (qualify) các Analysis Mechanism
w Hợp nhất các Analysis Classw Checkpoints
Các bước trong Use-Case Analysis
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 66
Analysis Class Analysis Mechanism(s)
Mô tả các cơ chế phân tích
w Tập hợp tất cả analysis mechanisms trong 1 danh sáchw Vẽ một ánh xạ các client classes đến các analysis mechanism
w Xác định các đặc trưng của Analysis Mechanisms
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 67
Analysis Class Analysis Mechanism(s)
StudentScheduleCourseOfferingCourseRegistrationController
Persistency, Security
Persistency, Legacy InterfacePersistency, Legacy InterfaceDistribution
Persistency, Security
Ví dụ: Miêu tả các cơ chế phân tích
w Ánh xạ giữa Analysis class và analysis mechanism
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 68
Ví dụ: Miêu tả các cơ chế phân tích (cont.)
w Các đặc trưng của Analysis mechanismw Persistency của Schedule class:§ Granularity: 1 đến 10 Kbytes / sản phẩm§ Volume: tối đa 2,000 schedule§ Access frequency
• Create: 500 lần / ngày• Read: 2,000 lần / giờ• Update: 1,000 lần / ngày• Delete: 50 lần / ngày
§ ….
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 69
w Bổ sung mô tả Use-casew Với mỗi use-case realization § Tìm các Class từ Use-Case Behavior § Phân bổ Use-Case Behavior về các Classs
w Với mỗi analysis class đã tìm thấy§ Mô tả nhiệm vụ của chúng§ Mô tả các Attribute và các Association§ Lượng giá (qualify) các Analysis Mechanism
w Hợp nhất các Analysis Classw Checkpoints
Các bước trong Use-Case Analysis
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 70
<<control>>
<<boundary>>
<<entity>><<entity>>
Hợp nhất các lớp phân tích
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 71
SupplementarySpecification
Glossary
Use-Case Model
Design Model
Analysis Classes
Đánh giá các kết quả
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 72
Các bước trong Use-Case Analysis
w Bổ sung mô tả Use-casew Với mỗi use-case realization § Tìm các Class từ Use-Case Behavior § Phân bổ Use-Case Behavior về các Classs
w Với mỗi analysis class đã tìm thấy§ Mô tả nhiệm vụ của chúng§ Mô tả các Attribute và các Association§ Lượng giá (qualify) các Analysis Mechanism
w Hợp nhất các Analysis Classw Checkpoints
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 73
(còn tiếp)
Checkpoints: Analysis Classes
w Các class có hợp lý không?w Tên của các class có phản ánh đúng vai trò của chúng?w Class có biểu diễn 1 single well-defined abstraction? w Tất cả các attribute và responsibility có gắn kết với nhau về mặt
chức năng không?w Class có cung cấp các hành vi được y/c?w Tất cả các yêu cầu cụ thể đã được thể hiện trên class chưa?
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 74
Checkpoints: Use-Case Realizations
w Tất cả các luồng chính và luồng con đã được điều khiển chưa, bao gồm cả các trường hợp ngoài lệ?
w Đã tìm thấy tất cả các đối tượng cần thiết?w Đã phân phối một cách rõ ràng tất cả các hành vi về các đối
tượng chưa? w Các hành vi có được phân phối về đúng đối tượng không?w Các interaction diagrams nằm ở đâu, mối quan hê gwiax chúng
có rõ ràng và phù hợp không?
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 75
Ôn lại: Use-Case Analysis
w Mục tiêu của Use-Case Analysis là gì?w Một analysis class là gì? Cho biết tên và mô tả về 3 analysis
stereotype.w Use-case realization là gì?w Mô tả một vài hoạt động khảo sát when đặt các trách nhiệm cho
các analysis class.w Bao nhiêu interaction diagram phải được xây dựng trong giai đoạn Use-Case Analysis?
Phân tích Use-CaseKhoa CNTT - ĐHKHTN 76
Bài tập: Use-Case Analysis, Part 2
w Hãy cho biết các khái niệm sau:§ Các Requirements artifact, đặc biệt là đặc tả bổ sung§ Các cơ chế phân tích có thể§ Các flow of events interaction diagram cho một use case cụ
thểw Với mỗi use case hãy xác định các dữ kiện sau:§ Các thuộc tính và các mối quan hệ của Analysis class § Các cơ chế phân tích Analysis class
w Xây dựng các lược đồ sau:§ VOPC class diagram, chứa các analysis class, stereotype
của chúng, nhiệm vụ, các attribute, và relationship. § Ánh xạ Analysis class với các cơ chế phân tích