Class Diagram
Class Diagram
Waris Ali
Class Diagrams
Interfaces
Collaborations Dependency,
Generalization, Relationships
Class Methods
Abstract <<abstract>>
<<constructor>> <<query>> <<update>>
Note
Subclass
Assembly Class
name
Composition (Part-Of)
Association (relationship)
Class
Class
Provide abstraction of problem domain Embodies small set of well-defined responsibilities Clear separation between specification and implementation Understandable and simple Show only important properties
Class Hints
Organize similar classes into packages Beware of cyclical generalization Use associations where there are structural relationships Associations are NOT comm pipes!!!!!!! Start with Analysis, then refine details
Identifying Associations
Association Relationship between two or more classes One-to-many association An example of association between the EmergencyReport and the FieldOfficer classes.
EmergencyReport writes *
FieldOfficer 1
author
document
Identifying Aggregation
Models "part of" hierarchy Useful for modeling the breakdown of a product into its component parts UML notation: uses a small diamond to indicate the assembly end of the relationship.
Identifying Aggregation
Engine 1 horsepower volume on off
Automobile serial number year manufacturer model color weight drive purchase
* Brakelight on off 2,4 Door open close 1 Battery amps volts charge discharge
3,4,5
Wheel diameter number of bolts
Identifying Aggregation
Aggregation
Composition Aggregation
Existence
Shared Aggregation
State FireStation
Identifying Attribute
Class Diagram
Main goal: Find the important abstractions What happens if we find the wrong abstractions?
Steps
1. Class identification Based on the fundamental assumption that we can find abstractions 2. Find the attributes 3. Find the methods 4. Find the associations between classes
Pieces
Attributes
Detection of attributes Application specific Attributes in one system can be classes in another system Turning attributes to classes Detection of operations Generic operations: Get/Set, General world knowledge, design patterns Domain operations: Dynamic model, Functional model
Operations
Example
Ahmad enters a store with the intention of buying a toy for his 6 year old child. He has to buy a toy which her daughter likes. The store owner gives advice to the customer. The advice depends on the age range of the child and the attributes of the toy. Ahmad selects a toy which is unsuitable for the child. The store owner recommends a safer doll. Note: Help must be available within less than one minute.
Abbots Heuristics
Part of speech Proper noun Improper noun Doing verb being verb having verb modal verb adjective transitive verb intransitive verb Model component object class method inheritance aggregation constraint attribute method method (event) Example
Ahmad
Toy, doll Buy, recommend is-a (kind-of) has an must be 6 years old enter depends on
In small systems some of the roles do not exist or are played by the same person. Each of these roles has a different view about the models. Types of classes that appear in class diagrams.
1. Introduction 2. Current system 3. Proposed system 3.1 Overview 3.2 Functional requirements 3.3 Nonfunctional requirements 3.4 Constraints (Pseudo requirements) 3.5 System models 3.5.1 Scenarios 3.5.2 Use case model 3.5.3 Object model 3.5.3.1 Data dictionary 3.5.3.2 Class diagrams 3.5.4 User interface 4. Glossary
24
QUESTIONS ?