Page 1
1
UMLrequirement Activity diagram- overview
Use case diagram structure analysis
Class diagramBehavior analysis
5.1 sequence diagram5.2 communication diagram5.3 statechart diagram5.4 activity diagram
Implement5.5 component diagram5.6 deployment diagram
Acitity diagram-business flow
Acitity diagram-complex use case
Acitity diagram-method
Page 2
2
5.4 activity diagramActivity diagrams show behavior with control structure.
Activity diagram can be used to show behaviors over many use case, model business workflows, or describe complicated method.
activity diagram มจีดุเร ิม่ตน้จดุสิน้สดุ
กจิกรรมของระบบงานactivity1
activity2
จุดเร่ิมต้น
จุดส้ินสุด
สญัลกัษณ
Page 3
3
เชน activity diagram แสดงเกีย่วกบัการเขียน&สงจดหมาย
Write letter
Address letter Activity state
Start state
Stop state
post letter
transition
สีฟ้าเป็นคาํอธิบาย
Page 4
4
ใน activity diagram มลีกัษณะ
-Swimlanes
-Decision
-Forks and joins
-Object flow
-signal
Page 5
5
Swimlanes : Partition
เปนการแบงกลุม activity เปนเลน เหมอืนสระวายน้าํ
แบงเปนชองในแนวดิ่ง และกาํหนดแตละชองดวยชือ่ object ไวดานบน
การแบงเปน Swimlanes ชวยใหแยกแยะผูรบัผดิชอบ แตละงานไดวา ใครควรจะเปนคนทาํงานในหมวดหมูใด
ตวัอยางเชน
Page 6
6
Swimlanes : Partition เพิ่ม
Page 7
7
Customer Sales Stockroom
pay
deliver order
collect order
request service
take order fill order
Page 8
8
Decisionมีทางเลอืกใหตัดสนิใจ
สญัลกัษณเชน
wakeUp
Eat Breakfast Go to Work
[hungry] [not hungry]
Real world
Page 9
9
get mail
open mail bin mail
else [is junk]
ตวัอยาง
Page 10
10
calculate total cost
get authorization
charge customer’s account
[cost < $50]
[cost >= $50]
ตวัอยาง
Page 11
11
get campaign bonus level
average bonus level
get next campaign
[campaign found][no more campaign]
ตวัอยาง
next
Page 12
12
Activity diagram for calculateBonus() operation ตย Simon p220
Find oldest campaign worked on
[no campaign]
Get campaign bonus level
Get next campaign
Average campaign bonus level
Set bonus to grad minimum
[campaign found]
[no more campaign]
[campaign found]
Page 13
13
Forks and joinsงานหลายงานที่มกีารทาํงานไปพรอมๆ กนัสญัลกัษณ ใชเสนตรงแนวนอนเสนหนาตวัอยาง
Work out
relaxshopping
fork
join
Page 14
14
ตวัอยาง activity diagram making a cup of tea
Find tea bag
[milk required]
Fill cupFill kettle with water
Place tea bag in cup
Boil water in kettle
Add water to cup
Add milk
[no milk required]real world
Page 15
15
Activity diagram for the manage course information use case
Page 16
16
ตวัอยาง
Design new product
Make product
Manufacture product
Sell product
Deliver product
Page 17
17Source: Fowler & Scott,UML Distilled
Receive Order
Assign Goods to item
Authorize Payment
Reorder Goods
Dispatch order
Cancel Order
*[for each line item]
[need to reorder]
[stock assigned to all items and payment authorized]
[failed][suceeded]
Page 18
18
ตวัอยาง activity diagram for a company assembly companymarketing manufacturing delivery
market product
sell product
deliver product
design new product
manufacture product
:Overall System
Page 19
19
ตัวอยาง activity diagram for กระบวนการสัง่ซือ้สินคา :Overall System
Customer Sales Warehouse
Continue work
Request product
Process order
o : Order [in progress]Pull materials
Ship order
o : Order [filled]
Received product
Receive order
close order
b : Bill [unpaid]
Bill Customer
b : Bill [paid]
Object flow -:input/output สามารถ modify สถานะของobject Object in state
Page 20
20
Object flowใน activity diagram -: input/output สามารถ modify สถานะของobject ตวัอยาง activity diagram ทีม่ลีกัษณะ object flow
Page 21
21
ตวัอยาง marketing
manufacturing delivery
Market product
Sell product
Deliver product
Design new product
Manufacture product
:ProductSpec
:Order[delivered]
:Order [paid]
object
Object flow
Object in state
มี 2 object คือ :productSpec ซึง่เปน output จาก design new product subactivity state และเปน input เขาสู manufacture product subactivity state :order ซึง่ capture payment deliver detail เพื่อ audit for selling process
Page 22
22
Signalแสดงการสงสญัญาณเพือ่แสดง information communicate asynchronous ระหวาง 2 objectsignal event จะเกดิเมือ่ object ไดรบั signal
Event ที่เกดิ อาจเปนไปไดวาไดรับจาก object เปน trigger state transition
สัญลักษณEvent ทีเ่ปน input
Event ที่เปน output
Signal Receipt notation also called the Accept event action in a UML Activity Diagram is an action that waits for a specific event to occur.
Signal Sending in UML Activity Diagram is an action that creates a signal instance from its inputs, and transmits it to the target object,
Create order fill order request Create invoice
Cancel request
Cancel order
Page 23
23
ตวัอยาง activity diagram แสดงการสงสญัญาณ เมือ่กด remote control เพื่อเปลีย่นชอง
Press channel number
Change channel
watch
watch
Change channel
Television
Signal : event input
Signal : event output
Page 24
24
sendSignal : create a signal instance from its inputs, and transmits it to the target object
An AcceptEventAction is an action that waits for the occurrence of an event meeting specified conditions.
Page 25
25
events like user input or a model event that leads to an UI update
Page 26
26
Activity diagram : mailOrderCompany
ตวัอยา่ง UML red p. 241
Select products from catalog
order
Goods delivered
Fill in order form
Mail order
:mailOrderCompany
Select products from catalog
Check Goods
External flow of control
Receive a signal
Send a signal called order Object flow
Page 28
28
Activity diagram Person: Prepare beverage Real world
Find beverage
Put coffee in filter
Add water to reservoir Get cups
Put filter in machine
Turn on machine
Brew coffee
Pour coffee
Get cups
drink
[no coffee] [no cola]
[found cola][found coffee]
/coffeePot.turnOn
Light goes out
Page 29
29
Receive order
Authorize Payment
Check line item
Activity diagram : Order
Assign to orders
Reorder item
Dispatch Order
*For each line item on order
[in stock][succeeded]
[need to reorder]
[stock assigned to all line items and payment authorized]
Cancel Order
[failed]
taseap p 41
Page 30
30Simon p223
Activity diagram : running a campaignCampaign Manager Campaign team
pay
Request campaign
Accept payment
Campaign [Commissioned]
client
Authorize Campaign [Active]
Run CampaignCampaign
[Complete]
Campaign [Paid]
Page 31
31
Activity diagram :Order processing Fulfillment
Pay
Order product
customer
Validate order
Larman p608
:Order [placed]
Correct Payment
:Order [prepaid]
Get Product
Deliver rush
Deliverregular
:Order [fulfilled]Give visa to
shippers
Add customer to satisfied list Send receipt
[rush]
Page 32
32
Establish E-mail connection
Send e-mail Receive response
Activity diagram : email
[private content]
taseap p 41
Encrypted e-mail
Regular e-mail
Communication established
[valid reply] [no reply] or [error]
Page 34
34
create newstaffGrade
link to creativeStaff
link to previousStaffGrade
set prevoiusSatffGrade
gradeFinishDate
activity diagram showing the main step for operation CreativeStaff.changeGrade()
เล่มsimon p.262-265
Page 35
35
check approval forgrade change
print approvalrequest
link to creativeStaff
set prevoiusStaffGrade
gradeFinishDate
create newStaffGrade
[not approval byDirector]
[approval byDirector]
more complex activity diagram for CreativeStaff.changeGrade()
Page 36
36
calculate bonus
create warning letter add to 'star' list
formal list
add to list
[bonus > 250][bonus < 25]
[bonus >= 25 and bonus
<=250]
[more staffMembers]
[no more staffMembers]
activity diagram for prepareBonusList()
Page 37
37
find oldestcampaign worked
on
average campaignbonus
set bonus to grademinimum
get next campaign
get campaign bonuslevel
[campaign found]
[no more campaigns][campaign found]
[no campaign]
activity diagram for creativeSatff.calculateBonus()
Page 38
38
Activity diagram for the use case checkCampaignBudget
get client
calculate overheads
get advert cost
show campaign
[incorrect campaign][correct campaign]
[more adverts][no more adverts]
Page 39
39
{{ while more adversts:
next advert;cumcost = cumcost + advertcost;
endwhile;}{ campaigncost = cumcost x ohrate;
get campaignbudget;case campaigncost >= campaignbudget:
return warningflag;endcase
}}
pseudo code for check campaign budget
get client
calculate overheads
get advert cost
show campaign
[incorrect campaign]
[correct campaign]
[more adverts][no more adverts]
Page 40
อยา่ลืมวา่
• Activity diagram สามารถ นาํมาใชอ้ธิบาย
– overall business flow– Use case ท่ีซบัซอ้น
– Method
เม่ือเห็น Activity diagram ตอ้งตอบตวัเองวา่ Activity diagramน้ีกาํลงัอธิบายอะไร
และเม่ือเราตอ้งเขียน diagram เราตอ้งระบุใหช้ดัเจนวา่
Activity diagram for…….
40
Page 41
41
แบบฝึกหดั
จงเขียน actitity diagram :methodและ pseudo code for calculateGPA()
ID CourseNo Unit Grade5305100007 204219 3 A5305100007 204315 3 B 5305100007 204362 3 B5405100009 …..
Page 42
42
UML for objected-analysis and designUse case diagram-requirementClass diagram-structure analysis
Behavior analysis5.1 sequence diagram5.2 collaboration diagram 5.3 statechart diagram แสดงสถานะของ object 5.4 activity diagram :business flow, use case, method
Implement ***now5.5 component diagram5.6 deployment diagram
Page 43
43
Implementation diagram
show aspect of physical implementation , including the structure of component and the run-time deployment system
เปน diagram ทีใ่ชในกระบวนการ implement งาน ม ี2 diagram
-Component diagram
-Deployment diagram
Page 44
44
5.5 Component diagramเปน diagram ที่แสดงใหเหน็ถึง สวนประกอบทาง software (Software component) และความสมัพนัธระหวาง component และยงัแสดงถงึลกัษณะ dependence ระหวาง software component โดย Component อาจประกอบไปดว้ย Source Code และ Runtime หรอื Executable Component
ประโยชนทีส่าํคญัของ component diagram คือสามารถแบง system ขนาดใหญ เปน subsystem การแบงเปน subsystem ทาํใหการพัฒนาระบบมปีระสทิธภิาพ สนบัสนนุการแบงงานกนัทาํเปนทีม แยกความรบัผดิชอบได สนบัสนนุหลกัการ reuse
Component diagram - Show the structure of software in term of software components and their relationship to executable component - need not be used at this low level , but can be used to show dependencies between large-scale component .
Page 45
45
สญัลักษณ
component
ความสมัพนัธในลกัษณะ Dependency โดยจะแสดงในรปูของเสนปะทีม่หีวัลกูศร ดานหวัลกูศร --Component ลกู ดานปลาย --Component หลกั
Executation programเช่น Program1.exe
1 component เกดิจากการ implement class >= 1
หลกั
tools::Calculator.java
Component นีอ้ยูใ่น package tools
Page 46
46
การแบงยอยsystem
subsystem
component
Page 47
47
GardeningSystemPlanner
GardeningSystemController
GardeningSystemPlanDatabase
GardeningSystemDevices
ตวัอยาง hydroponics gardening system ม ี4 subsystem
Page 48
48
GardeningControl
EnvironmentControllers
PlanningConstants
NutrientControllers
GreenhouseSensors GreenhouseActuators
Hydroponics gardening system
component diagram : Gardening System Controller
Page 49
49
ตวัอยาง Servlet 2.2 API
Billboard service Reporting tool JDBC API
Show 4 component mean that the Reporting tool is dependent on those three component
Page 50
50
ตวัอยาง Scheduler
Planer
GUI
GUI update PlanerPlaner reservation Scheduler
Page 51
51
ตวัอยาง
ShoppingSesion
ShoppingCart
Catalog
Page 52
52
Dependency ระหวาง Component
Partner
Inventory management
Treasure
Page 53
53
ตวัอยาง
<<page>> home.html
<<file>> anlmlogo.java
<<file>> anlmator.java
<<document>> anlmlogo.java
<< document >> anlmator.java
Page 54
54
Page or file เชน่page1.htmlApplet.java
Component ทีเ่ป็นฝ่ายใหบ้รกิาร
Component ทีเ่ป็นฝ่ายขอใชบ้รกิาร
แสดงการใชอ้นิเตอรเ์ฟส
Three types of icon that can represent software component
Generic icon
Represent source file Represent file that contains executable (or object) code
เพิ่มเติม
Page 55
55
Billing.exe
Course.dll People.dll
Registar.exe
Billing system
Course user
Course registration system
dll dynamic link library เป็นprog.เลก็ๆ ทํางานเฉพาะอย่างถูก loadเข้ามาเมื่อต้องใช้งาน
Page 56
56
ตวัอยาง
อา้งอิงจาก http://www.math.unipd.it/~cignoni/uml/diagram.htm
สีฟ้าเป็นคาํอธิบาย
Page 57
57
Calculator.html
Calculator.jar
CalcApplet.class CalcGUI.class CalcModule.class
ตวัอยาง
Page 59
59
<<JavaClassFile>> BookReviewApplication
“JavaApplication” BookReviewApplication
<<JavaClassFile>> BookReviewPanel
BookReviewPanel
<<JavaClassFile>> BookReviewData
<<JavaClassFile>> BookReviewMySQLDAO
BookReviewMySQLDAO
<<JavaClassFile>> BookReviewVO
BookReviewVO
Page 60
60
<<JAR>> BookReviewApplicationCilentJAR
<<JAR>> BookReviewMySQLDAOJAR
<<JavaClassFile>>BookReviewMySQLDAO
<<JavaClassFile>> BookReviewApplication <<JavaClassFile>>
BookReviewPanel
<<JAR>> BookReviewBusinessJAR
<<JavaClassFile>> BookReviewVO
<<JavaClassFile>> BookReviewData
Page 61
61
The diagram demonstrates some components and their inter-relationships. Assembly connectors "link" the provided interfaces supplied by "Product" and "Customer" to the required interfaces specified by "Order". A dependency relationship maps a customer's associated account details to the required interface; "Payment", indicated by Order".Components are similar in practice to package diagrams, as they define boundaries and are used to group elements into logical structures. The difference betweenpackage diagrams and component diagramsis that Component Diagrams offer a more semantically rich grouping mechanism. With component diagrams all of the model elementsare private, whereas package diagrams only display public items.
Sheet p.1
Page 62
62
Server ComponentsThis diagram illustrates the layout ofthe main server side components thatWill require building for an on-line book store. These components are a mixture of custom built and purchased items which willbe assembled to provide the required functionality.
Page 63
63
Security ComponentsThe security components diagram shows how security software such As the Certificate Authority, Browser, Web server and other model elements work together to assure security provisions in the proposed system.
Page 64
64
Catalog Home Strub
Catalog Business Delegate
CatalogRemote Strub
Catalog EJB Home
Catalog EJB objectb
Catalog Bean
Catalog.jsp Catalog homeCatalog home
Catalog remote Catalog remote
Catalog remote
Remote method calls across a network using HOP
สีฟ้าคาํอธิบาย
Page 65
65
5.6 Deployment diagram
show how a system will be physical deployed in the hardware environment
Its purpose is to show where the different component of the system will physically run
and how they will be physical with each other
Show how software is mapped onto hardware devices.
สถาปตยกรรมแบบ physical เปนการมองภาพรวมทัง้ระบบ ในลกัษณะที ่hardware เชือ่มตอกนั
Page 66
66
สญัลกัษณ
เปนการเชือ่มระหวาง node
Node เปน object ที่แทนอปุกรณฮารดแวรที่ใชในการทาํงานของระบบ
ปกต ิจะม ีอยางนอย 1 หนวยความจาํ 1 processor
node สีเ่หลีย่มลกูบาศก 3 มติ ิภายในบรรจปุระเภทของ node เชน PC หรอื Hostmachine
ลกูศรเสนปะ เชือ่มระหวาง node
อาจมกีารเชือ่มตอระหวาง node ที่แสดงวาอปุกรณมกีารตดิตอสื่อสารกนัดวยวธิใีด
Page 67
67
ตวัอยาง
AdminServer:HostMachine
:Schedule <<database>>meetingDB
Joe’sMAchine:PC
:Planner
Page 68
68
ตวัอยาง การเชือ่มตอกนัของโหนดโดยกาํหนดประเภทการสือ่สาร
ClientA:PC
ClientB:PC
Database Server:VAX
Application Server:Silicon Graphics:O2
<<TCP/IP>>
<<TCP/IP>>
DecNet
Page 75
75
อธบิาย Deployment diagram ไดอะแกรมนีแ้สดงใหเ้ห็นถงึสถาปตัยกรรมแบบ client-server โดยมีserver 2 ตวั คอื bank server กบั Real Estate server และ client คอื aPC ในการทาํงานของระบบเป็นการเชือ่มตอ่การทาํงานผา่นเครือ่ขา่ย TCP/IP ซึง่เป็น protocol ในการเชือ่มตอ่ในการทํางาน aPC คอื BuyerInterface ทาํงานกบั server ท ัง้ 2 ตวั เพือ่นําขอ้มลูมาแสดงที ่BuyerInterface
ในการทํางาน ที ่bank server รบัขอ้มลูผา่นทาง IMorgageAppcationผา่นเครือ่ขา่ยและประมวลผลที ่Morgage Application โดยดงึขอ้มลูจาก CustomerDB
สว่น การทาํงานที ่Real Estate server เมือ่รบัขอ้มลูผา่นILsting ทางเครือ่ขา่ยก็นําไปประมวลผลที ่Listing โดยตรวจสอบ/ดงึขอ้มลูจาก MultipleListings
Page 78
78
OnBoardComputer
RoutingSubsystem
WebServer
PlanningSubsystem
Figure 6-31 Allocation of MyTrip sunbsystem to hardware (UML development diagram).RoutingSubsystem runs on the OnBoardComputer while PlanningSubsystem runs on a WebServer.