1 / 30

Key Terms

Key Terms. Basic aggregation association or-association ternary association association class attribute class class diagram composition. generalization link method multiplicity object anonymous object object diagram operation qualifier role. Key Terms. Advanced class

Download Presentation

Key Terms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Key Terms Basic • aggregation • association • or-association • ternary association • association class • attribute • class • class diagram • composition • generalization • link • method • multiplicity • object • anonymous object • object diagram • operation • qualifier • role

  2. KeyTerms Advanced • class • abstract class • concrete class • class multiplicity • constraint • dependency • instantiated parameterized class • interface • leaf element • navigation • polymorphic operation • refinement • root element • visibility • scope • class scope • instance scope • signature • template (parameterized class)

  3. Notation and Semantics Class name Attribute operation() Class (類別) – 是一群擁有相似結構、行為及關係的物件描述符號。 Attribute(屬性) – class/object 擁有的資料特徵。 如:年齡(attribute)是人(class)的資料特徵。 Operation (操作) – class/object的動態行為特徵。 如:push、pop(operation)是stack(class)的操作特徵。 Method(方法) – operation的implementation。

  4. Examples File Person Geometric object file name size in bytes last update name age color position move (delta: Vector) select (p : Point): Boolean rotate (angle) change-job change-address change-job change-address class

  5. Notation and Semantics Notation : Class name object Attribute=value Object name : Class name object operation() object Attribute=value Notation object operation() Object (物件) – 是一個Class的具體實例(Instance) ,所以Object的Notation、Attribute、Operation與link(Association)大致如同Class Diagram定義,但物件的Attribute可以指定value。 Anonymous Object(匿名物件) – 沒有名稱的物件。

  6. Example Polygon Center vertice borderColor fillColor Display() Triangle: Polygon Center = (0,0) vertice = ((0,0),(4,0),(4,3)) borderColor = black fillColor = white Display() class object

  7. Notation and Semantics Class B Window {abstract, Author=Joe, Status=tested} +size:Area=(100,100) #visibility:Boolean = invisible +default-size:Rectangle #maximum-size:Rectangle -xptr:Xwindow* +display() +Hide() +create() -attachXWindow(xwin:Xwindow*) Class diagram(類別圖) - 描述系統中的類別(Class),及類別之間的關連。 依設計需要可用三種層次的Notation表達類別: Details suppressed Analysis-level details Implementation-level details Class A Window Details suppressed Analysis-level details Implementation-level details

  8. Notation ,Semantics and Example A:classA B:classB L1:Line L2:Line P1:Point L3:Line L2 P2:Point L4:Line L3 L5 Line Point L5:Line L4 L1 Object diagram(物件圖) – 描述系統中的 Object,及Object之間的關連。 Notation Sample data Class diagram Object diagram

  9. Notation and Semantics {or} Association name class A class C class B Association(關連) - 當兩個或兩個以上的類別彼此之間有關係,我們使用Association來表達,若關係有方向性可用實心三角型標示。 • Or-association(or-關連) - 單一物件在同一時間中,面對多個Association時只能選擇一個。 • Ternary association (三元關連) - 類別之間除了兩個類別有相關,還可以三個或三個以上的類別有關係,中間以菱形相連接,彼此關係的表示方式與兩個類別時相同。

  10. Examples Owns Association (關連) Car Person Owned by Insurance contract Insurance company Or-association (or-關連) {or} Person Company Project Language Ternary association (三元關連) Person

  11. Examples Association Name accounting system :Project Cobol :Language Class-1 Class-2 role-1 role-2 role-3 Project Language Class-3 Mary :Person Person CAD program :Project C: Language Object diagram Class diagram Ternary association

  12. Association class(關連類別) - 具有class性質的association,也可當作是具有association性質的class。 註.在實際應用上,當二個類別是屬於多對多關係時,可使用關連類別來做為二者間的交流管道,使關連類別的primary key由二者的Foreign key所組成。 NOTE: 由於Association class亦代表了association本身,所以一個關連類別只可連接一個association。 Notation ,Semantics and Examples class1 class2 Job Description dateHired salary Association class Company Person Example

  13. Examples Access permission boss Works-for * * Manages Accessible by File User * Association class worker Association class

  14. Examples Team Year Pitcher Association class、Ternary association Wins loses Pitcher Team Year wins loses Harry Eisenstat Cleveland Indians 1939 6 7 Harry Eisenstat Detroit Tigers 1939 2 2 Wills Hudin Cleveland Indians 1939 9 10 Wills Hudin Cleveland Indians 1940 2 1 Wills Hudin Washington Senators 1940 1 2 Wills Hudin St.Louis Browns 1940 0 1

  15. More about Association Class: 當二個類別之間的關連可用左方二種方式表達時,上圖使用class association會是比較好的表達方式,因為它較能清楚表達salary 及 job title 只有在person works for company時才有意義。 Semantics and Examples Work-for * Person Company Name Social security no. address Name address Preferred form Salary Job title Work-for Company * Person Name address Name Social security no. Address Salary Job title Discouraged form

  16. Link(連結) - 當兩個或兩個以上的物件(object)彼此之間有關係,我們使用link來表達。一般而言,可將link視為association的實例。 Notation , Semantics and Examples A : typeA B : typeB Association Name Class Notation Class1 Class2 role-1 role-2 Ottawa : City Canada : Country Has-capital Has-capital Class diagram Country name City name Has-capital Object diagram France : Country Paris : City Dakar : City Senegal : Country Has-capital Notaton link、 association 之比較

  17. Notation and Semantics Association name Class A Class B Role name A Role name B Association name Class B Class A 1..* 0..* Roles(角色) - 類別扮演的角色及功用。 Multiplicity(數量性) - 用來表達Association中,某類別的一個具體實例(One Instance)可以對映到另一個類別多少數量的具體實例(Instance) 。 • 0,1,3..5,n 直接指定數量 • 0..* or *Zero or More,可以是0或是多個 • 1..*One or More,至少1個或是多個 • 0..1Zero or One,可以是0或1 Note. multiplicity省略時預設為1

  18. Examples : multiplicity <1> 1-to-1 relationship - optional on both sides : 0..1 - 0..1 married to Woman 0..1 Man 0..1 <2> 1-to-1 relationship - mandatory on both sides: 1 - 1 Secure Employee Employee 1 1 <3> many-to-many relationship - optional on both sides: * - * belongs to Person * Committee Committee member * <4> many-to-many relationship - mandatory on both sides: 1..* - 1..* member of Student Club 1..* 1..*

  19. Examples : multiplicity <5> 1-to-1 relationship - mandatory on one side: 0..1 - 1 Is a Person 1 Lawyer 0..1 Works for Department * Employee <6> 1-to-many relationship - optional on both sides: 0..1 - * 0..1 <7> 1-to-many relationship – mandatory on “one” side ,optional on “many” side: 0..1 - * Works for 1..* Department Employee 0..1 <8> 1-to-many relationship – optional /mandatory: 1 - * value from * Product type Product 1

  20. Examples : multiplicity <9> 1-to-many relationship – mandatory on both sides: 1 – 1..* 1..* Purchase Order PO Detail 1 <10> many-to-many relationship – mandatory on one side: * - 1..* member of * Club Student 1..* <11> other complex associations: 0..20 - * 0..20 Course offering Student is enrolled in * <12> other complex associations: 8..10 - 1 is a member of 8..10 Basketball Team Player 1

  21. Examples Work-for belongs to 1..* * Company employee employer Role、multiplicity Committee Membership * * Committee Multiplicity、association class (多對多關係的應用)

  22. Notation , Semantics and Example MicroSoft:Window A B X11 Window Window Mac Window text Editor Generalization(一般化) – 表達事物A的Attribute及Operation是繼承事物B。 Class generalization

  23. Examples Figure color center position pen thickness pen type move select rotate display Class generalization 0 Dimensional 2 Dimensional 1 Dimensional orientation fill type orientation scale fill scale Point Arc Spline Polygon Circle Line num of sides vertices control pts diameter radius start angle arc angle endpoints display display display display rotate display display

  24. Notation and Semantics B A A B aggregation (聚合關係) - 空心菱形表達整體 (whole) 類別B與部份 ( part ) 類別A之間存在 ( A Part-of B ) 與 ( B contained A)的關係,當整體類別B被刪除後,類別A依然存在。 composition (組合關係) – 另一種aggregation,強調組合,當整體類別B被刪除後,其它部份類別A也不存在。

  25. Examples Text * * List box * * Team Person Window Members * Button Composition Aggregation * Menu Microcomputer 1..* System box Monitor Mouse Keyboard 1..* * Chassis Fan CPU RAM aggregation

  26. Qualifier (限定) – 是屬於association attribute(關連屬性),可用來分割對應至被限定者的objects,並以qualifier來做為其index,達到降低 multiplicity 的作用。 Note.由於qualifier的使用多發生在二個類別原本是多對多的情況下,所以一般而言,它的作用是可使數量性(multiplicity)減少。 如:由左上例可知若一WorkDesk包含很多job, 每個job 有自已的jobID,每個job可用到最多一個returned item,但每個returned item可被很多job 使用,若純為WorkDesk與ReturnedItem 的關係則為“多對多”,加上jobID後,數量性減少成為“一對多”。 Notation ,Semantics and Example Association Name Class-2 Class-1 qualifier role-1 role-2 Notation Directory File name File 0..1 ReturnedItem * WorkDesk jobID: int Example Example

  27. Review Example : Class diagram Company 1 1..* 1..* * location Office * * ContactInformation Department Address:String Voice:Number 0..1 Address:String name:Name * * {subset} 1..* 1 Headquarters Person name:Name employeeID:integer Title:String Getphoto(p:Photo) getSoundBite() getContactIngormation() getPersonalRecords() PersonnelRecord taxID employmentHistory salary ISecureInformation • class diagram • class • association • association name • multiplicity • composition • generalization

  28. Review Example : Class diagram • class • association • association name • multiplicity • aggregation • composition • role has 0..1 School Department 1 1..* 1..* 1..* 1..* assignedTo member 0..1 chairperson 1..* * 1..* teaches attends Student Course Instructor 1..* * * *

  29. Review Example : Class diagram Access permission Directory File name File Accessible by File User • qualifier • association class • association name

  30. Review Example : Object diagram c:Company d1:Department d2:Department name = “Sales” name = “R&D” d3:Department name = “US Sales” manager p:Person :ContactInformation name = “Erin” employeeID = 4362 title = “VP of Sales” address = “1472Miller St.” • Object diagram • Object • link • attribute value • anonymous object • role

More Related