1 Static Structural Diagrams System Analysis and Design

  • Slides: 78
Download presentation
1 Static Structural Diagrams การวเคราะหและออกแบบระบบ (System Analysis and Design)

1 Static Structural Diagrams การวเคราะหและออกแบบระบบ (System Analysis and Design)

Static Structural Diagrams 2 แสดงแผนภาพของคลาสทเชอมตอกนดวย ประเภทของ Static Structural Diagrams � class diagram : classifier

Static Structural Diagrams 2 แสดงแผนภาพของคลาสทเชอมตอกนดวย ประเภทของ Static Structural Diagrams � class diagram : classifier view � object instance diagram : instance view static relationships

Classes in UML 4 เขยนได 2 รปแบบ Class name Person Attributes attribute name :

Classes in UML 4 เขยนได 2 รปแบบ Class name Person Attributes attribute name : type Operations operation name(parameter : type) : result type Person - Tax. IDNo : String - Name : String + Income : double + Tax. Paid : Boolean + calc. Tax() + calc. Tax. Bal()

UML Syntax for Attributes 5 visibility name : type + id : String �

UML Syntax for Attributes 5 visibility name : type + id : String � visibility: public (+), protected (#), private (-) การตความไมขนกบ � name : เปน string � type : ประเภทของขอมล programming language dependent ไมขนกบภาษา

UML syntax for operations 6 visibility name (parameter list) : return-type-expression + assign. Agent

UML syntax for operations 6 visibility name (parameter list) : return-type-expression + assign. Agent (a : Agent) : Boolean � visibility: public (+), protected (#), private (-) การตความไมขนกบ � name : string programming language � parameter list : arguments � return-type-expression : ประเภทของคาท return ไมขนกบภาษา

Objects in UML 9 เขยนได 2 รปแบบ Object name Tim: Person Attributes attribute name

Objects in UML 9 เขยนได 2 รปแบบ Object name Tim: Person Attributes attribute name : type = value Same Operations for all instances of a class Tim : Person Tax. IDNo=“ 23003” Name=“Tim. Lim” Income=“ 30000. 00” Tax. Paid = FALSE calc. Tax() calc. Tax. Bal()

ตวอยาง Object Instance Diagram 10 Sydney: City Name=Sydney Country=Australia Population= 3, 536, 000 London:

ตวอยาง Object Instance Diagram 10 Sydney: City Name=Sydney Country=Australia Population= 3, 536, 000 London: City Name=London Country=UK Population= 2, 324, 320 New York : City Name=New York Country=USA Population= 5, 734, 012

Classes and Objects 11 City Name : String = default Country : String =

Classes and Objects 11 City Name : String = default Country : String = default Population : integer = default set. Name (s : String = deault) set. Population(p : integer = default) <<instance. Of>> London : City New York : City Sydney : City Name = London Country = UK Population =2, 324, 320 Name = New York Country = USA Name = Sydney Country = Australia Population =5, 734, 012 Population =3, 536, 000

ประเภทความสมพนธของ 12 Associations Generalization และ Classification Aggregation Class Diagrams

ประเภทความสมพนธของ 12 Associations Generalization และ Classification Aggregation Class Diagrams

Association 13 ความสมพนธ (Relationship) ระหวาง instances ของ classes association name Order date. Received is.

Association 13 ความสมพนธ (Relationship) ระหวาง instances ของ classes association name Order date. Received is. Prepaid number : String * price : Money issued by dispatch( ) Customer may make several orders name direction Customer 1 name address credit. Rating( ) Order comes from one customer

Associations on Class Diagrams 16 Person Name Address Telephone Car Owns Manufacturer Model Registration

Associations on Class Diagrams 16 Person Name Address Telephone Car Owns Manufacturer Model Registration

Objects & Links 18 You: Person Me: Person Name=Jane Address=22 Holly Pl Telephone=62312198 Name=Dennis

Objects & Links 18 You: Person Me: Person Name=Jane Address=22 Holly Pl Telephone=62312198 Name=Dennis Address=41 High St Telephone=62661734 Owns Ours: Car Mine: Car Manufacturer=Mazda Model=626 Registration=YYX 391 Manufacturer=Saab Model=95 Registration=YRT 833

Association Multiplicity 19 multiplicity � หมายถง การพจารณาจำนวน instances (objects) ของคลาสหนง ทสามารถเชอมโยงกบ instance (object) ของคลาสทเกยวของ

Association Multiplicity 19 multiplicity � หมายถง การพจารณาจำนวน instances (objects) ของคลาสหนง ทสามารถเชอมโยงกบ instance (object) ของคลาสทเกยวของ Order date. Received is. Prepaid number : String price : Money dispatch( ) * 1 Customer name address credit. Rating( )

Association Multiplicity 20 1 Class exactly one 1. . * * Class many (zero

Association Multiplicity 20 1 Class exactly one 1. . * * Class many (zero or more) 0. . 1 Class one or more 2. . 4 Class zero or one/at most one Class as specified

Example of Multiplicities 21 Student Body * * 1 1 Heart 1 2 -3

Example of Multiplicities 21 Student Body * * 1 1 Heart 1 2 -3 Bicycle Account University Wheel * * Owner

Role names 24 Role ระบ ชอใหกบดานปลายของ Company Name Address association Works for employer *

Role names 24 Role ระบ ชอใหกบดานปลายของ Company Name Address association Works for employer * employee Role names Person Name Insurance no. Address

A Reflexive Association 27 association ทสรางจากคลาสเดยวกน Person Name Address Telephone * Child Parent 2

A Reflexive Association 27 association ทสรางจากคลาสเดยวกน Person Name Address Telephone * Child Parent 2 Role name

Ternary Associations 29 Vendor Customer Sale Ternary association Product

Ternary Associations 29 Vendor Customer Sale Ternary association Product

Ternary Association Multiplicity 30 multiplicity ของ ternary associations ซบซอนกวา binary และ unary associations มกเปน

Ternary Association Multiplicity 30 multiplicity ของ ternary associations ซบซอนกวา binary และ unary associations มกเปน แบบ “many” สำหรบคลาสทเกยวของ participating

Summary: Basic notation for associations 32 Class B mult 1 Association name role_B mult

Summary: Basic notation for associations 32 Class B mult 1 Association name role_B mult 2 role_A Class B • ������ Order 1 contains * line items Order Line

Association Classes 34 Student ID Name Address Telephone Enrolment * Subject Code * Name

Association Classes 34 Student ID Name Address Telephone Enrolment * Subject Code * Name Credit Result Mark Association class

Association Classes 35 association class สามารถมสวนรวมใน เชนเดยวกบทคลาสปกตสามารถมได Customer Name Address Telephone 0. . 1

Association Classes 35 association class สามารถมสวนรวมใน เชนเดยวกบทคลาสปกตสามารถมได Customer Name Address Telephone 0. . 1 Claim * Purchase Guarantee Date Length * Conditions associations อนๆ Product * Number Name Price Association class

Qualified Associations 36 qualified association � หมายถง association ทถกทำใหชดเจนโดย attribute ทเรยกวา qualifier � พจารณา

Qualified Associations 36 qualified association � หมายถง association ทถกทำใหชดเจนโดย attribute ทเรยกวา qualifier � พจารณา qualified association เชนเดยวกบแนวคดของ weak entity type ใน ER

Qualified Associations 37 Unqualified Golf_Course Name 1 Location Hole Number * Length Par Qualified

Qualified Associations 37 Unqualified Golf_Course Name 1 Location Hole Number * Length Par Qualified Golf_Course Name Location Hole 0. . 1 Length Hole. Number 1 Par http: //www. siam 2 dev. com

Qualified Association 38 Tournament Year Position 0. . 1 Prize

Qualified Association 38 Tournament Year Position 0. . 1 Prize

Qualified association 39 Company Function Organization Person * ABC Inc. XYZ Inc. President Vice

Qualified association 39 Company Function Organization Person * ABC Inc. XYZ Inc. President Vice President Finances Member of board President Roger Rabbit Joe Savemoney John Walker Susi Sanssouci Karl Eichbaum Donald Duck

41 Difference between attributes and associations ความแตกตางระหวาง แอตทรบวตกบ ความสมพนธ Conceptual perspective � ไมแตกตางกนมากนก �

41 Difference between attributes and associations ความแตกตางระหวาง แอตทรบวตกบ ความสมพนธ Conceptual perspective � ไมแตกตางกนมากนก � Attributes เกบคาเดยว (single-valued) Specification/implementation perspective � Attribute เกบคา (Value) ไมใชตวอางอง (References) ไมมการ share สวนของ attribute values ในระหวาง instances ทสรางจากคลาสเดยวกน Often: Stores simple objects � Numbers, Strings, Dates, Money objects

Superclasses and Subclasses 44 “Superclass” มคำนยาม attributes, operations และ associations รวมกนกบ “subclasses” ของคลาสนนๆ “Subclasses”

Superclasses and Subclasses 44 “Superclass” มคำนยาม attributes, operations และ associations รวมกนกบ “subclasses” ของคลาสนนๆ “Subclasses” ม attributes, operations และ associations เฉพาะเปนของตวเอง โดยเลอกทจะกำหนดนยามใหมใหกบ attribute, operation หรอ relationship ทรบมาจาก “superclass” หรอไมกได

A Generalization Hierarchy 45 Superclass Ellipse Major_Axis Minor_Axis Geometric_Figure X_Position Y_Position Circle Radius Rectangle

A Generalization Hierarchy 45 Superclass Ellipse Major_Axis Minor_Axis Geometric_Figure X_Position Y_Position Circle Radius Rectangle Width Height Subclasses http: //www. siam 2 dev. com

Single & Multiple Inheritance 46 generalizations มกเกดใน class hierarchies ทแตละ “subclass” มเพยง 1 “superclass”

Single & Multiple Inheritance 46 generalizations มกเกดใน class hierarchies ทแตละ “subclass” มเพยง 1 “superclass” - เรยกวา “single inheritance” แตมบางสถานการณท “subclass” อาจมไดมากกวา 1 “superclass” เรยกวา “multiple inheritance”

Multiple Inheritance 47 Employee General. Staff Prof. Staff Full. Time Academic Part. Time Subclass

Multiple Inheritance 47 Employee General. Staff Prof. Staff Full. Time Academic Part. Time Subclass with two superclasses http: //www. siam 2 dev. com

Multiple Inheritance 48 Vehicle Furniture Wheelchair http: //www. siam 2 dev. com

Multiple Inheritance 48 Vehicle Furniture Wheelchair http: //www. siam 2 dev. com

Generalization and Classification (= is_a? ) 50 1. Shep is a Border Collie. 2.

Generalization and Classification (= is_a? ) 50 1. Shep is a Border Collie. 2. A Border Collie is a Dog. 3. Dogs are Animals 4. A Border Collie is a Breed. 5. Dog is a Species Collie : : สนขสายพนธหนงของสกอต แลนด Breed : : สตวทออกลกเปนตว 1+2: Shep is a Dog 1+2+3: Shep is a animal 1+4: Shep is a breed? ? ? 2+5: A Border Collie is a Species? ? ? Generalization is transitive (is kind of) Classification is not transitive (is instance of)

Notation for aggregation 52 Class A ���� Class B Class C http: //www. siam

Notation for aggregation 52 Class A ���� Class B Class C http: //www. siam 2 dev. com

Example : Aggregation 53 1 * Chapter Front 1 Title Aggregation 1 1 Book

Example : Aggregation 53 1 * Chapter Front 1 Title Aggregation 1 1 Book 1 0. . 1 Preface 0. . 1 End * Appendix 1 1 0. . 1 Index http: //www. siam 2 dev. com

Example : Aggregation 54 Company * Unit * Department * works for * Employee

Example : Aggregation 54 Company * Unit * Department * works for * Employee Group

Aggregation and composition 57 Polygon Aggregation 0. . 1 1 Composition 1 3. .

Aggregation and composition 57 Polygon Aggregation 0. . 1 1 Composition 1 3. . * Point Graphics Bundle color texture

Class Diagram - Example 60 A zoo consists of a set of cages. agreegation

Class Diagram - Example 60 A zoo consists of a set of cages. agreegation Every cage is the home of at least 2 animals. assosiation Cages are located besides each other. Every cage has at most one left neighbor and at most one right neighbor. Animals can be reptiles, insects, and mammals. Generlysation จดกลมของสงมชวต Mammals are elephants, monkeys, and tigers. Generlysation จดกลมของสงมชวต Monkeys eat bananas. assosiation Tigers prefer meat. grenerlysation

Class Diagram 61 Schedule. Algorithm Registration. Form Registration. Manager add. Student(Course, Student. Info) name

Class Diagram 61 Schedule. Algorithm Registration. Form Registration. Manager add. Student(Course, Student. Info) name number. Credits open() add. Student(Student. Info) Student name major Professor name tenure. Status Course. Offering location open() add. Student(Student. Info)

Class Diagram: Notation Summary 62 (stereotype) Classname {abstract} signature attribute: Type $class_attribute: Type =

Class Diagram: Notation Summary 62 (stereotype) Classname {abstract} signature attribute: Type $class_attribute: Type = Default_value 1 Association_name {constraint} operation {abstract} operation (arg 1: Type): Type $class_operation discriminators Composite. Classname * attribute: Type Role_name operation Qualifier Association Classname association_attrib: Type Sub. Classname 1 Sub. Classname 2 attribute: Type operation Component. Classname attribute: Type operation

Class Diagram: Notation Summary (cont’d) 63 formal_arg Parameterised Instantiated Class. Name Instantiates Class. Name<actual_arg>

Class Diagram: Notation Summary (cont’d) 63 formal_arg Parameterised Instantiated Class. Name Instantiates Class. Name<actual_arg> Class. Name 1{constraint} Uitlity attribute: Type operation(arg: Type): Type Class. Name 2 Class. Name 3 Category. Name inheritance association instantiation has by-value + # null / public protected private unspecified derived has by-reference ternary Sub. Category 1 dependency Class. Name: access Notes Sub. Category 2 Category. Name (Public Interface)

78

78