[Skip Navigation] [ CSUSB ] / [CNS] / [Comp Sci & Engineering] / [R J Botting] / [CS375] [Search ]
[About] [Contact] [Grades] [Objectives] [Patterns] [Projects] [Question] [Schedule] [Syllabus]
Session: [01] [02] [03] [04] [05] [06] [07] [08] [09] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20]
[Text Version] 11.html Mon Oct 19 14:24:36 PDT 2009

Contents


    CSci 375/11 Class Diagrams


    Table
    Date#Topic (Participation 2pt)Study pages (2 pts)Quiz(15 pts)Project Work(10 pts)
    Previous10Interactions221-247-W4(Transition to Design)
    Today11Class Diagrams248-270Q5(221-270)-
    Next12GRASP271-319-W5(Interaction & Class Diagrams)

    (Close Table)

    Revision History


    Table
    Version#DateDescriptionAuthor
    02005-01-03Used boiler plate to make templateRJB
    12005-02-07Added section HeadingsRJB
    22005-02-16Adding questionsRJB
    32006-02-13UpdatedRJB

    (Close Table)

    Project W4 -- SSD and Packages due

    [ w4.html ]

    How do all these diagrams and documents work together?

    First look inside the front cover of the book: [ artifactrelationships.gif ]

    16 Class Diagrams

      Introduction

    1. *** Class diagrams are used for many purposes: domain models, object oriented designs, models of code, defining component interfaces, ...

    2. DCD::acronym="Design Class Diagram", a class diagram that models the classes that will appear inside the code for the software. [ watch?v=Vy_gLkxuCnw&feature=related ] (YouTube with robotic voice and one error (no void in UML!)).

    3. Static model: what is possible. Also need models of dynamics: what happens. Need to relate them.
    4. Make sure that what should happen in the machine is possible!

    5. Develop interactions and classes in parallel: Each object is in a class so put the class in the class diagram. Each message points at an object in a class.... add the message as an operation in the class. Each message links two objects and if they are in different classes then there will be a path in the class diagram. Data (in messages or returned) may become attributes in the class diagram. See session [ 13.html ] onward.

    6. Your first attempts will be hesitant and messy. Later in this class the attempts will be just messy.

    7. In a real project, let the problem drive the diagrams.

    8. We will cover a set of Patterns for placing operations into classes. These are called the GRASP patterns. The first is simple enough that you can use it in your projects, right now:
      (Information_Expert): An operation should be done by the class that has the information that is needed by the operation.

    9. Process: Each use case becomes many scenarios. Each scenario becomes one SSD. Each SSD makes many Interaction diagrams. One interaction per message (max) in the SSD. One DCD for all the interactions. See [ UC2Code.png ] for an informal sketch of the flow.

      16.1 - 16.6 Important notations and definitions for class Diagrams

    10. *** 16.1 Notations (Q5) Put a sticky note on this section
    11. * 16.2 Definitions: Design vs domain
    12. 16.3 Definition: Classifier (UML Jargon)
    13. ** 16.4 Attributes and associations (Q5)
    14. **** The idea is to make the connections between classes OBVIOUS.
    15. *** use role names in designs and association names in domain models.
    16. * 16.5 Notes and comments (Q)
    17. ** explain, constrain, and code!
    18. *** 16.6 Operations and methods (Q5)

      16.7 - 16.9 Notations used later

    19. * 16.7..9 Properties: keywords, stereotypes, profiles, and tags, ... (Used later in this class)

      16.10 Generalization, Dependency, and Abstraction

    20. *** 16.10 Generalization and Abstraction (Q)

      Examples of Generalization (some sample generalizations)

    21. * 16.11 Dependency (Q) One class depends on another if changing one can effect the correct operation of the other.
    22. * 16.12 Interfaces (Q) An interface is a set of operations that gives access to objects that realize that interface. It is a socket into which other objects can plug-in.
    23. ++ Think sockets and plugs --

      UML2.0 Standard Example interfaces and components

      16.13-16.16 Associations etc

    24. * 16.13 Composition (Q)
    25. "is a part of" -- like data in an object.
    26. + Use in designs not domain models.
    27. *** avoid <>-- aggregation. Use ----> instead!
    28. ** 16.14 Constraints (Q)
    29. 16.15 Qualified Associations
    30. ** 16.16 Association classes
    31. +++ or make into a class that links the associated classes.

      Figure16.16 with linking class

    32. ++ For example: SalesOrder and Stock are linked by a many-many relationship by SalesOrderItem:

      SalesOrder(1)-(*)SalesOrderItem(*)-(1)Stock

      16.17 - 16.20 Advanced stuff: singletons, templates, ...

    33. 16.17 Singleton Classes (Future)
    34. 16.18 Template classes and Interfaces (Future)
    35. ** 16.19 User-Defined compartments
    36. * 16.20 Active Classes (Future)

      16.21 Relating interaction and class diagrams

    37. ***** A vital skill(Q5). Each part of an interaction diagram tells you something about the design class diagram (DCD).
      Table
      Interaction DiagramClass Diagram
      Object life lineClass
      Message to objectOperation in target class
      DataMay be an attribute of sending class
      Returned DataMay be an attribute of class that returned it

      (Close Table)
    38. Example [ 11getStatusses.gif ] (Interaction -- finding the statusses of a customer's orders) [ 11StatussesDCD.gif ] (Changed DCD).
    39. +++ One DCD for many interaction diagrams.
    40. ++ Each interaction adds to the DCD.

    . . . . . . . . . ( end of section 16 Class Diagrams) <<Contents | End>>

    My notes on Class Diagram Notation

    [ ../samples/uml1.html ] (generic) [ ../samples/uml1b.html ] (C++ oriented) [ ../papers/20050502Body.html#Class and Object Diagrams ] (UML2.0 changes)

    Be careful to use arrows correctly in the UML

    [Meanings of arrows in the UML]

    Example if time

    Developing a communication diagram, a sequence diagram and a class diagram in parallel.

    Exercises on Interaction Diagrams if time

    Translate given communication diagram to a sequence diagram.

    Use interaction diagrams to develop a class diagram that supports the interactions.

    Use a pair of a communication and a sequence diagram of the same collaboration to fill in blanks.

    See [ 11Exs.png ]

    Here is a domain model and a communication diagram from the last class [ 10ExGetUnfilledInteract.html ] (thank you Visio). Redraw the Domain class diagram as a Design Class Diagram that supports the communications shown.

    Time to recall or reconstruct the domain model of the objects in a classroom for an inventory of the CSUSB campus. Add some generalizations and more general classes.

    Project Step 5 Interactions and Classes -- Next Week

    [ w5.html ] is due next week.

    Quiz on Interaction Diagrams and Classes


    (Q5): May be tested in Quiz 5 (will be tested sooner or later). Make a set of diagrams fit together. OPEN BOOK.

    Note:
    (Q): Some topics will be tested later...

    Questions and Answers

    [ 11q.html ]

    Next: How to make a good design

    [ 12.html ]

    Review Questions

    [ 11r.html ]

    Standard Definitions

  1. CS202::= See http://cse.csusb.edu/dick/cs202/.
  2. CS372::= See http://cse.csusb.edu/dick/cs372/.

  3. DCD::diagram="Design Class Diagram", shows the classes that will be implemented in code.
  4. DRY::XP="Don't Repeat Yourself".

  5. ESSUP::Process= See http://www.ivarjacobson.com/essup.cfm, Ivar Jacobsen simplified "Essential" UP.

  6. Glossary::= See http://cse.csusb.edu/dick/cs375/uml.glossary.html.
  7. GoF::="Gang of Four", [ patterns.html#GoF ]
  8. GRASP::patterns="General Responsibility Assignment Software Patterns", a set of guidelines for designing objects and classes. They take a single event that the system must handle and determine a good class to carry it out. See [ patterns.html#GRASP -- General Responsibility Assignment Software Patterns ]
  9. Grades::= See http://cse.csusb.edu/dick/cs375/grading/.

  10. KISS::Folk_law="Keep It Simple, Stupid", in agile processes this means never drawing a diagram or preparing a document that doesn't provide value to the clients and stakeholders. In all processes it means never designing or coding what is not needed, see YAGNI.

  11. OO::shorthand="Object-Oriented".

  12. OOAD::="Object-Oriented Analysis and Design", See chapter 1 in text.
  13. patterns::="Documented families of problems and matching solutions", see Patterns.
  14. Patterns::= See http://cse.csusb.edu/dick/cs375/patterns.html.

  15. Process::="How to develop software".

  16. RJB::=The author of this document, RJB="Richard J Botting, Comp Sci Dept, CSUSB".
  17. RUP::Process="Rational UP", a proprietary version of UP.

  18. SSD::="System Sequence Diagrams", see chapter 10.

  19. TBA::="To Be Announced".

  20. UML::="Unified Modeling Language". [ Unified_Modeling_Language ]

  21. UP::="Unified Process", an iterative, risk-driven, and evolutionary way to develop OO software.

  22. YAGNI::XP="You Ain't Gonna Need It", an XP slogan that stops you planning and coding for things that are not yet needed. As a rule the future is not predictable enough to program a feature until the stakeholders actually need it now. In this class it means "It won't be on the final or in quizzes".

  23. XP::="Extreme Programming", the ultimate iterative code-centric, user-involved process.

End