SAM NOTE CH8
SAM NOTE CH8
8.1. Introduction
Purpose:
1. Build in-house.
2. Purchase and customize.
3. Outsource (refer to Chapter 5).
CRC cards.
Class diagrams.
Contract and method specifications.
Database design (refer to Chapter 5).
Objective:
A set of rules to help verify & validate the intersection of the analysis models
Balancing Models:
1
Is a process of ensuring consistency among analysis models.
1. Classes on class diagrams/CRC cards must link to at least one use case and
vice versa.
2. Activities/actions in activity diagrams and use-case descriptions must relate
to responsibilities on CRC cards and class operations.
3. Object nodes in activity diagrams must associate with class
instances/attributes in class diagrams or CRC cards.
4. Attributes and relationships on CRC cards must align with event
subjects/objects in use-case descriptions.
1. Objects in CRUDE matrices must associate with classes in CRC cards and
class diagrams.
2. Behavioral state machines (BSMs) must represent the life-cycle of class
instances and align with CRC cards.
3. Sequence/communication diagram objects must instantiate classes in CRC
cards/class diagrams.
4. Messages, transitions, and CRUDE entries must connect to CRC card
responsibilities and class operations.
5. States in BSMs must associate with attribute values of objects.
Key Takeaway:
Focus Areas:during->
2
Factoring:
Layers:
1. Foundation Layer:
4. HCI Layer:
3
addresses how the SW will execute on specific computers
and networks.
Package: A general construct used to group elements in UML models, serving the
same purpose as folders on a computer.
Applications:
o Grouping use cases (to simplify use-case diagrams).
o Organizing classes and communication diagrams.
Dependency Relationships
Changes in one layer (e.g., Problem Domain Layer) can impact others like:
o Human–Computer Interaction (HCI) Layer.
o Physical Architecture Layer.
o Data Management Layer.
At Class Level:
Steps:
4
1. Set Context:
2. Cluster Classes:
3. Create Packages:
4. Identify Dependencies:
Overview
5
Class and method design is where the actual implementation of the system
occurs.
Importance: Poor class design leads to inefficient systems and objects incapable of
proper communication.
Levels of Abstraction:
o Variable, method, class/object, package, library, and application/system
levels.
o Changes at one level (e.g., class) can cascade to other levels (e.g., package,
system, or library).
Good design minimizes the system’s total cost over its lifetime by balancing
trade-offs. Key criteria:
1. Coupling
2. Cohesion
I. Coupling
High Coupling: Increases the likelihood that changes in one module require changes
in others.
Types:
Interaction Coupling:
6
Interaction coupling increases with:
Inheritance Coupling:
II. Cohesion
Method Cohesion:
Class Cohesion:
7
4. Lacks control coupling between visible methods.(An individual class
can have a mixture of the following three types of class cohesion.)
The design activities for classes & methods are really an extension of the
analysis and evolution activities presented previously (chapters 6 & 7)
Object design refines the analysis model by expanding and optimizing class
descriptions, incorporating reuse opportunities, and preparing for
implementation. The main activities used to design classes and methods
include:
Adding Specifications
8
Restructuring the Design
Key Takeaways
Definition of Contracts
9
Components of a Contract
Specification of Constraints
1. Comparison Constraint:
o Example: A customer must have a balance owed of less than 100 Birr to
place a credit order.
2. Relationship Traversal:
o Example: The amount on a purchase order equals the sum of the values of
individual order lines.
amount = OrderLine.sum(getPrice())
3. Logical Operators:
4. Unique Constraints:
printedName = firstName.concat(lastName)
10
sum(): Guarantees a total value of elements.
size: Returns the number of items in the collection.
count(object): Counts occurrences of a specific object.
includes(object): Tests whether an object exists in the collection.
isEmpty(): Checks if the collection is empty.
select(expression): Identifies a subset of the collection.
Types of Constraints
1. Preconditions:
2. Post-conditions:
3. Invariants:
o Constraints that must always hold true for all instances of a class.
o Example: Attribute multiplicity, valid attribute values, and association
relationships.
Documenting Constraints
Elements of a Contract
Precondition: The new order cannot already exist in the customer’s list of orders.
Post-condition: The updated list equals the previous list plus the new order.
Design Decision:
Purpose
11
Provide detailed instructions for programmers to implement methods.
Specifications include:
o General Information
o Events
o Message Passing
o Algorithm Specification
General Information
Includes method name, class name, ID, contract ID, programmer, due date, and
programming language.
Events
Message Passing
Describes arguments passed to/from the method and their data types.
Algorithm Specification
Activity Diagrams:
Additional Information
Includes calculations, business rules, subroutine calls, and changes to other design
documents.
Implements the logic for adding an order to the list in sorted order.
Relies on preconditions and post-conditions specified in the addOrder method.
Designed to manage dependencies effectively between customer and order classes.
12