Class Models
for Engineering Design
|
Prof. David Bernstein
James Madison University
|
|
Computer Science Department |
bernstdh@jmu.edu |
|
Overview
- Purpose of Class Models for Engineering Design
- Contents of Such Models
- The Process
Class Models for Engineering Design
- Purpose:
- Illustrate the specifications for the static structure
of classes and interfaces
- Enhineering Models vs. Conceptual Models:
- A conceptual model represent real-world concepts
- An engineering design model represent software components
Contents of Class Models for Engineering Design
- Classes and Interfaces/Contracts
- Attributes
- Methods
- Dependencies
The Process
- Identify all of the classes
- Identify attributes of each class
- Identify methods
- Add type/signature information
- Add associations ("use"), aggregations ("has a"), and
specializations ("is a")
- Replace classes with interfaces (as appropriate)
- Add dependencies (where needed)
Classes in UML
The Basics
Classes in UML (cont.)
Visibility
- Public (+)
- Private (-)
- Protected (#)
- Implemented (or Package) (~)
Relationships: Association
- Definition:
-
Class A is said to be associated with class B if an object in
class A can send a message to an object of class B or if an
object in class A can create, receive or return objects of class
B.
-
Set Theoretic Concepts:
Relationships: Dependency
- Definition:
-
Class A is said to depend on class B if method in an object of class A
is passed an object of class B.
- Dependency or Association?
- A dependency is a special types of association
Relationships: Specialization
- Definition:
-
An object of class A "is-an" object of class B if A is/does everything
that B is/does and more.
-
Set Theoretic Concepts:
Relationships: Aggregation
- Definition:
-
An object of class A "has-an" object of class B if B is a part of
A.
-
Set Theoretic Concepts:
Relationships: Composition
- Definition:
-
An object of class A is composed of an object of class B if B
is a part of A and A controls the life of B (e.g., if A is destroyed then
B will be destroyed). Thus a component can be associated with exactly
one composite (making the multiplicity implictly 1).
-
Set Theoretic Concepts:
Interfaces in UML
- Defined:
- A set of operations/services
- Implications:
- A class that implements/realizes an interface promises
that it will implement all of the methods in the interface
- A class that implements/realizes an interface has an "is a"
relationship with that interface
Interfaces in UML (cont.)
An Example