the unified modelling lanage (uml)

30
The Unified Modelling Language (UML) อาจารย์สมเกียรติ ช่อเหมือน ([email protected]) สาขาวิชาวิศวกรรมซอฟต์แวร์ คณะวิทยาศาสตร์และเทคโนโลยี

Upload: cc-nakhon-pathom-rajabhat-university

Post on 21-Mar-2017

37 views

Category:

Education


1 download

TRANSCRIPT

Page 1: The Unified Modelling Lanage (UML)

The Unified Modelling Language (UML)

อาจารย์สมเกียรติ ช่อเหมือน ([email protected])สาขาวิชาวิศวกรรมซอฟต์แวร์ คณะวิทยาศาสตร์และเทคโนโลยี

Page 2: The Unified Modelling Lanage (UML)

The Unified Modelling Language (UML)

• An introduction to UMLUML Class DiagramsUML SyntaxUML Package DiagramsUML Object diagramsUML Sequence Diagrams

Page 3: The Unified Modelling Lanage (UML)

UML (Unified Modelling Language)

• การสร้างแบบจ าลองซอฟต์แวร์ ในรูปของสัญลักษณ์ • เพื่อใช้ในการอธิบายระเบียบวิธีการ • เข้าใจล าดับขั้นตอนในการท างานให้บรรลุผล• จัดล าดับของกิจกรรมเพื่อรวบรวมความต้องการของผู้ใช้• กระบวนการเขียน Diagram โดยใช้ สัญลักษณ์ในการออกแบบซอฟต์แวร์

น าเสนอ และตกลงร่วมกัน• ใช้แผนภาพประกอบเพื่อช่วยให้เข้าใจได้ง่าย และอธิบายข้อมูลทางเทคนิคให้

ถูกต้องตรงกันและชัดเจนขึ้น• น าไปใช้ในกระบวนต่อไปของการพัฒนาซอฟต์แวร์ได้• ไม่ใช้วิธีการ แต่เป็นสิ่งที่น าไปใช้ช่วยให้สามารถออกแบบและน าไปใช้ไดอ้ย่าง

ถูกต้อง ด้วยการสร้างแผนภาพ เพื่อเป็นแนวทางที่เหมาะสมตามความต้องการ

Page 4: The Unified Modelling Lanage (UML)

Class diagrams

• แผนภาพพ้ืนฐานของแนวคิดเชิงวัตถุ

• แสดงรายละเอียดของสิ่งต่างๆ

• แสดงความเกี่ยวข้องของสิ่งต่างๆ

• แสดงสถาปัตยกรรมของระบบ

Page 5: The Unified Modelling Lanage (UML)

Class diagrams

• Class ชั้นประกอบด้วย– ชื่อไม่ซ้ ากัน (*ขึ้นต้นด้วยตัวพิมพ์ใหญ)่– รายการแอตทริบิวต์– รายการของวิธีการ

• การมองเห็นและการเข้าถึงจากภายนอก (visibility modifiers)– private Attributes– public methods

• ทราบถึงข้อมูลที่สนใจและสามารถตัดสว่นที่ไม่สนใจออกได้• บาง Class จะเรียกใช้งาน Classอื่น ๆ • ความสัมพันธ์เหล่านี้จะแสดงโดยลูกศร

Page 6: The Unified Modelling Lanage (UML)

Class diagrams

• Classes– - attributes– - operations– - visibility

• Relationships– - navigability– - multiplicity– - dependency– - aggregation– - composition

• Generalization / specialization– - inheritance– - interfaces

• Keywords• Notes and Comments

Page 7: The Unified Modelling Lanage (UML)

UML Syntax

• Visibility‘+’ public

‘-’ private

‘#’ protected

‘~’ package

• Multiplicity is one‘n’ exactly n

‘*’ zero or more

‘m..‘n’ between m and n

Page 8: The Unified Modelling Lanage (UML)

UML Syntax

• Visibility‘+’ public

‘-’ private

‘#’ protected

‘~’ package

• Multiplicity is one‘n’ exactly n

‘*’ zero or more

‘m..‘n’ between m and n

Page 9: The Unified Modelling Lanage (UML)

Examples of attributes

• visibility name (par1 : type1, par2 : type2): returntype

- custRef : int [1]

# itemCodes : String [1..*]

validCard : boolean

Page 10: The Unified Modelling Lanage (UML)

Examples of method

• + addName (newName : String) : boolean

Page 11: The Unified Modelling Lanage (UML)

relationships between classes

• ‘Association’

multiplicity

‘source’ class points to the ‘target’

Page 12: The Unified Modelling Lanage (UML)

Relationships between classes

• The diagram below shows this information

• All class names begin in uppercase• attribute and method names begin in lowercase.

• class ItemForSale describes a single item• ‘listOfItems’ list of zero or more individual objects

Page 13: The Unified Modelling Lanage (UML)

Types of Association

• Dependency

• Simple association

• Bidirectional association

• Aggregation and

• Composition

Page 14: The Unified Modelling Lanage (UML)

Inheritance

การ คลาส A สืบทอดมาจากคลาส B

Page 15: The Unified Modelling Lanage (UML)

Interfaces

• implemented by Publication• required by CashTill

<<realizes>>

“ball and socket” in UML2

Page 16: The Unified Modelling Lanage (UML)

Notes

Page 17: The Unified Modelling Lanage (UML)

elements of UML Class Diagram notation

Page 18: The Unified Modelling Lanage (UML)

elements of UML Class Diagram notation

Page 19: The Unified Modelling Lanage (UML)

Package Diagrams

Page 20: The Unified Modelling Lanage (UML)

Package Naming

• package names are normally in lowercase• local individual projects packages

– Mysystem– mysystem.interface– mysystem.engine– mysystem.engine.util– mysystem.database

• based on URL

Page 21: The Unified Modelling Lanage (UML)

Package Diagram

• Dependency arrows have been drawn to highlight relationships betweenpackages. When more thought has been put into determining these relationships theymay turn out to be associations

Page 22: The Unified Modelling Lanage (UML)

UML Object Diagrams

• objectName : ClassName

• attribute = value

Page 23: The Unified Modelling Lanage (UML)

Sequence Diagrams

actions taking place

Page 24: The Unified Modelling Lanage (UML)

Sequence Diagrams

• Selection and Iteration– The logic of a scenario often depends on selection (‘if’) and

iteration (loops).– There is a notation (‘interaction frames’) which allow ifs and

loops to be represented in sequencediagrams however these tend to make the diagrams cluttered.

– Sequence diagrams are generally best used for illustrating particular cases, with the full refinement reserved for the implementation code.

Page 25: The Unified Modelling Lanage (UML)

UML notation (สัญลักษณ์)

Page 26: The Unified Modelling Lanage (UML)

UML

Page 27: The Unified Modelling Lanage (UML)

https://www.google.co.th/url?sa=i&rct=j&q=&esrc=s&source=images&cd=&cad=rja&uact=8&ved=0ahUKEwi-wsj0kqbLAhXHCo4KHRWzDdcQjRwIBw&url=http%3A%2F%2Fwww.sedris.org%2Fdm_notn.htm&psig=AFQjCNHYZn1cgpz8DvGn-gXSSomANAKAPQ&ust=1457150162826343

Page 28: The Unified Modelling Lanage (UML)

สัญลักษณ์ที่ใช้ในการเขียน UML

Page 29: The Unified Modelling Lanage (UML)

UML class-object

Elephant

e1 e2

UML

new

Page 30: The Unified Modelling Lanage (UML)

สรุป

• UML เป็นภาษาที่ใช้ก าหนดรายละเอียดโดยใช้โมเดลด้านซอฟต์แวร์ เพื่อช่วยให้สามารถท างานร่วมกันได้ โดยยึดรูปแบบที่วิเคราะห์และออกแบบไว้ร่วมกัน

• แผนภาพแต่ละชนิดใช้ส าหรับแสดงรายละเอียดของซอฟต์แวร์แตกต่างกัน ท าให้สามารถเข้าใจโครงสร้างและสถาปัตยกรรมในการพัฒนาซอฟต์แวร์ได้

• สัญลักษณ์ที่น ามาใช้เป็นมาตรฐานเดียวกันในการวิเคราะห์และออกแบบเชิงวัตถุ