פיתוח מערכות מידע class diagrams aggregation, composition and generalization
TRANSCRIPT
פיתוח מערכות מידע
Class diagramsAggregation, Composition and
Generalization
Stereotypes
מנגנון שמופעל על מחלקות, קשרים וסוגי •תלות בין מחלקות כדי לציין את הקטגוריה
המתאימה.
<< boundary>> << interface>>
<<control>>
<<entity>>
Class types
• Iconic /non-iconic representation of 3 class stereotypes: control, boundary and entity.
• Example: agreementUI – interacts directly with actors agreementControl- interacts with elements
inside systemagreementEntity- passive class manipulated
by system elements. Entity = business class
Association
אסוציאציה, מציין קשרים בין מופעים של מחלקות, •
מופעים מאותה בכל קצה של קשר ניתן לציין מספר מחלקה שיכולים להיות למופע אחד מהמחלקה
השנייה
מקושרים אחד או יותר מופעים של A לכל מופע של•B אבל לכל מופע של B מקושר מופע של A אחד
ויחיד
קשר ניתן לתת שם, וגם לקשר עצמו ניתן לכל קצה של•לתת שם
-A1..1
-B1..*
Association
Multiplicity and Cardinalityof associations
ניתן לציין רק את מידת הריבוי של הקשר•
עדיף לציין גם את קרדינליות הקשר•
ניתן לא לרשום מידת הריבוי והקרדינליות •כאשר סוג הקשר מובן מאליו או המידע אינו
חשוב בשלב מסוים של בנית המודל
Composition
( part of )המחלקה מצד שמאל היא חלק•מהמחלקה בצד ימין,כלומר למחלקה מצד ימין
על המחלקה מצד שמאל" יש "בעלות
•Composition הוא סוג של Association
גם כאן ניתן לציין בקצות הקשר את מספר • המופעים האפשריים
Composition
COMPOSITIONדוגמה ל-
מסמך שמורכב מהקדמה, פרקים,סיכום •ואינדקס
יופיע כשלם שמורכב מחלקים שאין להם זכות קיום אם הם לא חלק מאותו מסמך.
אם מסמך מבוטל, אז כל המרכיבים שלו •יבוטלו.
Document
IndexSummarySectionFrontMatter
-End11
-End2*
-End3
1
-End4*
-End7
1
-End8
*
-End5
1
-End6*
Aggregation
Compositionקשר פחות חזק מ-• “-סוג קשר שנועד רק לייצג את היחס "חלק מ•
Assembly-Component:
Component is part of an assembly
and
Assembly consists of components
Aggregration
Generalization
המחלקה מצד שמאל מכלילה את המחלקה מצד •ימין יורשת מהמחלקה ימין, כלומר המחלקה מצד
מצד שמאל
Generalization
Generalization
• One class is a kind of another class
• Generalization - Specialization
• Superclass - Subclass
• Supertype - Subtype
• Generalization allows inheritance of attributes and operations of a superclass by its subclasses
Generalizationסוגי הגדרת
• Bottom-up generalization
במהלך הגדרת מחלקות מתברר שלמספר מחלקות
יש תכונות והתנהגות משותפות ולכן מגדירים superclass והמחלקות בעלות תכונות משותפות subclassesהופכות ל-
• Top-down generalization
במהלך פיתוח המודל, מתברר שיש יותר ממחלקה אחת subclassesמאותו סוג ולכן יש להגדיר מספר
superclassוהמחלקה המקורית הופכת ל-
Abstract superclasses
למחלקה מופשטת אין מופעים ישרים.•
Employee
AdministratorManager
Generalizationדוגמה ב-
לקוח, בעל חשבון, מבצע טרנזקציה מסוג •הפקדה או משיכה.
Customer Account
Transaction
Debit Credit
End1 End2
End3
End4
Visibility of attributes and operations
• Visibility = availability to other classes• Private – :available only within the class• Public + :available to any class associated with
the class that owns the feature• Protected #: available only within that class and
any subtype of that class• Attributes are normally private• Operations are mostly public• Private operations = internal responsibilities
Constraints for generalization
• {complete} –all subclasses defined within class model
• {incomplete} – not all subclasses specified• {disjoint} – one instance of a subclass cannot be
an instance of another subclass. • {overlapping}- opposite of disjoint generalization.
An instance may be an instance of more than one subclass
Associationסוגי קשרים מורכבים-class
קשר האסוציאציה שמקשר בין מופעים של •עצמים
לקשר זה יכולות להיות תכונות מסוימות ואז •Association classמדובר
Dependency
• Dependency: one element requires the presence of another element in order to function.
• If the element upon which the dependency is specified is changed, then the dependent element may also need to be changed
,תלות בין שני אלמנטים/שתי מחלקות
בצורה ששינוי של אלמנט אחד עלול לגרור שינוי
.באלמנט השני
Dependency
עוד על קשרים...
• Visibility )prefix to role name on association end( private/public visibility of an attribute of a class as viewed
from different classes associated with that class• Changeability constraints )omission= no changeability
constraint( {frozen}, {addOnly}• Ordering constraints {ordered}, {unordered}, {sorted}• Navigability ) omission = bi-directional navigability( –
shows that it’s not necessary to implement navigability from x to y