Class Diagram 1 Definition depict the classes within



























- Slides: 27
Class Diagram 1
Definition ¡ depict the classes within a model l ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei classes have attributes (member variables), operations (member functions) and relationships with other classes ﻫﻤﺸﻤﻨﺪ ﻫﺎﻱ ﺳﻴﺴﺘﻢ آﺰﻣﺎﻳﺸگﺎﻩ 2
Class Diagram ¡ Class l l l ¡ Class name Attribute Operation Relationships l l ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei Generalization Association Aggregation Dependency
Class ¡ It’s a rectangle divided into three compartments. l l l ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei Name Attributes Operations ﻫﻤﺸﻤﻨﺪ ﻫﺎﻱ ﺳﻴﺴﺘﻢ آﺰﻣﺎﻳﺸگﺎﻩ 4
Class Name • • • ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei Required Appears in the top-most compartment unique ﻫﻤﺸﻤﻨﺪ ﻫﺎﻱ ﺳﻴﺴﺘﻢ آﺰﻣﺎﻳﺸگﺎﻩ 5
Attributes • Person name address birthdate ssn ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei : String : Address : Date : Id • property of a class, describes the object being modeled. appear in the second compartment ﻫﻤﺸﻤﻨﺪ ﻫﺎﻱ ﺳﻴﺴﺘﻢ آﺰﻣﺎﻳﺸگﺎﻩ 6
Attributes ¡ Visibility l l Public + Private – Protected # Package ~ Name ¡ Data Type ¡ [default value] Visibility name : type = initial value ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ {constraints} http: //ceit. aut. ac. ir/~lamei ¡ ﻫﻤﺸﻤﻨﺪ ﻫﺎﻱ ﺳﻴﺴﺘﻢ آﺰﻣﺎﻳﺸگﺎﻩ 7
Attributes ¡ Person Derived attribute: • name address birthdate / age ssn : String : Address : Date : Id • • ¡ ¡ ¡ ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei can be computed from other attributes doesn’t actually exist. designated by a preceding ‘/’ Example: age and birth date / age : Date +Wieght : int = 850 ﻫﻤﺸﻤﻨﺪ ﻫﺎﻱ ﺳﻴﺴﺘﻢ آﺰﻣﺎﻳﺸگﺎﻩ 8
Operation Person name address birthdate ssn : String : Address : Date : Id eat sleep work play ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei ¡ ¡ the class behavior signature: name, type, and default value of all parameters, and, a return type. 9
Operation name ¡ Arguments ¡ l l ¡ Name Type Return type ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei ﻫﻤﺸﻤﻨﺪ ﻫﺎﻱ ﺳﻴﺴﺘﻢ آﺰﻣﺎﻳﺸگﺎﻩ 10
Example ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei
Class types Boundry (usecase – actor): boundary of the system and other system or user ¡ Entity (Table): has data ¡ Control (usecase): few attribute ¡ ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei
Relationships ¡ Relationships l l ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei Generalization Association Aggregation Dependency
Generalization ¡ ¡ A relationship between a general thing sand a more specific kind of that thing “is-a-kind-of” relationship ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei
Association A structural relationship that specifies that objects of one thing are connected to objects of other ¡ Communicate ¡ Multiplicity ¡ l l l One-to-One Many-to-Many ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei ﻫﻤﺸﻤﻨﺪ ﻫﺎﻱ ﺳﻴﺴﺘﻢ آﺰﻣﺎﻳﺸگﺎﻩ 16
Association ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei
Reflexive Association next Linked. List. Node ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei previous
Reflexive Association ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei
Aggregation "has a" association relationship ¡ represents a part-whole or part-of relationship ¡ when a class is a collection or container of other classes ¡ the contained classes do not have a strong life cycle dependency on the container ¡ ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei
Aggregation Engine Car Transmission ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei
Composition "owns a” association relationship ¡ Composition usually has a strong life cycle dependency between instances of the container class and instances of the contained class ¡ ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei
Composition ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei
Dependency ¡ Change in specification of one class can change the other class. This can happen when one class is using another class. ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei
Examples ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei
ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei
ﻻﻣﻌﻲ ﺍﻓﺸﻴﻦ http: //ceit. aut. ac. ir/~lamei


























