Chapter 5: UML Class Diagrams - PowerPoint PPT Presentation

1 / 39
About This Presentation
Title:

Chapter 5: UML Class Diagrams

Description:

Full format of the attribute text notation: ... Most are shown in guillemet (' ') Some are shown in curly braces ({ }) at an association end ... – PowerPoint PPT presentation

Number of Views:63
Avg rating:3.0/5.0
Slides: 40
Provided by: mach165
Category:

less

Transcript and Presenter's Notes

Title: Chapter 5: UML Class Diagrams


1
  • Chapter 5 UML Class Diagrams

2
  • Objective
  • Provide a reference for frequently used UML class
    diagram notation.

3
5.1. Applying UML Common Class Diagram Notation
4
5.2. Definition Design Class Diagram
5
5.3. Definition Classifier
  • A model element that describes behavioral and
    structure features
  • Regular Class
  • Interface

6
5.4. Ways to Show UML Attributes
  • Ways to Show UML Attributes
  • Attribute text notation,.
  • Association line notation
  • Both together
  • Full format of the attribute text notation
  • visibility name type multiplicity default
    property-string

7
5.4. Ways to Show UML Attributes
8
5.4. Ways to Show UML Attributes
  • Attribute-as-association line styles
  • a navigability arrow pointing from the source to
    target object,
  • a multiplicity at the target end, but not the
    source end
  • a rolename only at the target end to show the
    attribute name
  • no association name

9
5.4. Ways to Show UML Attributes
10
5.4. Ways to Show UML Attributes
  • When to Use Attribute Text vs. Association Lines
    for Attributes?
  • Use the attribute text notation for data type
    objects
  • Use the association line notation for others
  • Emphasize the connection between the class of
    objects

11
5.4. Ways to Show UML Attributes
public class Register private int id
private Sale currentSale private Store
location //
12
5.4. Ways to Show UML Attributes
  • The UML Notation for an Association End

13
5.4. Ways to Show UML Attributes
  • public class Sale
  • private ListltSalesLineItemgt lineItems
  • new ArrayListltSalesLineItemgt()
  • //

14
5.5. Note Symbols
  • UML note or comment
  • have no semantic impact
  • UML constraint
  • encased in braces ''
  • method body
  • the implementation of a UML operation

15
5.6. Operations and Methods
  • Operations
  • visibility name (parameter-list) return-type
    property-string
  • getPlayer( name String ) Player exception
    IOException
  • public Player getPlayer( String name ) throws
    IOException
  • How to Show Methods in Class Diagrams?
  • in interaction diagrams
  • by the details and sequence of messages
  • in class diagrams
  • with a UML note symbol stereotyped with method

16
5.6. Operations and Methods
  • Operation Issues in DCDs
  • The create Operation
  • Operations to Access Attributes
  • often excluded (or filtered)

17
5.7. Keywords
  • Textual adornment to categorize a model element
  • Most are shown in guillemet ( )
  • Some are shown in curly braces ( )

18
5.8. Stereotypes, Profiles, and Tags
  • Stereotypes
  • shown with guillemets symbols .
  • represents a refinement of an existing modeling
    concept
  • defined within a UML profile
  • UML profiles
  • a collection of related stereotypes, tags, and
    constraints to specialize the use of the UML for
    a specific domain or platform
  • Tags
  • apply to the Stereotype element
  • can be assigned values

19
5.8. Stereotypes, Profiles, and Tags
20
5.9. UML Properties and Property Strings
  • Property
  • a named value denoting a characteristic of an
    element
  • Property string
  • Format
  • name1value1, name2value2

21
5.10. Generalization, Abstract Classes, Abstract
Operations
  • Generalization
  • A taxonomic relationship between a more general
    classifier and a more specific classifier.
  • Each instance of the specific classifier is also
    an indirect instance of the general classifier.
  • Abstract classes and operations
  • shown either with an abstract tag
  • italicizing the name
  • Final classes and operations
  • shown with the leaf tag

22
5.11. Dependency
  • Dependency Relationship
  • a client element has knowledge of another
    supplier element
  • a change in the supplier could affect the client.
  • Common Types
  • having an attribute of the supplier type
  • sending a message to a supplier the visibility
    to the supplier could be
  • an attribute, a parameter variable, a local
    variable, a global variable, or class visibility
    (invoking static or class methods)
  • receiving a parameter of the supplier type

23
5.11. Dependency
  • Used to depict following dependency between
    objects
  • global
  • parameter variable
  • local variable
  • static-method.

24
5.11. Dependency
public class Sale public void
updatePriceFor( ProductDescription description )
Money basePrice description.getPrice
() // //
25
5.11. Dependency
public class Foo public void doX()
System.runFinalization()
// //
26
5.11. Dependency
27
5.12. Interfaces
28
5.13. Composition Over Aggregation
  • Aggregation
  • a vague kind of association in the UML that
    loosely suggests whole-part relationships.
  • Composition
  • a strong kind of whole-part aggregation
  • implies
  • an instance of the part belongs to only one
    composite instance at a time,
  • the part must always belong to a composite
  • the composite is responsible for the creation and
    deletion of its parts.

29
5.13. Composition Over Aggregation
30
5.14. Constraints
  • UML Constraint
  • restriction or condition on a UML element.

31
5.15. Qualified Association
  • Qualified Association
  • used to select an object (or objects) from a
    larger set of related objects
  • based upon the qualifier key

32
5.16. Association Class
  • Association Class
  • treat an association as a class,
  • model it with attributes, operations, and other
    features

33
5.17. Singleton Classes
34
5.18. Template Classes and Interfaces
  • templatized types,
  • templates, parameterized types, and generics

35
5.18. Template Classes and Interfaces
  • public class Board
  • private ListltSquaregt squares
  • new ArrayListltSquaregt()
  • //

36
5.19. User-Defined Compartments
37
5.20. Active Class
38
5.21. What's the Relationship Between Interaction
and Class Diagrams?
39
  • Questions Answers
Write a Comment
User Comments (0)
About PowerShow.com