320 likes | 639 Views
UML Basic Structural Modeling. Part II. Basic Structural Modeling. Classes Attributes, Operations, Responsibilities Relationships Dependency, Generalization, Association, Role, Multiplicity, Aggregation Common Mechanisms
E N D
UMLBasic Structural Modeling Part II
Basic Structural Modeling • Classes • Attributes, Operations, Responsibilities • Relationships • Dependency, Generalization, Association, Role, Multiplicity, Aggregation • Common Mechanisms • Specifications, Adornments, Common Divisions, Extensibility Mechanisms • Diagrams • Class , Object , Component , Deployment Dagrams
Common Mechanisms • Specifications • Adornments • Notes • Common Divisions • Extensibility Mechanisms • stereotypes • tagged values • constraints
Note Adornments: Note • Adornment that stands alone • Note is a graphical symbol for rendering constraints or comments attached to an element • Used to specify things like requirements, oservations, reviews, and explanations • Can be simple text,an embedded URL, a link to a document
Mission full_name : string Shuttle start_engines() stop_engines() fuel_level() : integer launch(t:time) Adornments: Note • Examples See URL Shuttle.nasa.gov Launch time is computed from ephemeris
Stereotypes • Allows to extend the vocabulary of the UML • Allows to create new building blocks, specific to your problem • Can be applied to any element (Class, Attribute, Operation, …) • Can be represented by • << stereotype >> • new icon • both
Stereotypes • a class can have a stereotype indicating what basic type of class it is (e.g. controller, actor, interface) • represent a metaclassification of the class • appear within guillemets in normal type above the class name «user interface» Window size : Area = (100, 100) visibility : Boolean = invisible display () hide ()
Operation Stereotypes • stereostypes can also be used to group together operations with common characteristics • represent a metaclassification of the operation «exception» BadSocket throw() log (String) «helper» setSocket(Socket) «access» getID():SocketID setID(SocketID)
<< NASA Object >> Shuttle weight : Integer age : Integer status: enum = on-ground Stereotypes Examples Spacecraft
Tagged Values • Apply to any element of the UML • Metadata that applies to the element not its instances • Represent arbitrary information expressed in text form • Commonly used to store Project Management information • Examples: • author of an element Author=John Smith • testing status Test = No • version number Version # = 4.2
Constraints • restrict the values that object or links can assume • expressed as arbitrary expressions enclosed in braces near the constrained elements • often use navigation expressions • constraints between two elements are depicted using a dotted, labeled line 4..6 Member-of * Astronaut {subset} Crew 1 * Commander-of
Constraint Examples boss worker * employer employee Person Company * {person.employer = person.boss.employer}
Hint and Tips • Do not abuse Notes, Stereotypes and Tagged Values • Should be used for enhancing communication • Make sure that there is no other way to express what you want • Use Notes as links to documents when too long
Diagrams • Class Diagram • Classes, Interfaces, Collaborations • Object Diagram • Objects • Component Diagram • Components • Deployment Diagram • Nodes
Diagrams • Used to organize the elements of interest • Nine diagrams in UML • Present 5 different Views: • Use Case, Design, Process, Implementation and Deployment Views
Class Diagram • General properties • Name • Graphical content which is a projection into the model • Specific Properties • Contains Classes, Interfaces, Collaborations, Relationships • Sometimes put package, subsystem and instances
Class Diagram • shows a set of Classes, Interfaces and Collaborations • captures the static structure of the system • foundation for the other models • describes the properties and relationships of the objects in the system • all icon/diagram components are optional (you can show as much or as little information as appropriate) • model vocabulary of system • model simple collaborations • model logical database schema
Class Diagram Example Company Office Department Headquarters Person
Hints and Tips • Multiple Class Diagrams are usually needed • Each focus on different aspects of the system • Provides detail consistent with its level of abstraction • Layout is important to convey the information • things semantically close should be physically close • no crossing lines for relationships • When Diagram becomes complex, break it into multiple diagrams
Class Diagram Modeling Exercice • Develop a Class Diagram describing a school