![Page 1: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/1.jpg)
http://www.siam2dev.com [ dr. nattapong songneam]
โดย อ.ดร. นฐพงศ สงเนยมhttp://[email protected]
สาขาวชา วทยาการคอมพวเตอรคณะวทยาศาสตรและเทคโนโลย มหาวทยาลยราชภฏพระนคร
Last Update : 28/01/2561
Lec05 : Introduction to UML
แหลงขอมลเพมเตม : : http://www.lumpaya.com/sdlc01.htm
![Page 2: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/2.jpg)
งานโปรเจกต สงไดตงแต
• ก าหนดสงกอน สอบปลายภาค 1 สป.
• สอบระหวางภาค บทท 1 - 5 ................ สอบวนท ......................
• ครงท 1. Business Rule(10 คะแนน)
• คร งท 2. งานกลมคร งหนา สง Requirement Specifications (10 คะแนน) + VDO สงกอน 11ก.พ. 2563
![Page 3: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/3.jpg)
UML
http://www.siam2dev.com [ dr. nattapong songneam]
Use CaseDiagrams
Use CaseDiagrams
Use CaseDiagrams
ScenarioDiagramsCollaboration
Diagrams
StateDiagrams
StateDiagramsComponentDiagrams
ComponentDiagramsComponent
DiagramsDeploymentDiagrams
StateDiagrams
StateDiagrams
ObjectDiagrams
ScenarioDiagrams
ScenarioDiagrams
StatechartDiagrams
Use CaseDiagrams
Use CaseDiagrams
SequenceDiagrams
StateDiagrams
StateDiagrams
ClassDiagrams
ActivityDiagrams
Models
![Page 4: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/4.jpg)
การวเคราะหและออกแบบระบบเชงวตถ (OOAD)
Lec05 # Introduction to UML
โดย อาจารย ดร. นฐพงศ สงเนยม
http://www.siam2dev.net
![Page 5: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/5.jpg)
Lecture Outline
• Software Modeling
• Require and Domain Analysis Model
• Design Model
• Brief Overview of Unified Modeling Language (UML)
![Page 6: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/6.jpg)
Structural Programming
and OOP
Analysis and Design
Tradditional / OOAD
Introduction to Database ,
DBMS / OODB
SE : Software Engineering
• Software Management• Project Management
• ฯลฯ• Algorithm
ER Design, Normalize, ER-Mapping , DBMS , DDL ,DML , DCL
ALGORITHM , PSEUDOCODE , SYNTAX, FLOWCHART , SCREEN LAYOUT , Visual Programming ,Event-Driven Programming , Object Oriented
Programming
SDLC, DFD, Process Description, UP, Analysis , Design ,Requirement , Diagram , UML, Screen
Layout
![Page 7: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/7.jpg)
What is Modeling?• การสรางแบบจ าลอง (Modeling)
– เปนวธการวเคราะห และออกแบบ (Analysis and Design) วธการหนงทเนนการสรางแบบจ าลอง เพอใหสามารถเขาใจปญหาของระบบ
– ใชเปนเครองมอในการสอสาร แนวคดในการพฒนาระบบ กบบคคลอนๆ (ระหวางผพฒนาระบบดวยกน และกบบคคลอนๆ)
• Textual Modeling• Mathematics Model
– เปนโมเดลทางคณตศาสตร เชน สมการ สตร
• Visual Modeling
– Visual แปลวา ภาพ
– Modeling กคอแบบจ าลอง ดงนน Visual Modeling กคอ
ใชสญลกษณรปภาพในการสรางแบบจ าลอง
1
n
ix
=
![Page 8: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/8.jpg)
SA Programmer
TesterUIDesigner
USERModel
Requirement
USE CASE ModelClass & Object Model
USE CASE Model
Class & Object Model
State DiagramActivity Diagram
USE CASE Model
UIUSE CASE Model
UI
*** ทกคนตองเขาใจตรงกน ภาษา หรอ สญลกษณทใช จะตองตรงกน
![Page 9: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/9.jpg)
SQL
• DDL: Data Definition Language
– CREATE DATABASE ….
– DROP TABLE
• DML : Data Manipulation Language
– SELECT , INSERT , UPDATE ,DELETE
• DCL : Data Control Language– GRANT
![Page 10: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/10.jpg)
ลกคา
Personal Corporate
SA : class & object specified
ลกคา
Personal Corporate
ลกคา
Personal Corporate
![Page 11: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/11.jpg)
• ต.ย. จงหาอายรวมของ นศ. วทยคอม 29
• 52 53 42 28 47 58 19
1
n
ix
=
0. Specified problem1. Requirement
2. การวเคราะห INPUT / PROCESS (algo) /
OUTPUT3. ออกแบบ Flowchart/ Structure chart /
PSEUDO-CODE
![Page 12: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/12.jpg)
เปรยบเทยบ
• MODEL ท ำงำนเสรจแลว แตอธบำยงำนใหงำยขนกท ำโมเดลขนมำเพออธบำยดวยวธกำรทงำย
• PROTOTYPE ยงไมไดท ำตวจรง แตท ำตวจ ำลองขนมำกอน แลว เอำตวจ ำลองไปสรำงเปนของจรง
![Page 13: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/13.jpg)
Software Modelingแบบจ าลองของซอฟตวร
UserRequirement
Modeling(Analysis and Design)
Model(Specification)
Tools ManuallyCoding
Program
Implementation
อนนเปนแบบจ าลอง ตวหนงทแสดงขนตอนการพฒนาซอฟตแวร
![Page 14: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/14.jpg)
Models• Requirement Analysis Models (Requirement Specification)
ไดจากกระบวนการวเคราะหความตองการของผใชระบบ (RequirementAnalysis)
• Analysis Modelไดจากกระบวนการวเคราะหหนาทการท างานของระบบ (System
Analysis)
• Design Model
ไดจากกระบวนการออกแบบการท างานของระบบ (System Design)
โมเดลส ำหรบกำรวเครำะห (SRS)
โมเดลส ำหรบกำรออกแบบ (class model , state model ,
sequence model , activity model , deployment model)
โมเดลส ำหรบกำรวเครำะห (use case model , class model )
![Page 15: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/15.jpg)
Software Development Process
1. Requirement Specification : define problem domain
2. Analysis : what problem to be solved? (อะไรคอปญหาทตองแก)
3. Design : how to solve the problem? (แกอยางไร)
4. Implementation : how to implement the solution?
5. Testing : how to ensure that the solution can solve the problem?
1. ทดสอบในเรองความเรว ประสทธภาพ ความปลอดภย ความม นคง เสถยร
2. ความเขากนได Integrated System
6. Maintenance : how to adjust the solution to accomodate change?
1. ในรอบระยะเวลาหนงอาจจะตองมการปรบเปลยน
7. Retirement : when does the system to be retired?
บทท 6 RequirmentSpecificationSDLC
![Page 16: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/16.jpg)
• Divide & Conquer
componet1componet2 componet3
componet4
Problem
Integrated System
Standard
![Page 17: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/17.jpg)
• ท าสไลด powerpoint 50 slide แบง 5 คน– ถาพนหลง คนละส เวลารวมกน จะเปนอยางไร
![Page 18: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/18.jpg)
การคอนโทรล
• ควบคมดวยซอฟตแวร
• ควบคมดวย มาตรฐาน / ISO เชน UML
จะถกพดถงในรายวชา Software Project Management หรอ วชา Software Engineering
![Page 19: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/19.jpg)
Web application / Mobile App
• MVC :
– M : Model
– V : View
– C : Control/Coding
data
Interface
Code
![Page 20: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/20.jpg)
ระบบชอขายสนคา
• ปญหาเดม / ทมา ระบบเดม ขายโดยการจดบนทกในสมด ปญหา มขอผดพลาดเยอะ / ลาชา
• ReqID :: 01 ตองการใหระบบสามารถบนทกขอมลการขายสนคาได
– ระบบจะตองท าการบนทก ขอมลสนคาไดทผซ อ ซอไป
– ระบบจะตองจดเกบขอมลผซ อได
– ระบบจะตองตรวจสอบไดวา พนกงานคนใดขายสนคาใหกบลกคา
– ระบบจะตองตรวจสอบจ านวนสนคาในสตอกได
![Page 21: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/21.jpg)
Structured Analysis Modelsโมเดลการวเคราะหเชงโครงสราง
• Data Flow Diagrams :: DFD
• Entity Relationship Diagrams : ERD
• State-Transition Diagrams : STD
เปนโมเดลแบบดงเดมทใชส าหรบการวเคราะหระบบแบบเชงโครงสราง
![Page 22: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/22.jpg)
Object-Oriented Analysis Models
• Use-case Diagrams
• Class and Object Diagrams
• Behavioral Diagrams
เปนโมเดลทใชส าหรบการวเคราะหระบบเชงวตถ
UML
UP
![Page 23: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/23.jpg)
The Unified Modelling Language (UML)
![Page 24: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/24.jpg)
What is UML?
• เปนเครองมอหรอภาษาทใชในการสรางแบบจ าลอง
(Modeling Language) ทประกอบดวยองคความรทใชใน
การน าเสนอและออกแบบเอกสารประกอบโปรแกรม
– คมอทางเทคนค Programmer Manual/Technical Manual
• อธบายรายละเอยดทางเทคนค การวเคราะห การออกแบบ การสราง การ
ทดสอบ
– คมอส าหรบผใช User Manual อธบาย การใชงานซอฟตแวร , การ
ปอนขอมล การปรบปรง แกไขขนตน
• รวม 3 แนวคด/วธการเชงวตถท ไดแก Booch, Rumbaugh
และ Jacobson รวมทงจากบคคลอน
• จดรวบรวมออกมาเปนมาตรฐานส าหรบการแลกเปลยน
แนวคดการออกแบบระบบ และองคความรในเชงเทคนคใน
รปของแบบจ าลอง
![Page 25: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/25.jpg)
What is NOT UML?
• ไมใชภาษาโปรแกรม (Programming Language)
– ไมใชภาษา VB , Pascal , Delphi , Java , C# etc.
• ใช method หรอ methodology {เปนวธการเปน
กระบวนการ}
• ไมระบ Process ทใชในการท างาน/จะไมระบเฉพาะวาใช
ภาษาใด
• UML ใชในการสรางแบบจ าลองการวเคราะห และออกแบบ
ระบบ โดยไมขนกบ Process
• แตละโครงงานสามารถเลอก Process การท างาน ท
เหมาะสม กบสภาพความจรงของโครงงาน โดยไมขนกบ
modeling language (สามารถใชกบภาษาโปแกรมใดกได)
**** ควำมหมำยไมก ำหนด ภำษำทใช หรอเครองมอทใชตำยตว ใหออกแบบกวำงๆ ไว
![Page 26: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/26.jpg)
Customer
CustName : Textual
CustID : Textual
CustAge : Integral
Customer
CustName : String
CustID : String
CustAge : int
Customer
CustName : String
CustID : String
CustAge : int16
Java, c,c#
VB
Customer
CustName : String
CustID : String
CustCredit : float
Java, c,c#
CustWeight : single
UML Class diagram Implementation
CustIncome : Floating-Point CustIncome : double
![Page 27: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/27.jpg)
UML Type
• Textual
• Character
• Integral ……………..
• Floating-Point
• Boolean
• Date
![Page 28: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/28.jpg)
History of UML• 1970s วธเชงวตถ (Object-oriented method)
• 1970s, 1980s, 1990s “Method Wars”
Grady Booch, Jim Rumbaugh, Ivar Jacobson
• 3 แนวคด/วธการเชงวตถทเปนทนยมใชในชวงกลางทศวรรษ
1990s ไดแก
– OOSE (Object-Oriented Software Engineering) โดย Ivar Jacobson
– OMT (Object Modelling Technique) โดย Jim Rumbaugh
– Booch method โดย Grady Booch
• ปญหาดานการสอสาร สญลกษณทใชในแตละวธการไมเหมอนกน
![Page 29: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/29.jpg)
Histroy of UML• ในป 1994/5 Booch, Rumbaugh และ Jacobson (เรยกตวเองวา “three amigos”) รวมกนท าการรวบรวมแนวคดองคความร และเทคนคตางๆ เขาดวยกน ท Rational Software
• Three Amigos เสนอ Unified Modelling Language (UML) ไปยง หนวยงาน OMG (Object Management Group) เพอใหเปนภาษามาตรฐานส าหรบสรางแบบจ าลองเชงวตถ
• UML Version 1.1 ไดถกพฒนาขนในป 1997 เพอเปนมาตรฐาน ส าหรบสรางแบบจ าลองเชงวตถ
![Page 30: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/30.jpg)
Histroy of UML
• ป 1998 พฒา UML Version 1.2
• ป 1999 พฒา UML Version 1.3
• ป 2000 พฒา UML Version 1.4
• ป 2001 พฒา UML Version 2.0
• http://www.uml.org/
![Page 31: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/31.jpg)
สบคนเมอวนท : 28.01.2563
![Page 32: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/32.jpg)
32
The Evolution of the UML:
UML1.1
UML1.0
UML0.9
Beta version OOPSLA’96
Public Feedback
Submission of OMG group
OMG vote’97
Submission to OMG, sept’97
Unified Method 0.8
Other method Booch OMT OOSE
![Page 33: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/33.jpg)
Models and Diagrams
Use CaseDiagrams
Use CaseDiagrams
Use CaseDiagrams
ScenarioDiagrams
ScenarioDiagramsCollaboration
Diagrams
StateDiagrams
StateDiagramsComponentDiagrams
ComponentDiagramsComponent
DiagramsDeploymentDiagrams
StateDiagrams
StateDiagrams
ObjectDiagrams
ScenarioDiagrams
ScenarioDiagrams
StatechartDiagrams
Use CaseDiagrams
Use CaseDiagrams
SequenceDiagrams
StateDiagrams
StateDiagrams
ClassDiagrams
ActivityDiagrams
A model is a complete
description of a system
from a particular
perspective
Models
![Page 34: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/34.jpg)
UML 2
UML 2 defines 14 diagrams (all supported by Enterprise Architect)
1. Package diagrams
2. Class or Structural diagrams
3. Object diagrams
4. Composite Structure
5. Component diagrams
6. Deployment diagrams
7. Use Case Diagrams
8. Activity diagrams
9. State Machine diagrams
10. Communication diagrams
11. Sequence diagrams
12. Timing diagrams
13. Interaction Overview diagrams
14. Profile diagrams
![Page 35: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/35.jpg)
ท าไมตองเปน UML
• Development life cycle - สนบสนนท ง life cycle ของการพฒนาระบบ สามารถถกใชตงแตขนตอนการหาความตองการ (Requirements) จนถงขนตอนการทดสอบตดตงระบบ (Test & Installation)
• Implementation languages and platforms - ไมผกตดกบภาษาและแพลทฟอรม (platform) ของการ implement สนบสนนทง pure oolanguages เชน smalltalk java, c#. หรอ hybrid เชน c++ หรอ non-oo เชน c,pascal,basic
• Application domains - สนบสนนการสราง application ในหลาย domain เชน information systems {MIS , EIS , ES , DSS,TPS}, embeded real-time systems, technical systems, distributed systems, system software
• Development process – สามารถใช UML รวมกบกรรมวธพฒนาระบบใดๆกได (prefer UP)
• Internal concepts – มหลกการทชด มนคง
![Page 36: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/36.jpg)
server
client
Client -Server
database
Web Application
server
database
Distributed-Database System
![Page 37: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/37.jpg)
3-Tier Architecture
![Page 38: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/38.jpg)
มมมอง UML (UML Views)
Major Area มมมอง (View) แผนภาพ (Diagrams)
โครงสราง
(structural)
static view class diagram
use case view use case diagram
implementation view
deployment view
component diagram
deployment diagram
สามารถใช UML สรางเปนโมเดลแสดงมมมองระบบไดเปน 3 กลม
พลวตร
(dynamic)
state machine view state chart diagram
activity view activity diagram
interaction view sequence diagram
collaboration diagram
การจดการโมเดล
(model management)
model management view class diagram (package, subsystem)
![Page 39: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/39.jpg)
UP : Lifecycle Phases
• Inception Define the scope of the project and
develop business case
time
Inception Elaboration Construction Transition
• Elaboration Plan project, specify features, and
baseline the architecture
• Construction Build the product
• Transition Transition the product to its users
![Page 40: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/40.jpg)
![Page 41: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/41.jpg)
The Iterative Approach
OOAD : Object-Oriented Analysis and
Design41
Disciplinesgroup activities
logically
In an iteration,you walk through
all disciplines
41
![Page 42: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/42.jpg)
จ. อ. พ. พ.
![Page 43: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/43.jpg)
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(static diagrams)
Behavioral Diagrams(dynamic diagrams)
![Page 44: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/44.jpg)
UML(Unified Modeling Language)
• 5 มมมองหลกของ UML– Use-case view : หนาทการท างานของระบบซอฟตแวรโดยพจารณาจากมมมองของผใชภายนอก หรอ ระบบภายนอก• use-case diagram
– Logical view : หนาทการท างานของระบบมโครงสรางอยางไร มองในรปของ static structure และdynamicbehavior• class diagram, object diagram, state,
sequence, collaboration, activity diagrams
![Page 45: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/45.jpg)
UML(Unified Modeling Language)
– Component view : องคประกอบยอยในการ implement ทประกอบเปนระบบ และ dependency ระหวางองคประกอบเหลาน น• component diagram
– Concurrency view: การแบงแยก process และ processors โดยพจารณาท ง communication และ synchronization • dynamic diagrams (state, sequence, collaboration
activity)• implementation diagrams(component และ deployment)
– Deployment view : โครงสรางทางกายภาพเกยวกบ การตดต งและใชงานระบบ• deployment diagram
![Page 46: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/46.jpg)
1. แผนภาพคลาส(Class Diagrams)
• Class diagrams
– แสดงรายละเอยดของ Class และความสมพนธระหวาง Class ในมมมองแบบ logical view
• สวนประกอบของ UML class diagrams ไดแก
– Class, โครงสรางของ Class และพฤตกรรมของ Class
– ตวบงชMultiplicity และ navigation
– ชอของ Role
– ความสมพนธแบบ Association, Aggregation, Dependency, และ Inheritance
*** แผนภาพทอธบายเกยวกบคลาสในบทท ผานมา เปนเพยงแคใชส าหรบการเรยน แตตอไปนจะเปนแผนภาพและสญลกษณตามมาตรฐาน UML
![Page 47: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/47.jpg)
มมมอง
• Logical View เชงตรรกะ แนวคด use case , Class
diagram
• Physical View เชงกายภาพ component , deployment
![Page 48: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/48.jpg)
Classes in UML
Person
Class name
Attributes
Operations
• เขยนได 2 รปแบบ
Person
- TaxIDNo : Text- Name : Text+ Income : Floating-Point+ TaxPaid : Boolean
+ calcTax()+ calcTaxBal() : Floating-Point
Visibility attribute name : type
Visibility operation name(parameter : type) : result type
![Page 49: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/49.jpg)
การเขยนแผนภาพคลาสกรณทตองการแสดงภาพรวมของระบบ ใหเขยนแบบยอ คอ มแคชอคลาส และความสมพนธระหวางคลาสเทานน
อาจารย นกเรยน
![Page 50: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/50.jpg)
Syntax for attributes
รปแบบVisibility attribute name : type
Visibility : public (+) , private(-) , protected(#)
ตวอยาง
+ custName : Text- color : Text- price : Floating-Point
![Page 51: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/51.jpg)
Syntax for Operation/function
รปแบบVisibility operation name(parameter : type) : result type
ตวอยาง+ getCustName() : Text+ setCustName(n : Text)+ deposit(amt : Floating-Point)+ withdraw(amt:Floating-Point)+ getBalance(): Floating-Point
![Page 52: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/52.jpg)
แผนภาพคลาส แสดงโครงสรางทงระบบ วาประกอบไปดวยอะไรบาง
![Page 53: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/53.jpg)
Person Person
- Name : String- Address : String
+ getName() : String+ setName(name:String)
Class name
Attribute
Behavior
*** Implement in java
![Page 54: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/54.jpg)
อยาไปเอา Type ในภาษาใดภาษาหนงมาใชกบ UML class diagram
Person
- TaxIDNo : String- Name : String+ Income : real+ TaxPaid : Boolean
+ calcTax()+ calcTaxBal()
Real เปนชนดตวแปรทศนยม ในภาษาปาสคาลเทานน ภาษาอนไมรจกUML ไมผกตดกบภาษา
Real → Pascal
float,Float→ c, c++, java
double,Double → c, c++, javaSingle,Double→VB
Floating,String,Boolean
![Page 55: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/55.jpg)
แสดงผลบนหนาจอ
1. Echo
2. Print
3. Printf
4. Scanf
5. System.out.print
6. System.out.println
7. Write
8. Writeln
9. Display
10. Input
11. Read
แตละค าสงคอภาษาอะไร แลวไวท าอะไร
Display “Menu”
![Page 56: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/56.jpg)
ในโลกนมภาษาคอมพวเตอร 160 กวาภาษา
คณรจกแค 2-3 ภาษาเขยนไดแค 1 ภาษาเขยนเปน 0 ภาษา
จงเขยนโปรแกรม Paint
ดวยภาษาท ถนดสรางรป บนทกไดเปดได
![Page 57: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/57.jpg)
ตวอยางแผนภาพคลาสของระบบลงทะเบยนเรยน
![Page 58: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/58.jpg)
A Class Diagram
Light
off( )on( )
Heater Cooler
Environmental Controller
define_climate( )terminate_climate( )
0..*
1
1
1
1
1
SystemLog
display( )recordEvent( )
Actuator
startUp( )shutDown( )
Temperature
generalization
aggregation
Embedded –real time System
แผนภาพคลาสนแทนโครงสรางการท างานของระบบเครองปรบอากาศ
![Page 59: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/59.jpg)
Vender / Dealer
Dependency relationship
Sale & Buy
*
* *
Association class
Association class
* *
POS: Purchase Order System
![Page 60: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/60.jpg)
ใบเสรจ สนคา* *
รายละเอยดกรขาย
Dependency relationship
![Page 61: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/61.jpg)
Television : Product
Product
Computer : Product
TypeAn object
![Page 62: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/62.jpg)
2. แผนภาพวตถ : An Object Diagram
Victoria High Street
Branch
(A Branch Object)
London Road
Branch
(A Branch Object)
Account
#31421123
Account
#741421123
Account
#521665423
Account
#31421123
Account
#31421123
Account
#714559543
![Page 63: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/63.jpg)
Object diagram
Link
![Page 64: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/64.jpg)
p1 : Person : Person
: Student
Name : สมชาย
วตถใด ๆ
Student
คลาส
![Page 65: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/65.jpg)
• ลกคาสมครบตรเคดต ( Association )
• นางรงทพย สมครบตรเคดต กรงศร plattinum …ของ ธนาคาร กรงศร
น าไปเขยนเปน class diagram เอกสทธ
น าไปเขยนเปน objects diagram รงทพย
![Page 66: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/66.jpg)
• อาจารย สอน นกศกษา ในรายวชา OOAD ( Association )
• อาจารยรญธดา สอน นกศกษาไอท 58/2 ในรายวชา OOAD …Senario
น าไปเขยนเปน Class diagram รฐธรรมนญ
น าไปเขยนเปน Objects diagram รญธดา
ใหใช CASE Tool : draw.io
![Page 67: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/67.jpg)
ใหใช CASE Tool : draw.io
![Page 68: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/68.jpg)
![Page 69: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/69.jpg)
CASE Tool : draw.io
![Page 70: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/70.jpg)
ลกคา ธนาคาร
เปนลกคา* 1..n
Class diagram
นฐพงศ : ลกคา ทหารไทย : ธนาคาร
เปนลกคา* *
Object diagram
*0..n
- ชอ : String
- ชอ = “นฐพงศ”
+ บอกชอ()
+ ฝำกเงน()
+ ถอนเงน()
Association name
Link
- ชอธนาคาร : String
![Page 71: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/71.jpg)
• ลกคาไปถอนเงนจากธนาคาร Association
• อาจารยนฐพงศ ถอนเงน 500 บาท จากตธนาคารกสกร …Senario
น าไปเขยนเปน class diagram นายนพณฐ
น าไปเขยนเปน objects diagram นางสาววชราภรณ
ลกคาไปเปนลกคาจากธนาคาร Association
![Page 72: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/72.jpg)
![Page 73: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/73.jpg)
![Page 74: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/74.jpg)
3. แผนภาพองคประกอบ (Component Diagram)
• Component Diagram เปนไดอะแกรมทใชอธบายถงซอฟตแวรตาง ๆ ทเปนองคประกอบ (Component) ของระบบน น ๆ ซงแสดงโครงสรางทางกายภาพของ(physical view)
เปนกำรอธบำยวำระบบนนๆ จะประกอบไปดวยซอฟตแวร ไฟลตนฉบบ (source code .java , .vb , .cpp ,
.pas) โปรแกรมประมวลผล(.exe) ไฟลฐำนขอมล (database
.mdb)ไฟลไลบลำร (.dll) และรำยงำน (.rpt) อะไรบำง หรอ มอะไรเปนองคประกอบบำง
เปนแผนภาพส าหรบ ขนตอน การออกแบบระบบElaboration Phase และ Construction Phase
![Page 75: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/75.jpg)
A Component Diagram
CourseCourseOffering
StudentProfessor
Course.dll
People.dll
Course
User
Register.exeBilling.exe
BillingSystem
อยใน เอกสาร Programmer Manual
*.dll: Dynamic Link Libralyเพอให คนทจะพฒนาตอเขาใจองคประกอบของระบบไฟล ทคณพฒนา
Billing เปนสวนหนงการลงทะเบยนเรยน
![Page 76: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/76.jpg)
3. Component Diagram
WindowHandler(whnd.cpp)
Graphiclib(graphic.dll)
CommHandler(comhnd.cpp)
Main Class(main.cpp)
WindowHandler(whnd.obj)
CommHandler(comhnd.obj)
MainClass(main.obj)
ClilentProgram(client.exe)
component diagram แสดงโครงสรางทางกายภาพของ(physical view) code ในเทอมของ code components (component อาจเปน source code component, a binary component, or an executable component)
อยใน เอกสาร Programmer Manual
![Page 77: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/77.jpg)
Physical Model ทางกายภาพLogical Model ทางลอจก
![Page 78: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/78.jpg)
4. Deployment Diagram
• Deployment Diagram ใชส าหรบแสดงสถาปตยกรรมของระบบในลกษณะทเปน Physical Architecture คอแสดงวามคอมพวเตอรและอปกรณอะไรบางทตองการใชในระบบ
• เวลาทจะน าระบบไปตดตง ตว deployment diagram จะอยในคมอ Technical Manual เปนคมอใหผตดตงระบบเขาใจการตดตงและองคกอบตาง ๆ
• โดยใชรปลกบาศกแทน โดย 1 ลกบาศกจะแทน 1 โหนด และแตละโหนดกจะม component ทเปนองคประกอบของโหนดนน
แสดงโครงสรางทางกายภาพของ(physical view)
เปนแผนภาพทใชในขนตอนการออกแบบระบบ Elaboration Phase Construction Phase เปนหนาทของ System Architecture Engineering
![Page 79: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/79.jpg)
A Deployment Diagram
AccountServer
DeploysAccountDB.javaAccountMgt.java
AccountServer
AccountMgt.javaAccountDB.java
อยใน เอกสาร Programmer Manualอยใน เอกสาร Programmer Manual
จะถกใชงานตอนน าไปตดตง จะอานคมอในการตดตง วาควรตดตงอยางไร
จากรป จะแสดงแผนภาพดพลอยดอยาง ทม แคโหนดเดยว ประกอบไปดวย 2 คอมโพเนนท
![Page 80: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/80.jpg)
Deployment Diagram
ClientA:Compaq Pro PC
ClientB:Compaq Pro PC
ApplicationServerSilicon GraphicsO2
DatabaseServerVAX
<< DecNe t>>
Deployment diagram แสดงสถาปตยกรรมการตดตงระบบ แสดงการตดตง Hardware และ Software ในระบบ
Client-server
อยใน เอกสาร Programmer Manual
โปรแกรมฝง client
โปรแกรมฝง server
โปรแกรมฝง client
โปรแกรมฝง database
Config ip / sub-net mask
![Page 81: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/81.jpg)
5. Use Case Model
• Use case diagram แผนภาพยสเคส
• Use case description ค าอธบายยสเคส
• Use Case แปลตรงตวมความหมายวา กรณของการใชงานทเกดจากมมมองของผใชระบบ ตวอยางงายๆ ของ Use Case กคอ
- Create Order (ท าการลงใบสงซอสนคา)
- Modify Order (ท าการเปลยนแปลงหรอแกไขใบสงซอสนคา)
- Delete Order (ท าการลบใบสงซอสนคา)
Use case จะใชในการเกบ Requirement
*** จะอยในเฟส Inception , Elaboration Phase
Use case จะอยในคมอทางดานเทคนค เชนเดยวกนกบ component และ deployment
![Page 82: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/82.jpg)
4. Use Case Diagram
• Use Case อาจหมายถง การอธบายฟงกชนการท างานตางๆ ของระบบน นเอง
• Use Case Diagram จะแสดงแผนผงการใชงานของระบบ โดยมองคประกอบ 2 สวนคอ actor และ use case
![Page 83: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/83.jpg)
4. Use case Diagram
แสดงความสามารถหรอพฤตกรรมของระบบทผใชคาดหวง
Actor
Actor (ผใชระบบ)
Someone/something ทอยนอกระบบทโตตอบกบระบบ
Use Case name
Use case
ชดของการกระท าทท าโดยระบบซงให ผลลพธทมคณคาตอผใช
Communicates-Association
Communicates-Association
สายการสอสาร แทนชดการกระท าทงหมด
![Page 84: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/84.jpg)
System Boudary
![Page 85: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/85.jpg)
Use-Case Diagram
Bank Consortium
BankCustomer
Deposit Funds
Withdraw Cash
An Automated Teller Machine (ATM)
Transfer Funds
Cashier
Maintain ATM MaintenanceCrew
Collect Deposits
RTF/LMF
กลมธนาคาร ไดแก ไทยพานชย ทหารไทย กรงเทพ ฯลฯ
![Page 86: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/86.jpg)
Use-Case Diagram
Bank Consortium
BankCustomer
Deposit Funds
Withdraw Cash
An Automated Teller Machine (ATM)
Transfer Funds
Cashier
Maintain ATM MaintenanceCrew
Collect Deposits
RTF/LMF
กลมธนาคาร ไดแก ไทยพานชย ทหารไทย กรงเทพ ฯลฯ
![Page 87: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/87.jpg)
A Use Case Diagram
Establish
Credit
<<include>>
Trader
Validate
Client
<<include>>
Place
Order
<<extend>>Financial
Officer
Track
Order
Retinal
Scan
Check
Password
Place
Rush
Order
Stock
Exchange
<<include>>
Broker Stock
ตย. การเขยนยสเคสในการซอขายหนในตลาดหลกทรพย
![Page 88: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/88.jpg)
6. แผนภาพล าดบ Sequence Diagram
• Sequence Diagram จะแสดงการท างานของออบเจกตตางๆ เมอเกดการสงขาวสารหรอ message และเมอเกดเหตการณตางๆ โดยทศทางของลกศรจะเปนการบงบอกถงทศทางการสง messageระหวางออบเจกต
![Page 89: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/89.jpg)
A Sequence Diagram
: Student registration form
registration manager
math 101
1: fill in info
2: submit
3: add course(joe, math 01)
4: are you open?5: are you open?
6: add (joe)
7: add (joe)
math 101 section 1
ถำงำนใดทเนน ล ำดบ เวลำ ท ำกอนหลว หรอ Requirement ใด อะไรท ำกอน-หลง ให ใช Sequence Diagram
Create new student()
…Destroy
กรณผานเวบก คลกป ม submit Message : joe , math101 if(Math101.isOpen()) { …}
[count <=10]
หนาท เปนของโปรแกรมเมอร กบ Tester
![Page 90: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/90.jpg)
Math
Unit : String
3(3-0-6)
+ Add(stdname:String,stdID:String,semester:String)+ Drop()
3(2-2)
1/2561
![Page 91: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/91.jpg)
7. Collaboration Diagram
• Collaboration Diagram จะแสดงการตดตอสอสารระหวางออบเจกตตางๆ และความสมพนธระหวางทแตละออบเจกตตดตอสอสารกน
Collaboration Diagram >> Communication Diagram
![Page 92: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/92.jpg)
A Collaboration Diagram
: Registrar
course form : CourseForm
theManager : CurriculumManageraCourse :
Course
1: set course info2: process
3: add course
4: new course
เนนท กำรบรหำรจดกำร งำนใด หรอ Requirement ใด ตองกำรบรหำรจดกำร ให ใช Collaboration Diagram
จนท ด าเนนการ สราง Course เรยนขนมา โดยระบรายละเอยดของคอรส ตามแบบฟอรม
กรรมการหลกสตร
![Page 93: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/93.jpg)
7. Collaboration Diagram
:aPrinterServer
:aComputer
:aPrinter
:aQueue
1 : Print (file)
[printer busy ]1.2 : Store (file)
[printer free] 1.1 :Print (file)
collaboration diagram แสดงความเกยวพนของ objects ตางๆ ทตองท างานรวมกน
เนนท กำรบรหำรจดกำร งำนใด หรอ Requirement ใด ตองกำรบรหำรจดกำร ให ใช Collaboration Diagram
กรณ น จะดพรนเตอร วำง หรอไมวำง และ จะจดกำรอยำงไร กใช collaboration diagram
![Page 94: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/94.jpg)
8. State-Transition Diagram
State-Transition Diagram ท าหนาทตอไปน
• แสดงวงจรชวตของออบเจกต ระบบยอยตางๆ และระบบโดยรวม
• บงบอกวาเหตการณตางๆ จะสงผลกระทบใหเกดอะไรขนบางในระบบ
• อาจมจดเร มตนและจดจบไดหลายจด
![Page 95: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/95.jpg)
A State-Transition Diagram
InitializationOpen
entry: Register studentexit: Increment count
Closed
Canceled
do: Initialize course
do: Finalize course
do: Notify registered students
Add Student / Set count = 0
Add student[ count < 10 ]
[ count = 10 ]
Cancel
Cancel
Cancel
เรมตน
สนสด
จากรปน สถานะของคอรสเรยนม 4 สถานะ
Count = 11
![Page 96: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/96.jpg)
State Diagram
go up(floor)
go up(floor)
Onfirst floor
Moving to firstfloor
Arrive atfirst floor
MovingUp
Movingdown
Idle
Arriveat floor
go down(floor)
state diagram แสดงสถาณภาพ (state) ทเปนไปไดของ object ใดๆ รวมทงแสดงเหตการณ (event) ทท าใหเกดการเปลยนสภาพของ object
![Page 97: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/97.jpg)
• ใชส าหรบ– อธบาย กระแสการไหลของการท างาน (workflow)– แสดงขนตอนการท างานของระบบ
• แตละขนตอนการท างาน เรยกวา Activity ตวอยาง ไดแก– การค านวณผลลพธบางอยาง– การเปลยนแปลงสถานะ (State) ของระบบ– การสงคากลบคน – การสงสญญาณ– การเรยกใหโอเปอรเรชนอนๆ ท างาน– การสราง หรอ ท าลายวตถ
9. Activity diagramFlowchart in traditional approaches
![Page 98: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/98.jpg)
Activity Diagram
activity diagram แสดงล าดบกระแสของกจกรรมของการท างานใดๆเชน ขนตอนการท า operation ขนตอนการลงทะเบยน
Initial State
Final State
ActionState1 Action State
Transition (Fork)
Transition (Join)
Control Flow
Decision
Partition1
Swimlane
Note
ActionState1
![Page 99: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/99.jpg)
ตย. Activity Diagram แสดงการท างานของ operation ‘print’
ShowMessageBox“Disk full” on screen
ShowMessageBox“Printing” onscreen
Create postscriptfile
RomoveMessageBox
^Printer.Print(file)
PrintFile()
[disk full]
[free disk space]
เงอนไข full ไมสามารถสงพมพได
ระบบ แบบ Realtime / ระบบ control ซงจากตวอยาง จะเปนระบบ control การสงพมพไฟลเอกสาร ในเครองพมพ
![Page 100: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/100.jpg)
ต.ย. Activity Diagram แสดงการโครงการส านกทางหลวงพเศษระหวางเมองผรบจาง
ส ารวจขอมล/ ศกษาวเคราะหการลงบญชในปจจบน
ทบทวน/ตรวจสอบรายงาน
ออกแบบงานบญช
ออกแบบระบบสารสนเทศ
ทบทวน/ตรวจสอบรายงาน
พฒนาระบบสารสนเทศฐานขอมลบญช
ทดสอบระบบ
ท ารายงานฉบบสมบรณ
ตรวจรบระบบ
รบจางพฒนาซอฟตแวรทางบญช
![Page 101: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/101.jpg)
An Activity Diagram
ShowMessageBox“Printing” on Screen
Create postscriptfile
Send postscriptfile to printer
RemoveMessageBox
displayer samplerSwimlane Example
Ordinary Example
![Page 102: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/102.jpg)
Class
Attributes
Operations
Node
Use Case
Object
Attributes
Operations
State
Interface
ComponentNotePackage
Model Elements
![Page 103: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/103.jpg)
Aggregation ( a form of Association)
Association
Generalization
Dependency
![Page 104: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/104.jpg)
General Mechanisms
เครองประดบ (Adornments)
UML มกลไกส าหรบการให information เพมเตมเขาไปในทกประเภทของแผนภาพ โดยเฉพาะ information น นไมสามารถสอสารไดโดยใชสญลกษณพนฐานของ UML ทม
โนต (Notes)
ขอก าหนด (Specifications)
Extensibility Mechanism
แมพมพ (Stereotypes)
ตดปาย (Tagged value)
ขอจ ากด (Constraints)
![Page 105: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/105.jpg)
Adornments เพม information เขาไปในสญลกษณปกต
Stock Option
TheorPrice( )MarketPrice( )ExpireDate ( )
Using Black &Schole Formula
A note contains any additional information such as a simple comment
Stock Option
+TheorPrice( )#MarketPrice( )-ExpireDate ( )
![Page 106: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/106.jpg)
<<Actor>>Customer
Customer
Customer
The customer is a class with the stereotype <<Actor>>. The stereotypeadds extra semantics to the class; in this case, that the class represents an external user of the system
![Page 107: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/107.jpg)
Instrument{abstract}{author = “HEE”}{status = draft }
Value : intexpdate : Date
Properties on an Instrument class. Abstract is a predefined property; author and status are user defines tagged values
![Page 108: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/108.jpg)
SeniorCitizenGroup
{person.age > 60}
A constraint restricts which Person objects may participate in the association
Person
0..1
0..*
![Page 109: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/109.jpg)
Benefits of UML• เปนภาษามาตรฐานทใชในการสรางแบบจ าลองเชงวตถ โดยใช
รปภาพ (Standard Visual Modeling Language)
• ใชในการแลกเปลยนขอมล แบบจ าลองกนระหวางทมผพฒนา และระหวางผใช กบทมผพฒนา
• น าเสนอ และ สนบสนนหลกการเชงวตถไดครบถวน ชดเจน
• ไมผกตดกบภาษาโปรแกรม (Programming Language) ภาษาใดภาษาหนง
• สนบสนนการขยายขอบเขต และการปรบปรงระบบ โดยทไมจ าเปนตองลงมอพฒนาซอสโคดกอน
![Page 110: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/110.jpg)
Use Case Model
![Page 111: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/111.jpg)
System Analysis• กระบวนการวเคราะหระบบ (system analysis phase)
– มงเนน “what” ทระบบจะตองม และตองท าใหกบผใช ไมเนน “how” วาจะท าอยางไร
• กระบวนการวเคราะหความตองการของผใชระบบ (Requirement analysis phase)
– ใชในการสรางแบบจ าลองหนาทการท างานของระบบซอฟตแวร จากมมมองของผใชภายนอก หรอ ระบบภายนอก
– ไดแบบจ าลองของความตองการของผใชระบบ (Requirement Model) เปน Output
![Page 112: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/112.jpg)
System Analysis and Use Case• Use Case Model
– Use Case Model คอแบบจ าลองความตองการของระบบ ท น าเสนอ functional requirement ของระบบโดยรวม จากมมมองของผใชภายนอก หรอ ระบบภายนอก
– โดยจะท าหนาทในการระบพฤตกรรม หรอหนาทการท างานของระบบ (เนน “what”) ทระบบตองม
– ใชในการทดสอบ และตรวจสอบ โครงสราง และหนาทการท างานของระบบ
– ใน UML ระบเปน Use Case Description (Text) หรอ Use Case Diagram (Diagram)
![Page 113: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/113.jpg)
Use Case Example• Name: การสงรายการซอขายหลกทรพย (Place Order)
– Main flow of events:
1. Trader ปอนชอ และรหสของ client
2. System ตรวจสอบ (Validate) ชอ รหส และ credit ของ client
3. Trader ปอนรหสหลกทรพย จ านวนหลกทรพย และราคาหลกทรพย ท Client ตองการซอขาย
4. System ตรวจสอบเงอนไขราคาของหลกทรพย
6. System สง order ใหกบตลาดหลกทรพย
7. System เกบหมายเลข order ทไดรบจากตลาดหลกทรพย
8. System แจงให Trader ทราบ
Trader
Place Order
Stock
Exchange
Market
![Page 114: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/114.jpg)
Use Case Diagram
• น าเสนอ Use Case และการปฏสมพนธโตตอบกนระหวางระบบ และ ผใชภายนอก (อาจเปนคน หรอระบบกได)
• ประกอบดวย
– Use Case - ความสามารถ/หนาทของระบบ
– Actor - ผกระท า/ผใชงาน Use Case น นๆ
– Relationship - เสนแสดงความสมพนธระหวาง Use Case กบ Actor
– System - ระบบทก าลงพฒนา
![Page 115: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/115.jpg)
Use Case Modeling : Core Elements
Construct Description Syntax
use case A sequence of actions, including variants, that a system (or other entity) can perform, interacting with actors of the system.
actor A coherent set of roles that users of use cases play when interacting with these use cases.
system boundary
Represents the boundary between the physical system and the actors who interact with the physical system.
UseCaseName
ActorName
![Page 116: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/116.jpg)
Construct Description Syntax
association The participation of an actor in a use case. i.e., instance of an actor and instances of a use case communicate with each other.
generalization A taxonomic relationship between a more general use case and a more specific use case.
extend A relationship from an extension use case to a base use case, specifying how the behavior for the extension use case can be inserted into the behavior defined for the base use case.
Use Case Modeling : Core Relationships
<<extend>>
![Page 117: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/117.jpg)
Construct Description Syntax
include An relationship from a base use caseto an inclusion use case, specifyinghow the behavior for the inclusion usecase is inserted into the behaviordefined for the base use case.
Use Case Modeling : Core Relationships (cont’d)
<<include>>
![Page 118: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/118.jpg)
Use Cases v.s. Scenario
• Use Case
– ความสามารถ หรอ หนาทการท างานของระบบ
– แตละ Use Case แทนชดของ transactions ทระบบท างานโตตอบกบ ผใชงาน หรอระบบอนๆ ภายนอก
• Scenario
– สถานการณ หรอตวอยางเรองราวการใชงานระบบ
– Scenario จดเปน instance ของ use case
– เชน
withdrawal cash
a user withdrawals$200
![Page 119: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/119.jpg)
Actors• Actor หมายถง someone หรอ some thing ทมการปฏสมพนธ โตตอบกบระบบ
– สงใดกตามทมความตองการในการแลกเปลยนinformation กบระบบ หรอ สงใดกตามทอยภายนอกระบบ และมการใชงาน Use Case ของระบบ
– ก าหนดบทบาทหนาทของผใชระบบ
– ก าหนดการเชอมโยงกบระบบอนๆ ภายนอก
• ตวอยางของ Actors– Customer -- maintain their account– Cashier -- verify withdrawal amount
Customer Cashier
![Page 120: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/120.jpg)
Actors
• Actors สามารถอธบายโดยใช Specialization Relationship
• อาจพจารณา Actors เปนคลาส ใน UML เนองจากมrelationships เชนเดยวกบทคลาสม
specialization relationship
Customer
ATM Customer Cashier Customer
![Page 121: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/121.jpg)
Actors• เชอมตอกบ use cases โดยใชเสนแสดงความเกยวของ ปฏสมพนธ(association)
• association = ความสมพนธท มการตดตอสอสารกน(ท งการรบ และสง messages ใหแกกนและกน)
• ใช generalization relationships อธบายความสมพนธ ระหวาง actors ไมจ าเปนตองอธบายรายละเอยดของ Association เนองจากไมมการ Implement สวนของ Actor ในระบบ
Customerwithdrawal cash
![Page 122: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/122.jpg)
System• System
– อาจหมายถง Software system, business, hardware,..
– วตถประสงคใน use-case modeling เพอระบขอบเขตของระบบทก าลงพฒนา (system boundary)
• ใชสญลกษณ
System
![Page 123: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/123.jpg)
Relationships between Use Case
• Extends : เปน generalization relationships ในกรณทUse Case หนงๆ ขยาย (extends) Use Case อน โดยการเพมการกระท า (actions)
• Includes/Uses : เปน generalization relationship ในกรณท Use Case หนงๆ เรยกใช (uses) Use Case อน ทพจารณาใหเปนสวนหนงของ Use Case น นๆ
![Page 124: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/124.jpg)
Generalization Relationship
• Child Use case รบถายทอดคณสมบตมาจาก Parent Use Case
• Child สามารถเปลยนแปลงพฤตกรรมทรบจาก Parent หรอเพมเต มพฤตกรรม
• Child อาจน าไปแทนท ในทๆ Parent ปรากฏ
Validate
client
Check
password
Retinal
scan
![Page 125: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/125.jpg)
“Include” relationship
• มกใชในการหลกเลยงการอธบายการไหลของเหตการณ (flow of events) เดม ซ ากนหลายๆ คร ง โดยรวบรวมพฤตกรรมรวม ใน Use Case
• หลกเลยงการ copy & paste ของ Use Case Descriptions
Validate
clientPlace
order
<<include>>
Track
order
<<include>>
![Page 126: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/126.jpg)
“Include” Example• Name : การตรวจสอบรายการซอขายหลกทรพย
(Track Order) – Main flow:
1. ใชหมายเลข order ในการตรวจสอบ ทไดรบจากตลาดหลกทรพยObtain and verify order number
2. Include สวนของ “Validate client”
3. ในแตละสวนของ Order …
Track Order Validate
Client
<<include>>
![Page 127: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/127.jpg)
“Extend” relationship
• ใชสรางแบบจ าลองบางสวนของ Use Case ท user อาจมองเปน optional
• ใช สรางแบบจ าลอง conditional subflows
• ใชในการแทรก subflows ในจดทระบโดยพจารณา ปฏสมพนธระหวาง Actors
<<extend>>
(set priority)
Place order
Extension points:
Set priority
Place rush
order
![Page 128: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/128.jpg)
“Extend” Example• Name : การสงรายการซอขายหลกทรพย (Place Order)
– Main flow of events:1. …2. Trader ปอนเงอนไขของหลกทรพย ท Client ตองการซอขาย
3. ก าหนดล าดบความส าคญ โดย (set priority)4. System สง order ใหกบตลาดหลกทรพย5. ...
Place OrderPlace Rush
Order
<<extend>>
![Page 129: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/129.jpg)
Relationships between Use Case
Withdrawal
Cash
Validate
Account
<<include>>
Ship Partial
Order
Ship Order
<<extend>>
![Page 130: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/130.jpg)
Comparing extends/uses
• extend
– ใชแยกความแตกตางของ Use Case
– actors ทเกยวของมกเปนคนกระท า Use case และUse Case ทextend ท งหมด
– actor มกเชอมตอกบ “base” Use Case
• include/use
– ใช extract พฤตกรรมรวม
– มกไมม actor เกยวของโดยตรงกบ Use Case ทม พฤตกรรมรวม
– actors ทแตกตางกน for “caller” use cases possible
![Page 131: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/131.jpg)
A Use Case Diagram
Establis
h
Credit
<<include>>
Trader
Validate
Client
<<include>>
Place
Order
<<extend>>Financial
Officer
Track
Order
Retinal
Scan
Check
Password
Place
Rush
Order
Stock
Exchange
<<include>>
![Page 132: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/132.jpg)
A Use Case Diagram
<<include>>
Customer
Validate
Account
<<include>>
Bank
Teller
Deposit
Balance
Checking
Transfe
r
Withdraw
Verify
withdrawal
<<include>>
![Page 133: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/133.jpg)
When and how?• Requirements capture
– ใชในการก าหนด Reuqirement ของระบบ
– สรางแบบจ าลอง (Model) ของ User requirements ดวย Use Case
• Test Scenarios
– สรางแบบจ าลอง (Model) ของสถานการณการทดสอบระบบ (test scenarios) ดวย Use Case
• Use Case:
ระบส งท customer ตองการใหมในระบบ
– ต งชอให Use Case
– เขยนค าอธบายส นๆ
– เพมรายละเอยดในภายหลง
![Page 134: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/134.jpg)
Finding Actors• สามารถระบ actor ไดโดยตอบค าถามตอไปน
– ใครเปนคนใชงานหนาทการท างานหลกของระบบ (primary actors)?– ใครตองการการสนบสนนการท างานจากระบบ?– ใครตองการบ ารงรกษา และบรหารระบบ (secondary actors)?– Hardware devices ใดทตองการใหระบบจดการดแล?– ระบบภายนอกระบบใดท ตองการใหระบบมปฏสมพนธดวย?– ใคร หรอ อะไรทตองการไดรบผลประโยชน จาก output ของระบบ?
• Tips– ไมควรพจารณาเฉพาะ users ทใชงานระบบโดยตรง แต พจารณา
users อนๆ ทตองการใชบรการจากระบบดวย
![Page 135: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/135.jpg)
Finding Use Cases• ส าหรบแตละ actor ตอบค าถามตอไปน
– หนาทการท างานอะไรท actor ตองการจากระบบ?– ขอมลใดบางท actor ตองการสราง อาน ลบ เปลยนแปลง หรอเกบอยภายในระบบ?
– เหตการณใดบางทระบบตองแจงให actor ทราบ? หรอ actor ตองแจงใหระบบทราบ?
– หนาทการท างานของระบบ ชวยท าใหงานประจ าวนของ actor งายขนหรอไม?
• ถาไมพจารณา actors– อะไรคอ input/output ของระบบ ? input/output เหลาน นมาจากไหน หรอใครเปนคนน าไปใชงาน?
– ปญหาหลกของระบบทใชงานอย คออะไร?
![Page 136: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/136.jpg)
Recipe (เทคนค)
• ระบ actors ทมปฏสมพนธกบระบบ
• พจารณาแนวทางของระบบ ในการปฏสมพนธกบactors
• จ าแนกพฤตกรรมของระบบใน การปฏสมพนธกบactors ใหเปน use cases โดยก าหนดความสมพนธระหวาง Use Case
![Page 137: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/137.jpg)
ตวอยางการเขยน Use case
![Page 138: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/138.jpg)
การเขยน Use caseองคประกอบมดงน
- ชอของ Use Case
- ภาพรวมของการท างาน (Overview)
- Actor หลก (Primary Actor)
- Actor รอง (Secondary Actor)
- จดเร มตน (Starting Point)
-จดสนสด (End point)
- การท างานของ Use Case (Flow of Events)
- การท างานของ Use Case เมอมปญหาเกดขน (Alternative flow of Events)
-ผลของการท างานของ Use Case (Measurable Result)
![Page 139: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/139.jpg)
Use Case : Create Orderภาพรวมของการท างาน (Overview)จดประสงคหลกของ Use Case น เพอท าการลงขอมลในใบสงซอสนคาจากลกคา
Actor หลก (Primary Actor)ตวแทนฝายขายสนคา
Actor รอง (Secondary Actor)ไมม
จดเร มตน (Starting Point)Use Case ตวนเรมตนเมอ Actor ตวแทนฝายขายสนคาขอให ระบบท าการลงขอมลการสงซอสนคา
จดสนสด (End point)ค าขอเพอท าการลงขอมลการสงซอสนคาเสรจสนสมบรณหรอไมกถกยกเลก
![Page 140: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/140.jpg)
Use Case : Create Order
การท างานของ Use Case (Flow of Events)
จาก User Interface บนจอเพอท าการลงขอมลการสงซอ Actorจะตองท าการใสขอมลเกยวกบการสงซอ เปนตนวา วนทลกคาตองการใหสนคาสงมอบถงมอ (Required Date) ปรมาณทตองการส งซอ (Quantity) ตองการใหสงมอบสนคาโดยบรษทสงสนคาไหน (ShipVia) ตองการใหใหสงมอบสนคาทไหน (ShipAddress) หลงจากนนแลว Actor สามารถเลอกทจะท าการบนทกขอมลลงไปไวในฐานขอมล หรอยกเลกการท างานทงหมด ถา Actor เลอกท าการบนทก ใบสงซอใบใหมกจะถกสรางขนมาในฐานขอมล
![Page 141: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/141.jpg)
Use Case : Create Order
การท างานของ Use Case เมอมปญหาเกดขน(Alternative Flow of Events)
ถาไมมสนคาทตองการอยในคลงสนคา ระบบจะตองแจงให Actor ทราบพรอมกนนนกตองยกเลกการท างานทเหลอของUse Case น
ผลของการท างานของ Use Case (Measurable Result)
จะมใบสงซอสนคาใหม 1 ใบขนมาในระบบ
![Page 142: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/142.jpg)
Cash Register Example
Use Case: Buy items
Actors: Customer, Cashier
Type: Primary
Description:A Customer arrives at a checkout with items to
purchase. The Cashier records the purchase items
and collects payment. On completion, the
Customer leaves with the items
![Page 143: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/143.jpg)
Expanded Use Case Example
Use Case: Buy Items with Cash
Actors: Customer (initiator), Cashier
Purpose: Capture a sale and its cash payment
Overview: A Customer arrives at a checkout with items to
purchase. The Cashier records the purchase items and collects a cash payment. Oncompletion, the Customer leaves with the
items.
Type: primary and essential
Cross references: R1.1, R1.2, R1.7
![Page 144: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/144.jpg)
Expanded Use Case (2)
1. This use case begins when a Customer arrives at the register with items to purchase.
2. The cashier records the identifier from each item. If more than one of the same item, the Cashier can enter the quantity as well.
4. Cashier indicates completion of item entry.
6. Cashier tells the Customer the total.
3. Determines the item price and adds the item information to the running sales transaction. The description and price of the item are presented.
5. Calculates and presents the sale total.
TYPICAL COURSE OF EVENTSACTOR ACTION SYSTEM RESPONSE
![Page 145: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/145.jpg)
Expanded Use Case (3)
7. The Customer gives a cash payment - possibly greater than the sale total.
8. The Cashier records the cash received amount.
10. The Cashier deposits the cash received and extracts the balance owing. Cashier gives balance and receipt to Customer.
12. Customer leaves with items purchased.
ACTOR ACTION SYSTEM RESPONSE
9. Show the balance due back to the Customer.Generates a receipt.
11. Logs the completed sale.
![Page 146: Last Update : 28/01/2561siam2dev.net/E_Learning/OOAD/Lec05_OOAD_UML_v2020... · •กาหนดสง่ก่อนสอบปลายภาค 1 สป. •สอบระหว่างภาค](https://reader034.vdocuments.site/reader034/viewer/2022042416/5f30e119b8fabd773c134a62/html5/thumbnails/146.jpg)
Expanded Use Case (4)
• Alternative Courses
• Line 2: Invalid identifier entered. Indicate error
• Line 7: Customer didn’t have enough cash. Cancel sales transaction
• If a Typical Course of Events has multiple equally likely courses of action
– indicate branches in Use case
– write a subsection for each branch indicating the typical course of events
– have alternatives for each subsection if necessary