Professional Documents
Culture Documents
Tailieuxanh Uml Phan Tich Va Thiet Ke Huong Doi Tuong 0506
Tailieuxanh Uml Phan Tich Va Thiet Ke Huong Doi Tuong 0506
đối tượng
(Object Oriented System
Analysis and Design)
Giới thiệu
• 4 ĐVHT = 60 tiết
• Học trên lớp + Bài tập lớn
• Điểm = Điểm thi + Điểm bài tập lớn
(70%) + (30%)
• Điều kiện thi: Phải có bài tập lớn
• Bài tập lớn:
Làm theo nhóm tối đa 5 sinh viên
Nội dung: phân tích và thiết kế hệ thống sử dụng Rational
Rose
Đề tài: sinh viên tự chọn đề tài
• Mục đích của môn học
Trang bị cho sinh viên một phương pháp có hệ thống để phân
tích và thiết kế hệ thống
© DHBK 2007 3/Chapter
Nội dung
1. Giới thiệu chung về phân tích và thiết kế hệ thống
2. Giới thiệu về phân tích và thiết kế hướng đối
tượng với UML
3. Lập kế hoạch
4. Phân tích hệ thống
5. Thiết kế hệ thống
6. Triển khai hệ thống
© DHBK 2007 4/Chapter
Process Product
Design System
Specification
1.3.2 RAD
• Các nhân tố quan trọng:
Công cụ CASE
JAD
Ngôn ngữ lập trình thế hệ thứ tư/ visual
Công cụ tạo mã
© DHBK 2007 19/Chapter
1.3.2 RAD
Phương pháp phát triển theo pha
© DHBK 2007 1.3.2 RAD 20/Chapter
1.3.2 RAD
Phương pháp xây dựng nguyên mẫu loại bỏ
© DHBK 2007 22/Chapter
UML 2.0
UML
UML 1.4.1
1.4.1
2002
2001
UML
UML 1.4
1.4 (action
(action semantics)
semantics)
1998
UML
UML 1.3
1.3 (extensibility)
(extensibility)
1997
Foundations
Foundations ofof OO
OO (Nygaard,
(Nygaard, Goldberg,
Goldberg, Meyer,
Meyer,
Stroustrup,
Stroustrup, Harel,
Harel, Wirfs-Brock,
Wirfs-Brock, Reenskaug,…)
Reenskaug,…)
1967
© DHBK 2007 28/Chapter
1 class Time {
2 public:
3 Time();
5 void printMilitary();
6 void printStandard();
7 private:
8 int hour; // 0 - 23
9 int minute; // 0 - 59
10 int second; // 0 - 59
11 };
© DHBK 2007 34/Chapter
2.2.4 Thừa kế
• Superclasses or general classes are at the top of a
hierarchy of classes
• Subclasses or specific classes are at the bottom
• Subclasses inherit attributes and methods from
classes higher in the hierarchy
© DHBK 2007 38/Chapter
2.2.4 Thừa kế
© DHBK 2007 39/Chapter
2.2.4 Thừa kế
© DHBK 2007 40/Chapter
2.4.4 MOOSAD
© DHBK 2007 89/Chapter
Tài liệu
Nhu cầu kinh doanh Hội đồng duyệt dự án
yêu cầu hệ thống
Project sponsor
Yes No
quyết định dựa trên việc so sánh với các dự án trước đó hoặc
tham khảo ý kiến của chuyên gia công nghệ
© DHBK 2007 100/Chapter
3.2 Quản lý dự án
3.2.1 Giới thiệu
3.2.2 Xác định kích thước dự án
3.2.3 Xây dựng và quản lý kế hoạch công việc
3.2.4 Sắp xếp nhân lực cho dự án
3.2.5 Điều phối hoạt động dự án
3.2.6 CD selections
© DHBK 2007 112/Chapter
Industry
Standard
For Web 15% 20% 35% 30%
Applications
Time
Required 4 5.33 9.33 8
in Person
Months
© DHBK 2007 115/Chapter
Adjusted Processing
Complexity (PCA) = 0.65 + (0.01 * __7_ )
Ví dụ: lập trình dùng C: số dòng lệnh = 243x 130 = 31 590 dòng
© DHBK 2007 123/Chapter
Example:
Phases with
Phases high level steps
*
*
*
*
© DHBK 2007 129/Chapter
X: Hoàn thành
\: đang thực hiện
© DHBK 2007 134/Chapter
• Standardisation: Examples
Formal rules for naming files
Forms indicating goals reached
Programming guidelines and Coding standard
• Documentation
Project binder: all deliverables and all the internal
communications within a project
Table of contents
Continual updating
© DHBK 2007 145/Chapter
3.2.6 CD selections
© DHBK 2007 148/Chapter
Thiết kế hệ thống
Mô hình hoạt động
INTERVIEW REPORT
Summary of Interview:
Open Items:
Detailed Notes:
© DHBK 2007 174/Chapter
4.1.4 CD selections
Requirement Determination
• Requirement Analysis Techniques
Select BPI techniques to identify how to improve the
current order process using a new web-based system
Using several JAD session including store managers,
marketing analysts and Wed developers (the working
group) to work through BPI techniques and brainstorm
Further apply informal benchmarking with Web-sites of
several leading retailers and discuss with the working
group
The output is a list of suggested business requirements
for the project team
© DHBK 2007 186/Chapter
4.1.4 CD selections
Requirement Determination
• Requirement-gathering Techniques
The project team applies document analysis, interview and
observation techniques
Firstly apply document analysis to understand the current order
processes (i.e., the as-is system). If anything is not clear, use
interview to clarify
Secondly interview senior analysts to get better ideas about as-is
and to-be systems and IT contractor to understand the existing IT
system
Thirdly observe in stores to see the real working process of as-is
system
• The above activities at the end produces the requirement
definition (report)
• Further JAD sessions are used to finalise and prioritise the
requirement definition (report)
© DHBK 2007 187/Chapter
Analysis:
Main activities: Maintain CD Information, Maintain CD
marketing information, Place CD Orders, Maintain
ordered CDs
Control flows: Three main parallel processes:
Maintain CD Information
Maintain CD marketing information
Place CD Orders -> Maintain ordered CDs in which a decision
needs to be made related to placing instore hold or placing
special order
© DHBK 2007 198/Chapter
Maintain CD
Place CD Maintain CD
marketing
Order Information
information
[If available in near store] [If not]
Place Place
instore hold special order
© DHBK 2007 199/Chapter
4.2.3 Mô tả ca sử dụng
• Một ca sử dụng miêu tả các hoạt động do người
sử dụng hoặc các hệ thống khác tác động lên hệ
thống.
• Ca sử dụng là mô hình logic vì chúng miêu tả các
hoạt động của hệ thống mà không miêu tả các
hoạt động đó được thực hiện thế nào.
• Ca sử dụng miêu tả chức năng của hệ thống:
Người sử dụng có thể làm gì
Hệ thống đáp ứng như thế nào
4.2.3 Mô tả ca sử dụng
• 2 bước để xây dựng biểu đồ ca sử dụng
Viết bản mô tả ca sử dụng
Chuyển từ bản mô tả ca sử dụng sang biểu đồ ca sử
dụng
• Mỗi một ca sử dụng chỉ miêu tả duy nhất một
chức năng của hệ thống
• Để xác định nội dung của ca sử dụng, người phát
triển hệ thống phải làm việc cùng với người sử
dụng
© DHBK 2007 201/Chapter
4.2.3 Mô tả ca sử dụng
• Các thành phần của bản mô tả ca sử dụng:
Use Case Name: ID: Importance Level:
Brief Description:
Trigger:
Relationships: (Association, Include, Extend, Generalization)
Subflows:
Alternate/Exceptional Flows:
© DHBK 2007 202/Chapter
4.2.3 Mô tả ca sử dụng
• Ví dụ:
© DHBK 2007 203/Chapter
4.2.3 Mô tả ca sử dụng
• Ví dụ:
© DHBK 2007 204/Chapter
4.2.3 Mô tả ca sử dụng
• Ví dụ:
© DHBK 2007 205/Chapter
4.2.3 Mô tả ca sử dụng
• Guidelines for Creating Use-Case Descriptions
1. Write each step in “SVDPI (subject-verb-direct
object and optionally preposition-indirect object)”
form
Example. “The patient (subject) contacts (verb)
the office (direct object) regarding (preposition)
an appointment (indirect object).
2. Clarify initiator and receivers of action
3. Write from independent observer perspective
4. Write at same level of abstraction
5. Ensure a sensible set of steps
6. Apply KISS (keep it simple, stupid) principle liberally
7. Write repeating instructions after the set of steps to
be repeated.
© DHBK 2007 206/Chapter
A Subject
Boundary
An Actor
An associate
relationship
A use case
© DHBK 2007 207/Chapter
Maintain CD
Place CD Maintain CD
marketing
Order Information
information
Maintain
CD Order
© DHBK 2007 214/Chapter
Maintain CD
marketing information
Place CD
<<include>>
<<actor>> order
Credit
Card Check out
Centre
<<include>>
<<actor>>
Distribution Maintain CD
System information
© DHBK 2007 224/Chapter
-attribute
+operation ()
AN OPERATION
operation name ()
AN ASSOCIATION
1..* 0..1
______verb phrase____
© DHBK 2007 233/Chapter
CD Selections
© DHBK 2007 240/Chapter
• Solution:
Credit Card Centre
Order
Customer 0..*
1
-First name
0..* place ->
-Middle initial
Check -> 0..* -Last name
-……
+Make search req()
+Place order()
+Get credit info() Search Reg
+Exit()
0..* 0..*
Make ->
© DHBK 2007 248/Chapter
Example:
Normal Flow of Events:
Example:
© DHBK 2007 259/Chapter
Actor
Object
Association
Message
© DHBK 2007 262/Chapter
C
C
Application
© DHBK 2007 265/Chapter
Example:
Normal Flow of Events:
Example:
© DHBK 2007 267/Chapter
Event [guard]/activity
state
transition
© DHBK 2007 271/Chapter
Example:
The Life of an Order Object:
Application
© DHBK 2007 273/Chapter
Example:
© DHBK 2007 274/Chapter
A PACKAGE Package
A DEPENDENCY RELATIONSHIP
© DHBK 2007 283/Chapter
Patient UI
Problem domain
Classes:
dependent on
Patient, Appt.
Patient class
Separated from
object persistence dependent on
Classes: Patient class
Patient table,
Appt. table
Modularity (information hiding and encapsulation again) simplifies maintenance (changes are
encapsulated within “module boundary”) and increases reusability (module’s interface defines
messages that can be responded to, module can be used/reused “as is” or adapted for other uses
© DHBK 2007 286/Chapter
Step 1: Set the context, i.e. model a partition or a layer, e.g. for
appointments system we might choose
context = problem domain (PD) layer
288/Chapter
© DHBK 2007
Step 2: Cluster classes together based on shared relationships, i.e. form partition
using relationships (generalisation, aggregation, kinds of association
and message passing between objects) shared by classes
Communication Diagram(s)
Classes in a generalisation
hierarchy put in a single
partition
© DHBK 2007 289/Chapter
Step 4: Identify dependency relationships between packages, i.e. relationships that cross
boundaries of packages = potential dependencies
Step 5: Place dependency relationships between packages, i.e. between Person Package and
Appt. Package, Person Package and Treatment Package
Show dependency relations as “pure” package diagram showing ONLY dependency relations
that CAN be created
between packages
PD Layer
Person Package Appt. Package
Patient Package
Treatment Package
© DHBK 2007 292/Chapter
Worked Example: Applying Concepts at CD Selections: First, previous
lectures...
Communication Diagram
(Place Order Use Case)
© DHBK 2007 294/Chapter
• Keep classes in a generalisation hierarchy together =
cluster Customer, Individual and Organisation(al) classes into partition
• Aggregation relationships = cluster Mkt Info, Review, Artist Info, Sample Clip
classes into partition
© DHBK 2007 295/Chapter
• Association relationship (between CD class and Mkt Info class) and message
sending pattern of activity = place in same partition
• Recall,
cluster Mkt
Info, Review,
Artist Info,
Sample Clip
classes into
partition
Time frame
If time to meet business requirement(s) is limited (or short),
requirements are “standard” and well-defined, then packaged or
outsourced most likely strategies, outsourced for standard,
packaged for well-defined
© DHBK 2007 305/Chapter
• Additional specification
• Identifying opportunities for reuse
• Restructuring the design
• Optimizing the design
• Map Problem Domain Classes to Implementation
Languages
© DHBK 2007 321/Chapter
• Additional specification:
Ensure the classes are both necessary and sufficient for
the problem
Finalize the visibility of the attributes and methods of
each class
Determine the signature of every method of each class
Define constraints to be preserved by objects
© DHBK 2007 322/Chapter
concrete
abstract
Potential
Class1 Class2 Inheritance
-attribute3 -attribute3 Conflicts
-attribute4 -attribute4
-attribute5 -attribute5
-attribute6 -attribute6
© DHBK 2007 334/Chapter
Class1 Class2
-attribute1 -attribute1 Potential
-attribute2 -attribute2 Inheritance
-attribute3 -attribute3 Conflicts
-attribute4 -attribute4
-attribute5 - attribute5
-attribute6 -attribute6
-attribute7 -attribute7
-attribute8 -attribute8
© DHBK 2007 336/Chapter
Back:
Attributes:
Order Number (1:1) (unsigned long)
Date (1..1) (Date)
Sub Total (0..1) (double)
Tax (0..1) (double) {Sub Total = sum(Product Order.GetExtension())}
Shipping (0..1) (double)
Total (0..1) (double)
Customer (1..1) (Customer)
Cust ID (1..1) (unsigned long) (Cust ID = Customer.GetCustID()}
State (1..1) (State)
StateName (String) {State Name = State.GetState()}
Attribute Constraint:
Cust ID IS unsigned
Long
Relationships: Constraint: Instance of Order EXISTS AND
Generalisation(a-kind-of): IF (instance of Customer class AND
Invariant
instance of State class AND
MUST HAVE one and
Aggregation (has-parts): >=1 instance of Product class)
ONLY one value
ASSOCIATED WITH order object
(1..1) =
Other Associations: Product{1..*} Customer(1..1} State{1..1} Customer. GetCustID()
© DHBK 2007 340/Chapter
Product Order
Invariants On a Order
Class Diagram(Not recommended Product
– Use CRC card for Invariants) Quantity
<<invariant>> Extension
{Sub Total=
Sum(Product Order.GetExtension())}}
<<invariant>>
{State Name=State.GetState()}
© DHBK 2007 341/Chapter
Does NOT contain details of how method works i.e. not procedural
© DHBK 2007 342/Chapter
Unique Contract ID
Specific Method OF specific Class
= method signature
© DHBK 2007 343/Chapter
Algorithm Specification:
Action Statement Examples: Profits = Revenues – Expenses
Generate Inventory-Report
IF Statement Examples: IF Customer NOT in Customer Object Store
THEN
Add Customer record to Customer Object Store
ELSE
Add Current-Sale to Customer’s Total Sales
Update Customer record in Customer Object Store
• (Get_CD_Info Module)
Accept(CD.Title) {Required}
Accept(CD.Artist) {Required}
Accept(CD.Category) {Required}
Accept(CD.Length)
• Return