Class diagrams:
Used to show the existence of classes & their relationships in the logical view of a system.
Analysis-It is used to indicate the common roles & responsibilites of the entities that provide the systems behaviour. Design-To capture the structure of the classes that form the systems architecture.
Essential elements
Classes Their relationships
Class icon
Name Attributes operations
Attributes-part of an aggregate
object.
Operation-some service provided
by the class.
Abstract class adornment
Name Attributes operations
A
Class relationship icon
association inheritance has
using
Association -connects two classes & denotes a semantic connection. -denotes the nature of the relationship.
Cardinality adornment
-denotes the number of links between instance of source & target classes
Inheritance
Denotes generalization/specialization relationship. It may not have cardinality adornments.
Has
Denotes whole/part relationship (aggregation).
Using
Denotes client/supplier relationship.
Gardening system class diagram
GardeningPlan
Crop Execute() Canharvest()
1
Defines climate
Environmenta l controller
1 1 1
1 N
Light
Heater
Cooler
Actuator Startup() Shutdown()
A
Class categories
It serve to partition the logical model of a system. It is an aggregate containing classes and other class categories. Top-level class diagrams containing only class categories.
Name classes
Top-level class diagram
Automated Gardener
Planning GardeningPlan PlanAnalyst Greenhouse EnvironmentalController Nutritionist
GUI Library
Gardening Database
Climate
Nutrients
CropTypes global
Advanced Concepts
Parameterized classes Metaclasses Class Utilities Nesting Export Control Properties Physical Containment Roles & Keys Constraints Attributed Associations & Notes
Parameterized classes
It denotes a family of classes whose structure & behavior are defined independent of its formal class parameters. It may not have any instances & may not itself be used as a parameter. Instantiated class defines a new class distinct from all other concrete classes.
Parameterized classes
Gardening Plan
PlanSet
Item
Set
Gardenin g Plan
Metaclasses
It is the class of a class. It may not itself have any instances, but may inherit from, contain instances of, us, and otherwise associate with other classes.
Metaclasses
GardeningPlan Class New() Default()
Class Utilities
It may denote one or more free subprograms. It may also name a class that only has class instance variables & operations. It may be parameterized & in turn instantiated.
Class Utilities
PlanMetrics
expectedYield() timeToHarvest()
Nesting
Export Control
<no adornments> ~ public access (default) I ~ Protected access II ~ Private access III ~ Implementation access
Export Control
1 1
Crop Database
Properties
Static- The designation of a class member object or function. Virtual- The designation of a shared base class in a diamond-shaped inheritance lattice. Friend- The designation of a class that grants rights to another to access its nonpublic parts.
Properties
1
Physical Containment
By value Denotes physical containment of a value of the part. By reference Denotes physical containment of a pointer or a reference to the part.
Physical Containment
Crop History
N 1 N
Roles & Keys
Roles Denotes the purpose or capacity wherein one class associates with another. Key It is an attribute whose value uniquely identifies a single target object.
Roles & Keys
Contributor Assistant
Plan Analyst
User Contributor
Crop Encyclopedi a
scientificName
Constraints
Activates{Cooler isRunning XOR Hearter isRunning}
Attributed Associations and notes
N N Nutrient pHLevel() unitCost( )
Nutrient Schedul e
Retrieve from nutrient database
Should select from a common set of schedules
Specification
It is a nongraphical form used to provide the complete definition of an entity in the notation. Common elements are Name: identifier Definition: text
Class specifications:
Each class in the model has exactly one class specification..
Responsibilities: text
Attributes:
list of attributes Operations: list of operations Constraints: list of constraints
Operation specifications: For each operation there is a member of a class, and all free subprograms, we define one operation specification.. Return class : reference to class Arguments : list of formal arguments