Top Banner
Dr. nattapong songneam www.siam2dev.net Lec10-Behavioral Modeling with UML Behavioral Modeling State Diagrams Activity Diagram Lec10_OOAD_Activity_State_Diagram-10-02-2561.pdf
85

Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Apr 19, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Dr. nattapong songneamwww.siam2dev.net

Lec10-Behavioral Modeling with UMLBehavioral Modeling

State DiagramsActivity Diagram

Lec10_OOAD_Activity_State_Diagram-10-02-2561.pdf

Page 2: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Lecture Outline

• Behavioral Diagrams

• State-Transition Diagram

• Activity Diagram

Page 3: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

UML 2.0

• 14 diagrams ….. 9 diagram are used for OO , and rest for

other application domain

• Analysis

• Use case

• Design

• Class /Object

• Deployment

• Activity diagram

• State Chart / State Transition diagram

Page 4: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

UML has 9 kinds of diagrams

Class Diagram

Object Diagram

Component Diagram

Deployment Diagram

Use Case Diagram

Sequence Diagram

Collaboration Diagram

StateTransition Diagram

Activity Diagram

Structural Diagrams

Behavioral Diagrams

Page 5: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Behavioral Diagrams• Behavioral Diagrams เปนโครงสรางแบบ dynamic • 4 diagrams ไดแก

• Sequence Diagram• Collaboration Diagram• State-transition Diagram• Activity Diagram

Interaction Diagrams

Page 6: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

State Diagram

• ใชเ้พื่อแสดงกิจกรรมใน function ต่าง ๆ ของ class แต่ละตวั

• กิจกรรมโดยรวมของระบบเกิดจากกิจกรรมยอ่ยของ object แต่ละตวั

รวมกนั

• กลไกท่ีทาํใหร้ะบบมีกิจกรรมคือ การส่ง message

• ในทาง object orientation คือ การเรียกใช ้function ของ object นัน่เอง

6

Page 7: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

การเกิดกิจกรรมใน Object

• เกิดจาก 2 ส่ิงประกอบกนัคือ

• State : สถานะ

• Transition : การเปล่ียนสถานะ

• กิจกรรมเกิดจาก การท่ี object เปล่ียนจากstate ท่ี 1 ไปยงั state ท่ี 2

7

Page 8: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

State & Transition

State และ Transition แสดงการทาํงานของหลอดไฟ

หลอดยงั

ไม่ไดติ้ดตั้งปิด เปิด

Turn On Switch

Turn Off Switch

ติดตั้ง

8

Page 9: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

สญัลกัษณ์ State

• แทนดว้ย ส่ีเหล่ียมมุมมน

• ระบุช่ือของ state ลงในส่ีเหล่ียม

• เช่น การเขียน State Idle

Idle

*** อย่าไปจาํสับสนกบั คลาส / DFD

9

Page 10: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

สญัลกัษณ์ การเปล่ียนสถานะ (Transition)

• แทนดว้ย ลูกศร

• ลากจาก state เร่ิมตน้ไปยงั state ท่ีตอ้งการ

• ใส่ช่ือ transition บนลูกศร มีรูปแบบคือ

[Condition]/[Action]

Condition คือ เง่ือนไขในการเขา้หรือออกจาก state

Action คือ กิจกรรมท่ีทาํระหวา่งการเปล่ียน state

/ เปิดสวติช์ไฟ

/ ทาํอะไรบางอย่าง

10

Page 11: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

สญัลกัษณ์จุดเร่ิมตน้

• จุดเร่ิมตน้ของกิจกรรมต่าง ๆ ใน state diagram เรียกวา่ initial state

• แทนดว้ยวงกลมทึบ

11

Page 12: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

สญัลกัษณ์จุดส้ินสุด

• จุดส้ินสุดของกิจกรรมทั้งหมดเรียกวา่ End state

• แทนดว้ยวงกลมใส ลอ้มรอบวงกลมทึบ

Final StateFinalizeFinishEnd state

12

Page 13: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

ตวัอยา่ง State Diagram

State Diagram การทาํงานของลิฟต์

Idle Move Up

Move Down Reach

Want Up/Go Up

Want Down / Go Down Desired Floor reached

Floor<>5& Desired Floor

reached

Floor>1/Go Down

Floor=5

/Turn On

/Turn Off

UML ไม่ใช่เฉพาะการทาํงานท่ีเป็น Database System

เป้าหมาย เช่น ต้องการไป ช้ัน 5เป้าหมาย เช่น จากอยู่ ท่ีช้ัน 8 ต้องการลงไป ช้ัน 5 13

Page 14: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

การจาํลองกิจกรรมภายใน state

• ใชเ้พื่อระบุรายละเอียดในการทาํงานของ state ต่าง ๆ แบ่งไดเ้ป็น

• กิจกรรมท่ีทาํเม่ือเขา้มาใน state

• กิจกรรมท่ีทาํระหวา่งอยูใ่น state

• กิจกรรมท่ีทาํก่อนท่ีจะออกจาก state

• กิจกรรมท่ีทาํเม่ือเกิดเง่ือนไขต่าง ๆ ข้ึน

14

Page 15: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

กิจกรรมท่ีทาํเม่ือเขา้มาใน state

• entry/action

• หมายถึง เม่ือเขา้มายงั state น้ีใหท้าํกิจกรรม action

• เช่น entry/count=0

• หมายถึง เม่ือเขา้มายงั state ใหค่้า count เป็น 0

15

Page 16: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

กิจกรรมท่ีทาํระหวา่งอยูใ่น state

• do/action

• หมายถึง หลงัจากเขา้มายงั state น้ีแลว้ หากไม่มีเง่ือนไขอ่ืนใด ใหท้าํ

กิจกรรม action

• เช่น do/count:=count+1

• หมายถึง เม่ือเขา้มายงั state น้ีใหเ้พิ่มค่า count ทีละ 1

16

Page 17: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

กิจกรรมท่ีทาํก่อนท่ีจะออกจาก state

• Exit/action

• หมายถึง ขณะท่ีจะออกจาก state น้ีใหท้าํกิจกรรม action

• เช่น Exit/show “Good Bye” message

• หมายถึง หากออก state น้ีใหแ้สดงขอ้ความ “Good Bye”

17

Page 18: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

กิจกรรมท่ีทาํเม่ือเกิดเง่ือนไขข้ึน

• condition/action

• หมายถึง ขณะท่ียงัอยูใ่น state น้ีเม่ือเกิดเง่ือนไขใด ๆ ท่ีกาํหนดโดย

condition ใหท้าํกิจกรรม action

• เช่น every 2 seconds/phone ring

• หมายถึง ทุก ๆ 2 วินาทีใหเ้สียงโทรศพัทด์งั 1 คร้ัง

18

Page 19: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

State Diagram ท่ีมี Internal Activity

State Diagram การทาํงานของลิฟต์

Idleentry/floor=1

Move Updo/floor=floor+1(floor=max)/stop

Move Downdo/floor=floor-1(floor=1)/stop

Reachentry/stop

Want Up/Go Up

Want Down / Go Down Desired Floor reached

Floor<>1& Desired Floor

reached

Floor>1/Go Down

Floor=1

/Turn On

/Turn Off

19

Page 20: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

State Diagram & Class Diagram

• Class diagram จะทาํใหเ้ห็นภาพของ class แต่ละ class

• Function ของ class จะหมายถึง state diagram หน่ึงชุด

• Attribute จะเป็นตวัท่ีมีการเปล่ียนแปลงไปในกรณีใดกรณีหน่ึง

20

Page 21: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

State Diagram & Sequence Diagram

• Sequence diagram จะทาํใหเ้ห็นภาพกิจกรรมของ class ซ่ึงจะใชเ้พื่อ

โตต้อบกบั class อ่ืน ๆ ใน problem domain

• มีส่วนช่วยในการพิจารณาแนวการดาํเนินไปของการเปล่ียน state

ของ class หน่ึง ๆ

21

Page 22: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

หลกัการเขียน State Diagram

• จาํนวนของ state diagram มกัจะไดจ้ากจาํนวน function ของแต่ละ

class รวมกนั

• ไม่จาํเป็นตอ้งเขียน state diagram ของทุก function

• ถา้ function ใดไม่มีกิจกรรมซบัซอ้นไม่จาํเป็นตอ้งมี state diagram

• ใหพ้ิจารณาวา่ใน class นั้นจะมี state ใดบา้ง โดยไม่คาํนึงถึง

function ท่ีมี

22

Page 23: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

หลกัการเขียน State Diagram

• จาก state ท่ีมีอยูใ่หเ้ขียน state diagram ของแต่ละ function

• เพิ่ม state ท่ีจาํเป็นเพิ่มเติม เพื่อให ้state diagram สมบูรณ์ข้ึน

• ทาํซํ้ าจนครบทุก class ใน class diagram

23

Page 24: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

ตวัอยา่งการเขียน State Diagram

State Diagram ของ Class Computer

Computer

- Power Status

# Turn On# Shut Down# Read Instruction# Decode# Execute# Store Data

24

Page 25: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

State ของ Class Computer

• Off

• On

• Boot

• Ready

• Reading

• Sending

• Decoding

25

Page 26: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

State ของ Class Computer

• Executing

• Buffering

• Output

• Storing Data

26

Page 27: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

State Diagram : Turn On Function

Ready

do/waitingfor instructions

Switch on Complete

Booting Complete Boot

do/loading theoperating system

Off

do/shut down the power

On

do/turn on thecomputer

Switch is turned on

27

Page 28: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

แบบฝึกหดั จงเขียน state Diagram

• รถเดก็เล่นชนิดหน่ึง เม่ือเปิดสวิตซ์จะวิ่งไปมา แต่เม่ือมาเจอขอบ

ของวตัถุเช่นขอบโตะ๊ซ่ึงอาจจะทาํใหม้นัหล่นลงพื้นได ้มนัจะหยดุ

และจะเล้ียวซา้ย แต่ถา้เล้ียวซา้ยแลว้เจอส่ิงกีดขวางจะเล้ียวขวาแทน

แต่ถา้ไปไม่ไดจ้ะถอยหลงั และในท่ีสุดถา้ถอยหลงัไม่ไดม้นัจะปิด

สวิตซ์ตนเองโดยอตัโนมติั

28

Page 29: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

:Student :Teacher

Server

Client

:Teacher หมายถึงอาจารยค์นใดคนหน่ึง

:Customer หมายถึงลกูคา้คนใดคนหน่ึง

aCustomer:Customer หมายถึงลกูคา้ท่ีมีอินสแตนซ์ aCustomer

Method/Function/Operation

ส่งการบา้น

submitAssignment(afile:file)

message

PDT / ADT

Main programTester

new Customer();Customer c = new Customer();

:Student Student

Page 30: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

ระบบส่วนใหญ่แลว้ จะไม่หยดุน่ิง มีการเคล่ือน

• พฤติกรรม(behavioral) ของ วตัถุ จะทาํใหร้ะบบเกิดการเคล่ือนใหว

Customer Order

+ Order() + Order()

issue1 *

Page 31: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

A State -Transition Diagram

Initialization Openentry: Register studentexit: Increment count

Closed

Canceled

do: Initialize course

do: Finalize coursedo: Notify registered students

Add Student / Set count = 0

Add student[ count < 10 ]

[ count = 10 ]

Cancel

Cancel

Cancel

UML 2.0 แผนภาพการเปล่ียนสถานะของวัตถุ

Page 32: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Symbol

• Start ………..Intialization

• Finish / Finalization

• State ..สถานะ

*** อย่าสับสนกับ DFD ใช้

สาํหรับระบบดั้งเดิม

Page 33: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

A State -Transition Diagram

• A State -Transition Diagram UML 1.0

• A State -Machine Diagram UML 2.0

Page 34: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

ตวัอยา่งการเขียนแผนภาพสถานะของพนกังาน ของ บ. แห่งหน่ึง

ส้ินสุดสภาพการเป็นพนกังาน

ส้ินสุดสภาพการเป็นพนกังานEntry/Do work

เกษียณ

:คนผูเขาสัมภาษณ

ส้ินสุดสภาพการเป็นพนกังาน

Trigger Event

Page 35: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Start

• จุดเร่ิมตน้ จะมีแค่จุดเดียว ....• แต่จุดส้ินสุดจะมีไดห้ลายจุด final

Page 36: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

State Transition หมายถึง การเปล่ียนจากสถานะ

หน่ึงไปยงัอีกสถานะหน่ึง...

Page 37: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

State Diagram

• มีไวส้าํหรับตรวจสถานะ ติดตามสถานะต่างๆ ของวตัถุ โดยมี

พื้นฐานท่ีบอก วตัถุใด กต็ามจะไม่สามารถอยูใ่นสภาพเดิมไดต้ลอด

• ถา้อยูส่ถานะน่ิงแบบเดิม กไ็ม่ทาํใหเ้กิดเหตุการณ์(Event) ทั้งระบบก็

น่ิงไม่เกิดกิจกรรมใดเลย

ระบบนิ่ง ไมมีการเคลื่อน ไหว หรือไมมีกิจกรรมใด

ตองทําใหเกิดกิจกรรมตางๆ ข้ึน ดวยเหตุการณ หรืออะไรก็ตามทําใหเกิดการเปลีย่นแปลง

การเปลี่ยนแปลง นั้น ก็คือ การเปลี่ยนสถานะนั่นเอง

Page 38: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

ถา้ในโลกน้ี

• มีแต่กอ้นหิน และ กอ้นหิน และ กอ้น

หิน

Page 39: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

1) สถานะของวัตถุแทนดวยสี่เหลี่ยม

*** อย่าสับสนระหว่างสัญลกัษณ์ คลาส class หรือ สัญลกัษณ์ Process ใน DFD

State

1

2

3

4

Page 40: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

1

2

3ปิดไฟ ปิดแอร์ ปิดคอม ขอบคุณอาจารย์ 4

ปิด

State

สถานะของ การเขา้เรียน

การเขา้เรียน

เม่ือจะออกจาก

หอ้งเรียน

เม่ือเขา้มาในหอ้งเรียน

แลว้ ทาํอะไร

ก่อนจะเขา้หอ้งเรียน ให้

ทาํอะไร

หลงัจากออกจากหอ้ง

ไปแลว้ .....

*** อาจจะไม่ต้องเขยีนครบทุกสถานะย่อย ....

Page 41: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

1

2

3ปิดไฟ ปิดแอร์ ปิดคอม ขอบคุณอาจารย์ 4

ปิด

State

Page 42: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

1

2

3ปิดไฟ ปิดแอร์ ปิดคอม ขอบคุณอาจารย์ 4

ปิด

Off

Project

On

Picture is blur/Adjust Focus

Page 43: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

2) การเปลีย่นสถานะ(Transition) แทนดว้ย ลกูศร ทีล่ากจากสถานะเร ิม่ตน้ไปยงัสถานะทีต่อ้งการเขยีนชือ่ เหตกุารณ์บนลกูศร มรีปูแบบดงันีค้อื

[Condition] กบั [Action]

เง ือ่นไข(Condition) คอื เงือ่นไขในการเขา้หรอืออกจากสถานะการกระทาํ(Action) คอื กจิกรรมทีท่าํระหวา่งการเปลีย่นสถานะ

นํา้แข็ง นํา้เร ิม่ตน้

การเปลีย่นสถานะอณุหภมูสิงูข ึน้ , ละลาย

Page 44: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

นกัศกึษา บณัฑติเร ิม่ตน้

เรยีนครบตามหลกัสตูร , จบ

Page 45: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Computer

• สถานะเร ิม่ตน้ ขณะคอมพวิเตอร ์กาํลงัเปิด นีส่ ิง่ท ีเ่รากาํลงัพจิารณา

• ขึน้อยูก่บันกัวเิคราะห ์จะพจิารณา จากสถานะใด หรอืตอ้งการเนน้ทีส่ถานะใด น ัน่เอง

เปิด ปิดเริ่มตน

Trigger , Event , Object

กดสวิตช ์ , shutdown

Page 46: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

การเขา้ใชอิ้นเตอร์เน็ต

• คอมพวิเตอร ์เป็นวตัถ ุคอมพวิเตอรใ์ดๆ :Computer• เปิดโปรแกรมโปรแกรม IE / firefox• พมิพ ์URL

เปด เปดเริ่มตน

เปิดโปรแกรม , double Click

พิมพ ์URL

สิ้นสุด

การเข้าใช้อินเตอร์ของ User

aCom:Computer

HP:Computer

:Computer

ระบบท่ีเก่ียวกบั การพฒันาเวบ็ กอ็าจจะมีการเขียน state machine diagram

ระบบท่ีเก่ียวกบั การพฒันาเวบ็ กอ็าจจะมีการเขียน state machine diagram(อธิบาย user)

IE/Firefox/Chrome

Page 47: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

ถา้เป็นระบบท่ีพฒันา

• บนเวบ็ จะตอ้งเขียน activity การเขา้ใชเ้วบ็ไซตด์ว้ย

• บนคอมพิวเตอร์ จะตอ้งเขียน activity การเขา้ใชโ้ปรแกรมดว้ย

• บนมือถือ จะตอ้งเขียน activity การเขา้ใช ้application บนมือถือดว้ย

เปด เปดเริ่มตน

เปิดโปรแกรม , double Click

พิมพ ์URL

สิ้นสุด

ระบบท่ีเก่ียวกบั การพฒันาเวบ็ กอ็าจจะมีการเขียน state machine diagram

ระบบท่ีเก่ียวกบั การพฒันาเวบ็ กอ็าจจะมีการเขียน state machine diagram(อธิบาย user)

IE/Firefox/Chrome

Page 48: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Class

:Computer aCom:Computer

:Student สมชาย:Student

Objects

Computer

:Button b1:ButtonButton

Student

Page 49: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

เปด เปดเริ่มตน

เปิดโปรแกรม

พิมพ ์ URL

สิ้นสุด

ระบบท่ีเก่ียวกบั การพฒันาเวบ็ กอ็าจจะมีการเขียน state machine diagram

IE/Firefox/Chrome

ปด

ปิดโปรแกรม Brower

เปล่ียนเวบ็ไซต/์พิมพ ์URL

การเปลีย่นสถานะ

จากสถานะตวัเอง ไปสถานะอืน่

หรือ จากสถานะตวัเอง ไปยงัสถานะตวัเอง

Page 50: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

5) การจําลองกิจกรรมภายในสถานะ(Internal Activity) ใชเพ่ือระบุรายละเอียดใน

การทํางานของ สถานะตางๆ ใหชัดเจนขึ้นโดยแบงเปน

1) กิจกรรมที่ทําเม่ือเขามาในสถานะ(entry/action)

2) กิจกรรมที่ทําระหวางอยูในสถานะ(do/action)

3) กิจกรรมที่ทํากอนที่จะออกจากสถานะ(exit/action)

4) กิจกรรมที่ทําเม่ือเกิดเงื่อนไขตางๆ ขึ้น(condition/action)

state

(entry/action)

เขาหองเรยีน

(entry/เคาะประตู)

ใน 1 สถานะ หรือ 1 State

เชน ตอนที่เขามาในหอง/ทําอะไร

เชน กอนจะออกจะหอง/ทําอะไร

เชน ระหวางที่อยูในหอง/ทําอะไร

เชน เม่ือจะออก/ขอบคุณอาจารย/ปดไฟ/ปดแอร

เชน ตอนท่ีเขามาในหอง/ขออนุญาตเขาหอง

เชน ออกไปแลว/ปดประตู

Page 51: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

การเขาหองเรียน

(entry/เคาะประตู)

(do/ต้ังใจเรียน)

การเขาหองเรียน

(entry/เคาะประตู)

(do/ตั้งใจเรียน)

(exit/ขออนุญาต , ปดประตูใหเรียบรอย)

สิ่งนี้คือ โอเปอเรชัน /ฟงกชัน / โปรแกรมยอย

ดังนั้น จึง มีหลายคําสั่งได

เชน คํานวณภาษี

คํานวณรายได

คํานวณเกรด

อาจารยส์ัง่แบบฝึกหดั/ทําแบบฝึกหัด

Page 52: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

เม่ือลูกค้า ส่ังซ้ือส้ิน เค้าจะได้ bill หรือใบเสร็จ ลูกค้าจะต้องทาํการจ่าย

ระบบส่ังซ้ือสินค้า

Page 53: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

มี 2 objects

signalMethod/function

ใชเ้พ่ืออธิบายโปรแกรมเพ่ือใหเ้ห็นวา่ วตัถุมีการเปล่ียนสถานะ จากสถานะนหน่ึงๆ ไปยงัอีกสถานะหน่ึง และมีการทาํ method ใด

Page 54: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

ใบสัง่ซ่ือ เลขท่ี............./..............ช้ือลูกคา้ ..........................ท่ีอยู ่................. เบอร์โทร...............

ลาํดบั รายการ จาํนวน ราคา/หน่วย จาํนวนเงิน

1 computer 1 35000 350002 printer 2 2500 50003 Speaker 1 800 8004. mouse 10 150 1500

รวมทั้งส้ิน Total ………………………………VAT ………………….discount ………………………

Net ………………………

Page 55: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Checking

do : check item

Dispatching

do : initiate delivery

Waiting

Delivered

/ get first item

Item received[someitems not in stock ]

Item received[ all items available]

Delivered

[ All items checked && some items notin stock]

[ All items checked&& all items

availables ]

[ not all items checked ]/ get next item

สินคา้ เคร่ืองคอมพิวเตอร์ตรวจสอบวา่งยงัมี หรือไม่มี

ในสตอ็ก

จากสถานะเร่ิมตน้

ถา้ไม่มีในสต๊อก ให ้รอ

วางคาํสัง่ซ้ือ / สัง่ซ้ือ

ทาํรายการต่อไปเร่ือย ถา้ยงัไม่หมด

เช็คสตอ๊กสินคา้ ...............ถา้มีสินคา้ใด ขาด/จุดสั่งซ้ือ

เช่น ถา้พรินเตอร์ นอ้ย กวา่ 10 เคร่ือง ก็ใหท้าํการสั่งซ้ือ

PO

เพือ่ไม่ให้สินค้าขาด

เรียกว่าจุดส่ังซ้ือ เป็นหน่ึงในระบบ Inventory control

Page 56: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling
Page 57: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

ระบบก่อนหนา้ คือ ตรวจเช็คสินคา้ท่ีมีอยูใ่นสตอ๊ก

ก่อนท่ีจะสัง่ ตามจุดสัง่ซ้ือ

เช็คสตอ๊กสินคา้ ...............ถา้มีสินคา้ใด ขาด/จุดสั่งซ้ือ

เช่น ถา้พรินเตอร์ นอ้ย กวา่ 10 เคร่ือง ก็ใหท้าํการสั่งซ้ือ

PO

Page 58: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Life Line

• ในทาง OOP ในทางการเขยีนโปรแกรม

• วัตถุถูกสรางขึ้นมา

• วัตถุทํางาน ...เรียกใชฟงกชนั/โอเปอเรชัน

• ...

• ...

• ...

• วัตถุโดนทําลาย / โดน Delete

class customer {....

}

class Tester{

Customer c = new Customer();Customer c1 = new Customer()

..}

Page 59: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

สถานะ state

• เกิด ...แก ...เจ็บ...ตาย ศาสนาพุทธ

• น้ํา ไอ กาช น้ําแข็ง น้ํา.....วัฏจักร

• คอมพิวเตอร ..ปดอยู...กดสวิชซ ...กําลังเปด..เปด...ใชงาน...ปด

TriggerEvent

ตองมีอะไรสักอยางไปทําปฏิกิริยา

Page 60: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

เดก็

แก่ แก่

Page 61: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

• ยกตัวอยาง นิพรรษา

• เด็ก.....เจอแสงอาทิตย ...แก

ตองมีอะไรสักอยางไปทําปฏิกิริยา

Page 62: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

การเปล่ียนสถานะ

• ส่ิงท่ีเราสนใจ

• เม่ือสถานะเปล่ียน เราจะใหท้าํอะไร

• เราจะทาํอะไร เม่ือสถานะของวตัถุเปล่ียน

• หรือ มีเง่ือนไขอะไรท่ีทาํใหว้ตัถุเปล่ียนสถานะ

State

State1. ก่อนจะเขา้

2. เขา้ไปแลว้

3. อยูร่ะหวา่ง

4. ออก/กาํลงัออก

Page 63: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

customer

c c1

ใน UML ไม่ไดพ้ดูถึงสี

สีไม่เก่ียวIs member ofIs member of

Page 64: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

An Activity Diagram

ShowMessageBox“Printing” on Screen

Create postscriptfile

Send postscriptfile to printer

RemoveMessageBox

displayer samplerSwimlane Example

Ordinary Example

Page 65: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Activity Diagram

Page 66: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

• ใชสํ้าหรับ• อธบิาย กระแสการใหลของการทํางาน (workflow)• แสดงขัน้ตอนการทํางานของระบบ

• แตล่ะขัน้ตอนการทํางาน เรยีกวา่ Activity ตวัอยา่ง ไดแ้ก่• การคํานวณผลลพัธบ์างอยา่ง• การเปลีย่นแปลงสถานะ (State) ของระบบ• การสง่คา่กลบัคนื • การสง่สญัญาณ• การเรยีกใหโ้อเปอรเ์รชนัอืน่ๆ ทํางาน• การสรา้ง หรอื ทําลายวตัถุ

Activity diagram

Page 67: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Activity diagram(1)

Activity 1

Activity 2

Start

End

Activity

Page 68: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Activity diagram(2)

Activity 1

Activity 2 Activity 3

[Condition 2][Condition 1]

Page 69: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Activity 2

Activity 1

Activity 3

Activity 4

[synchronization condition]

Concurrent fork

Concurrent join

Synchronization Bar

Activity diagram(3)

Palarell

Page 70: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Example of activity diagrams

• The Coffee Pot

Page 71: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Put coffeein filter

Add waterto reservoir

Put filterin machine

Turn onmachine

Activity diagram

Find coffee

แผนภาพกิจกรรมสาํหรับ การตม้กาแฟ

Page 72: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Conditions in activity diagrams

Put coffeein filter

Check waterin reservoir

Put filterin machine

Turn onmachine

[not enough water] Put water inthe reservoir

[else]

Sequential branchunguarded transition

[filter with coffee in machine and reservoir contains water]

Find coffee

Page 73: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Activity

Activity

Activity

Activity

Activity

[condition 1]

[condition 2]

[synchronization condition]

Conditions in activity diagrams

Page 74: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Swimlanes

• ระบุ responsibilities

ของ Activity

Request product

Processorder

Pullmaterial

Shiporder

Customer Sales Warehouse

ลูกคา้ สัง่ซ้ือ Request productคนท่ีสร้าง/ออกใบสัง่ซ้ือ คือ sales

Page 75: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Request product

Process Order

Pull Material

Ship Order

Customer Sales Warehouse

Continue Work

Recieve Order Bill Customer

Pay BillClose Order

(พนกังานสตอ็ก)(พนกังานขาย)(ลูกคา้)

Page 76: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Request product

Process OrderPull Material

Ship Order

Customer Sales Warehouse

Continue Work

Recieve Order Bill Customer

Pay Bill

Close Order

o:Order[in progress]

o:Order[filled]

b:Bill[unpaid]

b:Bill[paid]

Page 77: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

ตองการสินคา

ลูกคา เซลล คลังสินคา

กระบวนการซื้อสินคา

O:Order

(ดําเนินการ)

นําสินคาออกจากคลัง

สงสินคาตามใบสั่งซื้อ

ออกบิลใหลูกคาไดรับสินคา

ชําระเงิน B:Bill

(ยังไมจายเงิน)

B:Bill

(ยังไมจายเงิน)

ปดการขาย

O:Order

(เสร็จสมบูรณ)

Page 78: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

กําหนดรายวิชาท่ีเปด

ฝายวิชาการ ผูสอน / อาจารยสาขาวิชา

ประชุมเลือกตาราง เลือกรายวิชา

กําหนดผูสอน

[กําหนดครบทุกวิชา]

[ยังไมครบ]

จัดพิมพตารางสอน

[จํานวน ชม. สอนครบ]

[ไมครบ]

จัดทํา มคอ. 3

S:Schedule

(ดําเนินการ)

สอน

แจกตารางสอน

Page 79: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling
Page 80: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

ท่ีมา : http://www.gentleware.com/fileadmin/media/archives/userguides/poseidon_users_guide/images/diag_act_processRes2.png

Page 81: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

ศึกษาขอมูล

ทีมวิจัย คณะ/สาขาวิชาบุคลากร

จัดอบรมพัฒนาโปรแกรม

ผูประเมิน

วิเคราะห/

ออกแบบระบบ

ประเมินความพึง

พอใจ

เขาใชระบบ

ประเมินความพึง

พอใจ

ปรับปรุงโปรแกรม เขาใชระบบ

ประเมินความพึง

พอใจ

สรุปผล

Page 82: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Reference :http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/uml15activitydiagramdefinitionexample_xml.html

Page 83: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

• ตองการเนนกิจกรรม (Activity) หรือ หนาที่การทํางาน

(Functionaliy) ไมใชวัตถุ (Object) ที่ทําใหเกิดกิจกรรม

• มีขั้นตอนการทํางานเปนลําดับ (step) จนกระทั่งสิ้นสดุการ

ทํางาน โดยไมถูก interrupt จากเหตุการณภายนอก

• ตองการแสดงการไหล (Flow) ของขอมูล หรือ วัตถุ ระหวาง

แตละขั้นตอน

When to use Activity diagram?

แทน ใช้ flowchart สําหรับการพฒันาแบบเชิงวตัถุ

Page 84: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

Summary

• Software Modeling

• Require and Domain Analysis Model

• Design Model

• Brief Overview of Unified Modeling Language (UML)

• Use Case Model

Page 85: Dr. nattapong songneam Lec10 ...siam2dev.net/E_Learning/OOAD/Lec10_OOAD_ActivityDiagram...2018/02/10  · Dr. nattapong songneam Lec10-Behavioral Modeling with UML Behavioral Modeling

References

1. Jarungjit Parnjai , Burapha University2. http://docs.embarcadero.com/products/rad_studio/delphi

Andcpp2009/HelpUpdate2/EN/html/devcommon/uml15activitydiagramdefinitionexample_xml.html