Chapter 6: Class Diagrams
Objectives <ul><li>Understand the rules and style guidelines for creating CRC cards, class diagrams, and object diagrams. ...
Structural Model <ul><li>A formal way of representing the objects that are used and created by a business system </li></ul...
STRUCTURAL MODELS
Structural Models <ul><li>Main goal : to discover the key data contained in the problem domain and to build a structural m...
A Common Language <ul><li>Structural models create a well-defined vocabulary  shared by users and analysts </li></ul><ul><...
Classes, Attributes, & Operations <ul><li>Classes </li></ul><ul><ul><li>Templates for instances of people, places, or thin...
Relationships <ul><li>Describe how classes relate to one another </li></ul><ul><li>Three basic types in UML </li></ul><ul>...
CRC CARDS
Responsibilities & Collaborations <ul><li>Responsibilities </li></ul><ul><ul><li>Knowing </li></ul></ul><ul><ul><li>Doing ...
Front-Side of a CRC Card
Back-Side of a CRC Card
CLASS DIAGRAMS
Elements of a Class Diagram
Attribute Visibility <ul><li>Attribute visibility can be specified in the class diagram </li></ul><ul><ul><li>Public attri...
Operations <ul><li>Constructor </li></ul><ul><ul><li>Creates object </li></ul></ul><ul><li>Query </li></ul><ul><ul><li>Mak...
More Elements of Class Diagrams
Multiplicities 1 1 1 0..* 1 1..* Exactly one: A department has one and only one boss Zero or more: An employee has zero to...
More Multiplicities 1 0..1 1 2..4 1 1..3, 5 Zero or one: An employee can be married to 0 or 1 spouse Specified range: An e...
Sample Class Diagram
Simplifying Class Diagrams <ul><li>Fully populated class diagrams of real-world system can be difficult to understand </li...
Object Diagrams
CREATING CRC CARDS AND CLASS DIAGRAMS
Object Identification <ul><li>Textual analysis of use-case information </li></ul><ul><ul><li>Nouns suggest classes </li></...
Patterns <ul><li>Useful groupings of classes that recur in various situations </li></ul><ul><li>Transactions </li></ul><ul...
7 Steps to Structural Models <ul><li>Create CRC Cards </li></ul><ul><li>Examine common object lists </li></ul><ul><li>Role...
Summary <ul><li>Structural Models </li></ul><ul><li>CRC Cards </li></ul><ul><li>Class Diagrams </li></ul><ul><li>Creating ...
Upcoming SlideShare
Loading in...5
×

Ch06

751
-1

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
751
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Ch06

  1. 1. Chapter 6: Class Diagrams
  2. 2. Objectives <ul><li>Understand the rules and style guidelines for creating CRC cards, class diagrams, and object diagrams. </li></ul><ul><li>Understand the processes used to create CRC cards, class diagrams, and object diagrams. </li></ul><ul><li>Be able to create CRC cards, class diagrams, and object diagrams. </li></ul><ul><li>Understand the relationship between the structural and use case models. </li></ul>
  3. 3. Structural Model <ul><li>A formal way of representing the objects that are used and created by a business system </li></ul><ul><ul><li>People </li></ul></ul><ul><ul><li>Places </li></ul></ul><ul><ul><li>Things </li></ul></ul><ul><li>Drawn using an iterative process </li></ul><ul><ul><li>First drawn in a conceptual, business-centric way </li></ul></ul><ul><ul><li>Then refined in a technology-centric way describing the actual databases and files </li></ul></ul>
  4. 4. STRUCTURAL MODELS
  5. 5. Structural Models <ul><li>Main goal : to discover the key data contained in the problem domain and to build a structural model of the objects </li></ul>Problem Domain Solution Domain Structural Modeling
  6. 6. A Common Language <ul><li>Structural models create a well-defined vocabulary shared by users and analysts </li></ul><ul><ul><li>Classes created during analysis are not the classes that programmers develop during implementation </li></ul></ul><ul><ul><li>This refinement comes later </li></ul></ul><ul><li>Typical structural models: </li></ul><ul><ul><li>CRC cards </li></ul></ul><ul><ul><li>Class (and Object) diagrams </li></ul></ul>
  7. 7. Classes, Attributes, & Operations <ul><li>Classes </li></ul><ul><ul><li>Templates for instances of people, places, or things </li></ul></ul><ul><li>Attributes </li></ul><ul><ul><li>Properties that describe the state of an instance of a class (an object) </li></ul></ul><ul><li>Operations </li></ul><ul><ul><li>Actions or functions that a class can perform </li></ul></ul>
  8. 8. Relationships <ul><li>Describe how classes relate to one another </li></ul><ul><li>Three basic types in UML </li></ul><ul><ul><li>Generalization </li></ul></ul><ul><ul><ul><li>Enables inheritance of attributes and operations </li></ul></ul></ul><ul><ul><li>Aggregation </li></ul></ul><ul><ul><ul><li>Relates parts to wholes </li></ul></ul></ul><ul><ul><li>Association </li></ul></ul><ul><ul><ul><li>Miscellaneous relationships between classes </li></ul></ul></ul>
  9. 9. CRC CARDS
  10. 10. Responsibilities & Collaborations <ul><li>Responsibilities </li></ul><ul><ul><li>Knowing </li></ul></ul><ul><ul><li>Doing </li></ul></ul><ul><li>Collaboration </li></ul><ul><ul><li>Objects working together to service a request </li></ul></ul>
  11. 11. Front-Side of a CRC Card
  12. 12. Back-Side of a CRC Card
  13. 13. CLASS DIAGRAMS
  14. 14. Elements of a Class Diagram
  15. 15. Attribute Visibility <ul><li>Attribute visibility can be specified in the class diagram </li></ul><ul><ul><li>Public attributes (+) are visible to all classes </li></ul></ul><ul><ul><li>Private attributes (-) are visible only to an instance of the class in which they are defined </li></ul></ul><ul><ul><li>Protected attributes (#) are like private attributes, but are also visible to descendant classes </li></ul></ul><ul><li>Visibility helps restrict access to the attributes and thus ensure consistency and integrity </li></ul>
  16. 16. Operations <ul><li>Constructor </li></ul><ul><ul><li>Creates object </li></ul></ul><ul><li>Query </li></ul><ul><ul><li>Makes information about state available </li></ul></ul><ul><li>Update </li></ul><ul><ul><li>Changes values of some or all attributes </li></ul></ul>
  17. 17. More Elements of Class Diagrams
  18. 18. Multiplicities 1 1 1 0..* 1 1..* Exactly one: A department has one and only one boss Zero or more: An employee has zero to many children One or more: A boss is responsible for one or more employees Department Boss Employee Child Boss Employee
  19. 19. More Multiplicities 1 0..1 1 2..4 1 1..3, 5 Zero or one: An employee can be married to 0 or 1 spouse Specified range: An employee can take 2 to 4 vacations each year Multiple disjoint ranges: An employee can be in 1 to 3 or 5 committees Employee Spouse Employee Vacation Employee Committee
  20. 20. Sample Class Diagram
  21. 21. Simplifying Class Diagrams <ul><li>Fully populated class diagrams of real-world system can be difficult to understand </li></ul><ul><li>Common ways of simplifying class diagrams: </li></ul><ul><ul><li>Show only concrete classes </li></ul></ul><ul><ul><li>The view mechanism shows a subset of classes </li></ul></ul><ul><ul><li>Packages show aggregations of classes (or any elements in UML) </li></ul></ul>
  22. 22. Object Diagrams
  23. 23. CREATING CRC CARDS AND CLASS DIAGRAMS
  24. 24. Object Identification <ul><li>Textual analysis of use-case information </li></ul><ul><ul><li>Nouns suggest classes </li></ul></ul><ul><ul><li>Verbs suggest operations </li></ul></ul><ul><li>Creates a rough first cut </li></ul><ul><li>Common object list </li></ul><ul><li>Incidents </li></ul><ul><li>Roles </li></ul>
  25. 25. Patterns <ul><li>Useful groupings of classes that recur in various situations </li></ul><ul><li>Transactions </li></ul><ul><ul><li>Transaction class </li></ul></ul><ul><ul><li>Transaction line item class </li></ul></ul><ul><ul><li>Item class </li></ul></ul><ul><ul><li>Location class </li></ul></ul><ul><ul><li>Participant class </li></ul></ul>
  26. 26. 7 Steps to Structural Models <ul><li>Create CRC Cards </li></ul><ul><li>Examine common object lists </li></ul><ul><li>Role-play the CRC cards </li></ul><ul><li>Create the class diagram </li></ul><ul><li>Review the class diagram </li></ul><ul><li>Incorporate patterns </li></ul><ul><li>Review the model </li></ul>
  27. 27. Summary <ul><li>Structural Models </li></ul><ul><li>CRC Cards </li></ul><ul><li>Class Diagrams </li></ul><ul><li>Creating CRC Cards and Class Diagrams </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×