timed quiz 9pm EST

profilemicos009
Newfolder.zip

New folder/L10-ArchitectureDesign.ppt

Architectural Design

Software Architecture

Architecture Design

  • Architecture design is a problem-solving activity whose input is the SRS document and whose output is the “abstract” specification of a software which realizes the desired characteristics

Architecture Design – cont.

  • Architecture design is a specification of the solution’s major components, their responsibilities and properties, and the relationship and collaboration among the major components.

Architecture Design

Architecture design is a problem-solving activity whose input is the SRS document and whose output is the “abstract” specification of a software which realizes the desired characteristics

Rephrased from page 254 of text

Architecture Design

Architecture design is a specification of the solution’s major components, their responsibilities and properties, and the relationship and collaboration among the major components.

Also, rephrased from page 254 of text

Architectural Design Activity Overlaps

  • Architecture Design Activity can not be cleanly separated from SRS Analysis (Product Design) and Detail Design Activities because of the 4 design principles:

  • Feasibility

  • Adequacy

  • Changeability

  • Economy

Requirements

(Product Design)

Architectural

Design

Detail Design

  • Feasibility: During Product Design, we may need to understand the feasibility of some specific architecture

  • Adequacy: May need to “prove” the sufficiency of the solution and need to create an architectural prototype during Product Design or Design Analysis time

  • Changeability: May need to make trade-offs of requirements based on the design architecture

  • Economy: May need to explore schedule, cost, and resource impact based on the design architecture AND some detail design

Variations in Architectural Design

  • Not all architectural designs are the same in terms of their level of abstraction:

  • number of components (main components),
  • description of each component
  • relationships among components

Deciding on the “right” level of architectural depth has always been a problem.

  • Two important Considerations:

1. Problem context: the larger the problem the more levels of abstraction, # of components, # of relationships among components

2. Organizational context: the more experienced and sophisticated organizations would have more standards, tools, guidelines, and skills invested --- thus may have more pre-determined preference or constraints on the architectural design

Introduction To Architectural Design

SRS

Design

Doc.

Design

Analysis

Architectural

Design

Detail

Design

Swft Engr. Design

Analyzed

SRS

Architectural Design Process

Develop Architectural

Alternatives

Evaluate Architectural

Alternatives

Select Architectural

Resolution

Finalize Software

Architectural Document

SAD

[selected ]

[else ]

SAD Template

  • Product Overview
  • Architectural Models
  • Mapping between Models
  • Architectural Design Rationale

Software Architecture Document (SAD)

  • Product Overview:

summarizes the overall product description, stakeholders and target market descriptions, assumptions and constraints, and the basic business requirements (or refer to SRS)

  • Architectural Models:

presents the architecture in terms of models of data, functional decomposition and functional activities, and system states and transitions (representing different aspects or views – use DeSCRIPTR as a guide).

3. Mapping between Models: presents and explains how the different models are related

4. Architectural Rationale:

explains the main criteria considered for design decisions, alternatives that were investigated, and why the particular architectural choice was made. (choosing which design decisions to discuss is important)

Design of Non-Functional Requirements

  • Major Functional Requirements can be directly mapped into key architectural components, but how about “non-Functional requirements (or attributes)”?

See next slide

You Do It

  • Major Functional Requirements can be directly mapped into key architectural components, but how about “non-Functional requirements (or attributes)”?
  • Go to this week Discussion area and share your thoughts with your classmates.

Quality Attributes

  • Operational Attributes

  • Development Attributes

Operational Attributes

  • Performance: time limits, space capacity, transaction limits

Operational Attributes – cont.

  • Availability: readiness for use (borders on performance)

Operational Attributes – cont.

  • Security: resistance or protection from harm

Operational Attributes – cont.

  • Reliability: error resistance and performing to requirements

Operational Attributes – cont.

  • Usability: easy to understand and navigate

Developmental attributes

  • Maintainability: easy to understand and modify

Developmental attributes –cont.

  • Reusability: portable, easy to modify, loose coupling, etc.

An Example

Page 258 - “Finger Print Matching”

  • A program responsible for matching fingerprints read from scanners against a database to allow people into and out of a secure facility.

  • There are also some other characteristics that are important:

(1) must respond quickly,

(2) must be available the entire time,

(3) must be able to perform matching at a reliable rate,

(4) and must resist attackers.

Fingerprint Matching Software “Design”

Input

validation

Fingerprint

validation

Fingerprint

Reading

device

Finger

Print

DB

“fingerprints read from scanners”

“matching ---

against a database”

Fingerprint Matching Software “Design”
Example Using Activity Diagram notation

Input validation

fingerprint validation

Set-up / send message

fingerprint

input

pass/

no-pass

message

error

message

[bad input]

[good input]

Fingerprint

Reading

device

Finger

Print

DB

What about these?

Fingerprint Matching Architecture

Fingerprint Matching Software “Design”
Example Using Activity Diagram

Fingerprint

Reading

device

validate

input

Fing_prt

input

Digitized

Fing prt

Evoke

F-prt-dig

Error

process

Error

message

[good print]

[else]

Input validation

Digitized

Fing prt

Fing_prt

table

validate

F-print

Pass/No-pass

message

Fingerprint validation

Finger

Print

DB

Compare this with box-and line diagram on page 265 of text

What about these “non-functional” attributes?

  • “respond quickly” – Performance

  • Which functionality: a) input validation or b) fingerprint validation or both needs to be looked at?

  • Is the scanner system or the db system a potential bottleneck?

  • How do we specify the speed criteria on the activity diagram?

What about these “non-functional” attributes?

  • “must be available the entire time - - -” - Availability

  • Scanner system must have a back-up scanner to switch to?

  • Do we need a redundant db or some other file?

  • Similarly do we need to have a redundant processor ?

  • How do we specify the redundancy on the activity diagram?

What about these “non-functional” attributes?

  • “must perform matching at a reliable rate” – Reliability

  • Input checking must not accept incomplete or smeared finger print

  • Algorithms for digitizing finger prints must be accurate – (error rate?)

  • Algorithm for data base compare must be accurate – (error rate?)

  • How do we specify these on the activity diagram?

What about these “non-functional” attributes?

4. “must resist attacker” – Security

  • What does this mean? The whole system must be physically protected and there should not be any “connection” to any other system.

  • The system must have a security check functionality for start-up, shut-down, and access.

  • We can do the security checking by adding another set of functionality to activity diagram

What about Cohesion?

  • Would we have some issues related to “cohesion?”

  • Input validation: a single related function

  • Fingerprint validation: a single related function

Questions

New folder/L11-Arcitecture Resolution.ppt

Architectural Design Resolution

Software Architecture

Chapter 10

Architectural Design

SRS

Design

Doc.

Design

Analysis

Architectural

Design

Detail

Design

Swft Engr. Design

Analyzed

SRS

Architectural Design Process

Develop Architectural

Alternatives

Evaluate Architectural

Alternatives

Select Architectural

Resolution

Finalize Software

Architectural Document

SAD

[selected ]

[else ]

Architectural Design Resolution

Analyzed

SRS

Architectural Design Process

Develop Architectural

Design Alternatives

Evaluate Architectural

Alternatives

Select Architectural

Resolution

Finalize Software

Architectural Document

SAD

[selected ]

[else ]

Developing Architectural Design Alternatives

  • Develop Functional Components
  • Based on transforming SRS functions and data requirements
  • Determine Components Based on “Quality Attributes”: maintainability, reusability, performance, availability & security (non-functional attributes)
  • Based on transforming non-functional SRS requirements
  • Modifying Existing Architecture (skip)
  • Based on existing architecture as a starting point and transforming it to satisfy the new system
  • Elaborate an Architecture Style (chapter 15)
  • Based on an existing architectural style and elaborate on that style
  • Transform a Conceptual Model (chapter 11-Destailed Design)
  • Based on viewing the SRS problem description as a solution description and transforming that to fit the new system

Transforming and elaborating are the key words --- how do we do that?

Architectural Design
(team or individual activity?)

  • In software engineering, many activities are performed as a team effort --- for

  • Productivity
  • Quality
  • Morale and Acceptance

  • But for Architectural Design:

  • Better done as an individual first
  • Bring together all the individual architectural design suggestions
  • Evaluate the alternatives

Determine Functional Components
(Using the “AquaLush Irrigation System” Example in textbook – p.82 and p.164)

AquaLush Product Vision:

The AquaLush Irrigation system will use soil moisture sensors to control

irrigation, thus saving money for customers and making better use of

water resources.

AquaLush Major Product Features (from requirements):

  • - Monitor water usage and limit usage (by moisture level) to amounts set by users
  • - Allow users to specify times when irrigation occurs
  • - Be operated from a simple central control panel
  • - Have a web-based simulator

What would you list as major “functional components ?”

(e.g.)

1. user interface to initialize, set-up, monitor and control the irrigation system

2. sensor inputs processing

3. water irrigation control

4. web-based simulator

Try this in class (with class) - - - - use components diagram

Determining Functional Components from SRS
(page 289 – 291textbook solution)

1. configure the program at startup

2. controlling irrigation (manually and automatically)

3. providing a user interface

4. allowing users to monitor and repair system

<<component>>

User Interface

<<component>>

Irrigation Control

<<component>>

Monitor and Repair

<<component>>

Startup

Do the functional components and the interaction lines make sense to you?

(Should there be a line between User Interface and Startup ?)

From page 180

From page 289

Determining Functional Components
(page 289 – 291textbook solution for product)

1. configure the program at startup

2. controlling irrigation (manually and automatically)

3. providing a user interface

4. allowing users to monitor and repair system

<<component>>

User Interface

<<component>>

Irrigation Control

<<component>>

Monitor and Repair

<<component>>

Startup

AquaLush Parts

Status

AquaLush

Configuration

<<read & write>>

<< read & write >>

<<startup reads config. data>>

Note that Monitor and

Repair component can use

the Data Store to communicate

with Irrigation Control component,

without a line between them.

How initialized?

Component Responsibilities

  • There needs to be some description of each component’s responsibilities:

  • User Interface: interacts with control panel hardware and implements control panel interface; obtains data from Monitor and Repair -------
  • Monitor and Repair: Obtains data from Parts Status to pass on to ------
  • Irrigation Control: Controls valve, reads sensors; reads clock; implements irrigation cycles; ---
  • Startup: reads the configuration data of valves, zones, etc. and send them to Irrigation Control & (also alternatively also include Monitor Repair) ----
  • Parts Status: a database that keeps track of all failed and repaired parts, etc.
  • Configuration: a database of all the installed parts of valves, sensors, etc. of the customer’s Aqualush system

Determining Functional Components
(page 293 textbook - for adding web- simulator)

<<component>>

Simulating User

interaction

<<component>>

Irrigation Control

<<component>>

Monitor and Repair

<<component>>

Startup

AquaLush Parts

Status

AquaLush

Configuration

<<read & write>>

<< read & write >>

<<startup reads config. data>>

<<component>>

Simulating

Valves and sensors

Same initialization

problem?

Determining Components based on
“non-Functional” or “Quality’ attributes

  • AquaLush has the following non-functional (NF) requirements:
  • Reusability : design must be used in the product, web-simulator, and future versions
  • Hardware adaptability: design should consider adaptability to multiple valve types, sensor types, keypads, and screen display types
  • Reliability: must not fail “often” in normal usage
  • Modifiability: accommodate future changes in irrigation strategy (formula)

Note that reliability of not failing “often” is a nebulous and subjective statement

NF: Reusability Attribute

  • Requires components to be cohesive and loosely coupled so that they can be reused.
  • Consider each component for these:
  • Would you subdivide User Interface/interaction component into several subcomponents (interface to Irrigation Control and to Monitor and Repair separately)?

  • Would you separate out Irrigation Control component into a) manual and b) auto subcomponents?

- etc.

Irrigation Control

Manual control

automatic control

NF : Hardware Adaptability & Modifiability

  • Requires the component to have device adaptability also implies
  • separate cohesive subcomponents
  • low coupling subcomponents, each representing different device
  • hide the device specific internals and keep the interface unchanging
  • In AquaLush, the Irrigation Control has interfaces to multiple devices.
  • In AquaLush, Monitor and Repair component and Startup component has interface to a data-store

Virtual Device Interface

valve

sensor

keypad

display

Screen

buttons

Everything inside the Device Interface components are device dependent, but hidden

from outside; all interfaces to outside of the component should stay stable

NF: Reliability and other components

  • Reliability may be argued many ways:
  • Small cohesive module is by definition more reliable
  • Add user interface to control irrigation both manually and automatically AND also have direct control of the devices

User Interface

Irrigation Control

manual

auto

Virtual Device Interface

valve

Sensor

display

keypad

Screen buttons

Agree with

all the interaction

lines ? Do we need

a new component ?

Emergency

Control

Designer’s view of providing reliability ---- “ not fail often in normal usage”

Design Alternatives

  • Design alternatives are good to have and can improve the design:

  • Generate and document these alternatives as one is developing a design
  • Combine some of parts of the generated design alternatives from:
  • Functional Components
  • Non-functional Components

  • Try to alter and fit to an existing Design Style, if applicable

Architectural Design Resolution

Analyzed

SRS

Architectural Design Process

Develop Architectural

Design Alternatives

Evaluate Architectural

Alternatives

Select Architectural

Resolution

Finalize Software

Architectural Document

SAD

[selected ]

[else ]

Evaluating Architecture Alternatives

  • What does one look at when evaluating architecture?

  • Would the architecture result in a system that will satisfy:
  • Functionality requirements
  • “Quality” (non-functional) requirements
  • Maintainability
  • Reusability
  • Performance
  • Availability
  • Reliability
  • Security
  • Would the architecture result in a system that will
  • Have “great” user interface
  • Delight the customer and the users

We can not tell what will happen since the architecture is not code, we

can only “guess” whether the architecture will most likely meet the above

conditions

An Architecture Evaluating Technique

  • Utilize a “profile,” which is a set of scenarios generated to fit the characteristics of interest. (e.g.)

  • Usage profile is a set of scenarios that describes the user requirements (sometimes known as “business” workflow)

  • Reliability profile is a set of scenarios that portrays the non-functional requirement of how a system behaves to under adverse situations

  • Performance profile is a set of scenarios that portrays the non-functional requirements of how a system behaves under time limit constraints or capacity limit constraints
  • etc.

  • Each architecture is evaluated by going through the scenarios in the profile and assessing whether the architecture, if implemented, would satisfy the profile.

Developing Profiles with “utility tree”

  • A utility tree is a tree whose each sub-tree is a “profile” and the leaves of the sub-tree are the scenarios for that profile

Utility tree

Functionalities

Irrigation control (automatic)

Irrigation control (manual)

Maintenance repair

Hardware adaptability

Valve type modification

Adding new valve types

1. The profiles are generated, using

SRS and some brainstorming

2. The scenarios within each profile

are also developed using SRS, ‘team’

brainstorming, and prioritizations.

3. Within each profile, keep the number

of scenarios to 3 to 10

4. Each scenario should include:

- initial state

- activity flow involving actors and

the product

- post activity state

* think of special circumstances and

non-traditional scenarios

Another Architecture Evaluating Technique

  • Build a “prototype” of part of or the complete software product to evaluate certain aspects (functional and non-functional) of the product.
  • Advantages:
  • Can provide measurements
  • Can provide experiential feedbacks
  • Disadvantages:
  • Prototypes takes resources
  • Prototypes takes time

Much of the prototyping and profiling techniques are aimed at evaluating

the architecture against the “basic” design principles (discussed earlier) :

- feasibility,

- adequacy,

- economy, and

- changeability

Selecting Alternatives

  • How do we select the architecture from the various alternatives ?
  • Evaluate the Pros and Cons of each of the alternatives
  • By Number of pros and cons
  • By Weights of pros and cons
  • Multi-dimensional analysis table (p. 306 of text):
  • Column of scenarios
  • Weight for each scenario (use normalized weight so each is a fraction of the total and the total is 1)
  • Column for each architectural alternative
  • Rate all the scenarios for that alternative ( e.g. 1-5)
  • Score the scenario by multiplying the scenario weight and the rate
  • Sum the scores for that alternative
  • Compare the total score for each of the architectural alternatives

Architectural Design Resolution

Analyzed

SRS

Architectural Design Process

Develop Architectural

Design Alternatives

Evaluate Architectural

Alternatives

Select Architectural

Resolution

Finalize Software

Architectural Document

SAD

[selected ]

[else ]

Finalizing The Architectural Design

  • This step ensures that the selected architecture does satisfy the various functional and non-functional requirements (and possibly may delight the users) and is clearly documented.

  • Architectural design satisfying the “basic” design principles of:
  • Feasibility
  • Adequacy
  • Economy
  • Changeability

  • The SAD document itself is
  • Well formed (organized)
  • Complete (include all the components/relationships/descriptions)
  • Clear (understandable by others)
  • Consistent (no conflicting information)

(from chapter 8 of text)

Design Review in Finalizing the SAD

  • A Review is an examination and evaluation of the work by qualified and affected stakeholders

There are many different types of “reviews”:

1. Desk Check – by the author

2. Walkthrough – informal review by team members

3. Inspection – formal review by a trained inspection team with moderator

4. Audit – review conducted by experts who are not part of the team

5. Active Review – inspection by experts who answer specific aspects

of the design (this allows pinpoint reviews and is less

costly)

An inspection requires 3 formal steps:

- preparation

- conducting the inspection

- rework and inspection “closeout” report

Questions

New folder/L12-Detailed Design-Midlevel.ppt

Detailed Design

Software Architecture

*

A Generic Software Engineering Design Process

*

Detailed Design

SRS

Design

Doc.

Design

Analysis

Architectural

Design

Detail

Design

Swft Engr. Design

Analyzed

SRS

Detailed Design Process

Generate/Improve Detailed

Design Alternatives

Evaluate Detailed

Design Alternatives

Select Detailed

Resolution

Finalize Detailed

Design

Detailed

Design

Doc

[selected ]

[else ]

SAD

Analyze SRS and SAD

Architectural Design

Analyzed

SRS

Architectural Design Process

Develop Architectural

Design Alternatives

Evaluate Architectural

Alternatives

Select Architectural

Resolution

Finalize Software

Architectural Document

SAD

[selected ]

[else ]

Detailed Design

SAD

Detailed Design Process

Generate/Improve Detailed

Design Alternatives

Evaluate Detailed Design

Alternatives

Select Detailed Design

Finalize Design

SDD

[selected ]

[else ]

Detailed Design

  • Detailed Design starts with Software Architecture Design (SAD) and fill in the details of the architectural components - - - may cause re-work on SAD, too.

  • There is no “fixed” boundary between SAD and Detailed Design - - - it is not strictly sequential & we may iterate back and forth.

Detailed Design

  • Detailed Design has 2 levels:

  • Mid-level (this lecture set)
  • Low-level (later lecture)

  • Detailed Design may be:

  • Static: non-execution oriented (mostly this lecture set)
  • Dynamic: execution oriented (next lecture set)

*

Mid-level Detailed Design

  • Mid-level design is the activity of specifying software at the level of medium-sized components.

Mid-level Detailed Design

  • The mid-level design specifications include (DeSCRIPTR):
  • Decomposed mid-level components
  • States of these components
  • Collaboration among these mid-level components
  • Responsibilities of each of these mid-level components to perform some task or maintain data
  • Interfaces that these mid-level components use to communicate with each other
  • Properties (such as security, reliability, performance) of these components must be specified.
  • Transition of states and state behavior of these components are described
  • Relationships (inheritance, aggregation, composition, etc.) among the components

*

Low-Level Detailed Design

  • In contrast to mid-level, low level detailed design fills in the details for programming purpose (PAID):

  • Packaging of the code into compilation unit and libraries is decided
  • Algorithms are described in detail steps
  • Implementation issues such as visibility and accessibility of entities and low level relationships among entities are described
  • Data structures and data types are specified

Sample: Detailed Design Document Content

  • Mid-Level Design Models (in the form of Class diagrams, sequence diagrams, state transition diagrams, etc.)

  • Low-Level Design Models (specific algorithms, data structures, implementation guidelines for non-functional attributes such as security or performance)

  • Mapping between Models (showing how the models are related)

  • Description of Design Rationale (describing the design decisions made and factors that contributed to the decision)

  • Glossary of terms and acronyms used

very important

average important

Static Descriptions (Design)
(based on text book & thus OO Biased )

  • Classes
  • Associations Among Classes
  • Generalization and inheritance (“is a” relationship)
  • Interfaces of classes
  • Aggregation (“part-whole” relationship) &Composition

Rest of this lesson lecture notes will focus on the following:

*

Class Generalization and Inheritance

  • Generalization is a “parent-child” or “sub-typing” relation between classes:
  • e.g. dog “is a” animal

  • Association represents relationships between instances of classes
  • A person “works” for a company; company “has” a number of buildings

fish

salmon

whale

Generalization

person

company

Association

Works for

*

0..2

Abstract Class for mid-level design

  • In design we may not fill in all the details of a design.
  • Abstract class is an example of such a situation.
  • An abstract class is a class that can not be instantiated because it contains a method or operation without the body.
  • Useful as a parent-class which is inherited by some child-class that has “implemented” the method that has no body.

<<abstract>>

animal

move ( ) {abstract}

fish

dog

bird

Each of the sub-classes:

- fish

- dog

- bird

will have a different move( )

operation that needs to be

“implemented” differently

We use abstract class as a design for the purpose of enforcing a certain

set of common attributes and operations that must be inherited by all descendants

If we do not use

stereotype descriptors,

then we must italicize

to show abstract class

*

Interfaces for mid-level design

  • Interfaces are important in design because it shows the relationship of dependencies (of features - attributes or/and operations)
  • Earlier we have discussed the provided and the required interfaces, along with the “ball” and the “cup” to indicate the provider of the feature versus the dependent of that feature.
  • Here we show another notational approach

temperature

gauge

temperature

gauge

<<interface>>

temperature

UpdateTemp (temp: object)

GetTemp ( ): object

thermostat

thermostat

Provided

interface

Required

interface

temp: object

Differentiating “Part-Whole” Relationship Concepts

  • Aggregation is a part-whole association.
  • Composition is a special kind of aggregation where the part may only belong to one whole at any time.

Replenish-list

Sold-item

list

item

An Item may belong to the

replenish-list and may

also be on the sold-item

list. Is the aggregation symbol

1…*

1…*

kitchen

house

subdivision

A kitchen belongs to only one house,

which in-turn sits in only one subdivision.

is the composition symbol.

Transitivity Property

  • Note that some relationships may look like an aggregation.

1. Person Z is biologically-related to father y; father y is biologically

related to family x. The person Z is biologically related to the family x.

(this is a transitive relationship --- thus an aggregation)

2. Joe is a member of a church y; church y is a member of entities that

don’t pay taxes. Is Joe a member of entities that don’t pay taxes? --- but

Joe pays taxes! (be careful with is “a member of” versus “possess the

characteristics” of )

“Coming Up with” or Drafting the Mid-Level Design

  • This discussion is primarily OO-based; thus the aim is to come up with mid-level design of classes

  • Creational technique :
  • Decomposition based on functionality, “quality” attributes, or both (just as we did for High Level Design)

  • Transformational technique:
  • Converting the conceptual (problem) model to a draft design model (much as what was done with High Level Design)
  • Requires a good SRS and SAD or
  • Transforming a previously completed, similar design

For experienced people, they usually have some previous, similar design in

their brain and would draw upon that first--- and then create more

Creational Technique

  • Generating Classes from Themes

  • Developing a list of classes and the class diagram

  • Review and improve the class diagram

Creational Technique

  • Generate a Design Story (based on what you think are the most important aspects of the solution); list the key “themes” in the story.

  • Use the themes and “brainstorm.” For each theme identify and list:

  • Entities in charge or involved in the theme
  • Things that interact with the solution part of theme
  • Things whose data needs to be stored
  • Any structure or collections of entities

Generating

Classes from

Themes

Creational Technique

  • From the list in step 2, generate “candidate”

classes.

  • List their names
  • List their responsibilities

4. Evaluate the list of classes:

  • Discard those that seem to be unclear in name or responsibilities
  • Rework those classes that have overlapping responsibilities
  • Discard those that seem to be “out of scope”

5. Draft an initial Class diagram showing

  • Classes, each with attributes and operations
  • Associations among classes

Developing

a list of

classes and

the class

diagram

Creational Technique

  • Check the Class Diagram:

  • Check each class for missing/inaccurate attributes and operations
  • Combine common attributes and operations into a super-class, if necessary
  • Look for “required’ and “provided” components (using design patterns)

Review and

improve the

class

diagram

Transformational Technique

  • Start with the conceptual model (requirements and high level design) and convert the actors in the conceptual model to interface classes.
  • Add data collection classes for all those actors whose data needs to be recorded
  • Add a start-up class to start the execution of the solution.
  • Convert controllers and coordinators in the conceptual model into classes and add any that needs to be included as control and coordination classes.
  • Data types with complex structure in the conceptual model needs to be converted to classes
  • Decide on whether container classes are needed, include them if necessary
  • Add Associations and interfaces; draft the class diagram

Some Static Modeling Heuristics
for mid-level design

  • Responsibility driven decomposition
  • Inheritance
  • Delegation

Responsibilities Driven Decomposition

  • Responsibility is an obligation to:

  • Perform a task (operational responsibility)

  • Maintain some data and non-functional information (data responsibility)

  • Responsibility driven decomposition

  • Generating lower level operational responsibility components based on decomposing the high-level operational responsibilities

  • Generating lower level data responsibility components based on decomposing the high-level data responsibilities

  • Responsibility and design principles (cohesion and coupling)

  • Assign a module (class) with at most one operational responsibility and one data responsibility - - - cohesion
  • Assign complementary data and operational responsibilities together- - - cohesion
  • Make sure module responsibilities do not overlap - - - cohesion and coupling
  • Do not place extra operational and data elements into a module - - - cohesion
  • Make sure that all needed operational and data elements are included in the module to fulfill the responsibilities - - - coupling

Starting a Design

Consider designing a component dealing with a bank account.

A bank account handles the deposit and withdrawal of that account.

Each bank account is owned by one to three people. Information about a

bank account such as owner, open date, account type must be kept and

maintained.

Account

amt : real

total_amt:real

act_num: int

Deposit (amt : real, act:int )

Wdraw (amt : real, act ;int)

Capture the Ownership Information & Relationship

Account

amt : real

total_amt:real

act_num: int

Deposit (amt : real, act:int )

Wdraw (amt : real, act ;int)

Owner_Info

addr : string

Tel : int

ss_num: int

B-date: date

Act_num : int

.

setaddr ( )

getaddr ( )

.

.

*

1..3

Account_info

Discussion on Cohesion and Coupling

Consider designing a component dealing with bank account and

account information

Account

amt : real

total_amt:real

a_num: int

deposit(amt : real, a_num:int )

wdraw (amt : real, a_num ;int)

Account_Info

owner: string

act_type:real

act_st_date: date

act_num: int

getOwner (act_num: int) string

setOwner (act_num:int, owner:string)

.

.

Should these be combined as one Class or left separately?

(cohesion and coupling trade-off ?)

0..1

1

More Discussion on Cohesion and Coupling
(cont.)

Account

amt : real

total_amt:real

a_num: int

deposit(amt : real, a_num:int )

wdraw (amt : real, a_num ;int)

Account_Info

owner: string

act_type:real

act_st_date: date

act_num: int

getOwner (act_num: int) string

setOwner (act_num:int, owner:string)

.

.

Should these be somehow combined or left separately?

(cohesion and coupling trade-off ? – and db performance ?)

Owner_Info

addr : string

Tel : int

ss_num: int

B-date: date

.

.

setaddr ( )

getaddr ( )

.

.

Inheritance

  • Inheritance is a generalization relationship between a super-class and its sub-classes.
  • Inheritance provides a mechanism for re-use in mid-level designs.

1. Combine common attributes and operations in similar classes into a

super-class

2. Use inheritance only when there is a generalization relationship

between the super-class and its sub-classes.

Delegation

  • Delegation is a mechanism to decompose the responsibilities and assign some of the responsibilities to different classes.

  • This allows classes to re-use a class that has been given a set of responsibilities that is needed by other classes.

Questions

*

*

*

*

*

Generic Software Engineering Design

SRS : Problem

Design Document : Solution

Analysis

Architectural

Design

Design

Document

SRS

[adequate architecture]

[else]

[adequate detailed design]

[adequate architecture]

Analyze SRS

Generate/Improve

Candidate Architectures

Evaluate Candidate

Architectures

Select Architecture

Finalize Architecture

Generate/Improve Detailed

Design Alternatives

Evaluate Detailed

Design Alternatives

[else]

Select Detailed

Design

Finalize Design

[else]

Detailed

Design

New folder/L13-Sequence Diagrams.ppt

Interaction Design &
UML Sequence Diagram

Software Architecture

Chapter 12

Interaction Design &
UML Sequence Diagram

  • Once we have decomposed the system and designed the individual components (classes), we need to depict how these pieces collaborate to deliver the services.

  • The interactions among the individual participants (classes) can be captured with different UML notations, but mainly through Sequence Diagrams

  • Sequence diagram depicts the message flow among the participants and thus depicts the collaboration among the participants.

General Sequence Diagram

  • It is composed of a diagram frame:

1) with an identifier name

2) the individual participants (classes) in the form of “lifeline” composed of:

  • A rectangle depicting the participating object
  • A dotted line that extends for the time period of the interaction

3) messages to communicate among the participants

order process

client

order

inventory

create

Locate item

Message Arrows for Communications

  • The message arrows represents the communications between two objects in sequence diagram. It goes from the lifeline of one object to that of another object

  • Synchronous message where the sending object suspends action and waits for the response to the message

  • Asynchronous message where the sending object continues with its operations without waiting for the response

  • A return of control from the synchronous message

  • A creation of a new entity

(filled head)

(open head)

Message Specification

  • Every synchronous and asynchronous arrow must be labeled with a message specification on top of the message arrow.
  • The message format :

return_variable_name = message_name (param_list)

  • Both the return_variable_name and the = sign are suppressed if there is no return value
  • message_name is never suppressed (required field)
  • param_list is a list of arguments separated by commas and is suppressed when there is no argument

See page 364 for details

of param list

Examples of Sequence Diagram’s message specification

  • age = getAge or age = getAge( )
  • message specifies that the return value from getAge operation is assigned to the variable age. Note that age is a variable accessible by the object that sent the message

  • checkStatus (flag = status, machine)
  • message specifies that checkStatus operation passes a parameter and gets back the status information which assigned to a “local” variable, flag. (local meaning the object that sent the message)

Execution Occurrence in Sequence Diagram

  • An operation is executing when a process is running
  • An operation is suspended when it sends a synchronous message and waiting for a return message.
  • An operation is considered active when it is either executing or suspended
  • An object is active if one or more of its operation is active. While an object is active it is shown with an execution occurrence (a thin rectangle covering the dashed line).

  • A synchronous message always initiates a new execution occurrence

(e.g. Order in the diagram)

sample

client

order

inventory

create(ord)

locate_item(i)

Interaction Fragments

  • Sequence diagram depicts the interactions among the entities. The natural flow of “control” in the diagram is sequential from top to bottom and follows the direction of the message arrows. The natural sequential control can be broadened with Iteration Fragments:

  • Optional Fragment ( “if –then” )
  • Alternative fragment ( “if-then-else-if - - -” or “case” )
  • Break Fragment ( “break” )
  • Loop Fragment ( iterations or “loop” )

Note that these fragments are like the control structures that exist in

a programming language.

Depicting a Fragment Graphically

sd sample

client

order

inventory

create

Locate item

operator

op1

Interaction

Fragment

Interaction

Fragment

Operation

Name:

(e.g. loop)

Interaction Fragment

Operand

Depicting an Optional Fragment

sd sample

client

order

inventory

create_order

locate_item

Opt

cr_custinfo()

Interaction

Fragment

Interaction

Fragment

Operation

Name:

(optional)

Interaction Fragment

Operand

[new_cust]

Interaction

Fragment

guard

The Optional Fragment has only 1 operand and guard in brackets. A guard

is a Boolean expression. The Optional Fragment is performed if the guard is true at

that point of the interaction. It is like the “if” structure of programming language

Depicting an Alternative Fragment

sd sample

client

order

inventory

Cr_order( )

Alt

cr_custinfo()

Interaction

Fragment

Interaction

Fragment

Operation

Name:

(Alternative)

Interaction Fragment

Operands

[new_cust= no]

Interaction

Fragment

guard

The Alternative Fragment has multiple mutually exclusive guards in brackets. The

operand associated with the true guard is executed. This structure is like the “CASE”

or “if-then-else-if” constructs of the programming language

[new_cust=yes]

get_custinfo()

Depicting an Break Fragment

sd sample

client

order

inventory

Cr_order( )

Alt

cr_custinfo()

Interaction

Fragment

Operation

Name:

(Break)

[new_cust= no]

The Break Fragment has a single operand which is processed if the guard is “true,”

and the rest of the processing in the diagram is not performed. It is like the “break”

construct in programming language.

[new_cust=yes]

get_custinfo()

break

[ ! good_status]

error_msg( )

The guard

expression of

NOT good_status

Depicting an Loop Fragment

sd sample

order

inventory

Loop

Process_item()

Interaction

Fragment

Operation

Name:

Loop (min,max)

The Loop Fragment is expressed as Loop(min,max). The loop is performed at

least min times and at most max times. If neither min or max is specified, then min=0

and max is unlimited. If the loop is performed min times but less than max, then it is

performed again as long as the guard is true. The default value of guard is true.

[more]

more = has_item(n_it)

The guard

expression of

[ more]

iterator

more = has_item (n_it)

checking for

more items

n_it = check_items()

create

Some Sequence Diagram Guidelines

  • Pick a design level (based on the classes in the static model) and “be consistent” at that level through out the interaction diagram.
  • Put the sender of the first message leftmost
  • Put pairs of entities that interact heavily next to each other
  • Position the entities to shorten the message arrows
  • Position the entities to make the message arrows go from let to right
  • Suppress return arrows as much as possible when using execution occurrences

Some Thoughts on Designing

  • Design is not a sequential process but much more iterative: (“Component/Interaction” Co-Design)
  • Design (generate) the components in terms of entities (with class model and express in class diagram)
  • Design the interactions among the classes (express in sequence diagram)

  • Design is not a single level process. but more top-down: (Outside-In Design)
  • Top may be viewed as external (requirement level)
  • Down may be viewed class model and interactions representing deeper levels of solutions
  • And we progressively move into more details (inwards)

Iterate the above as we evaluate, alter, and improve the model

(See pages 376 -380 example in your book)

Some details on evaluating interaction alternatives
(Example)

SD polling

waterHeatercntrl

clock

loop

opt

time=getTime

[time right]

takeAction

SD notification

waterHeatercntrl

clock

loop

opt

time=getTime

[time right]

takeAction

notify

waterHeatercntrl is constantly

polling the clock with a fixed

rate. - - - efficient for waterHeatercntrl?

clock is constantly checking time and notifies

waterHeatercntrl when the time arrives, then waterHeatercntrl takes action.

Which one would you pick and why ?

Also, note the synchronous message creates an execution occurrence

On Control Mechanism

  • In designing, one of the issue is on “point of control,” or the controller, which makes decisions and directs other components.
  • There are three major ways to establish control:
  • Centralized control where all decisions are made by one or two entities and the rest of the entities receives directions from them

  • Delegated control where only the main decisions are made by one or two “main” entities, other decisions are delegated to lower level entities and coordinated among the entities.

  • Dispersed control where decision making is spread out widely, with no easily identifiable coordinating entity or entities.

Centralized Control

  • Should be used only when the solution is small and only a few decisions are involved. (easy to find control point)
  • Lots of drawbacks:
  • Centralized control can be “bloated” and too big to manage
  • May be less cohesion when too much varieties of decisions are being made
  • May increase coupling between the controller and other entities which merely act as data store or simple functions
  • Information hiding can not be easily achieved

Central contrl

Heuristics to Avoid Centralized Control

  • Avoid interaction design where most messages originate from single component
  • Keep components small so that there can not be a “bloated” controller. (This is not very different from the traditional advise on keeping modules small - - - how small is small? --- cohesion?)
  • Make sure that operational responsibilities are not assigned to just a few components.
  • Make sure operational responsibilities are consistent with data responsibilities. (what happens if they are not? - - - you may have less cohesion among methods in a class )

Look at diagram 12-3-3 on page 386: it is an over-centralized control design:

- AutoCycle delegates nothing and is coupled with all other objects

- it lacks cohesion in that it is doing all types of details

- it is too big in size because it contains all the low level activities

Delegated Control

  • Control is in more entities – smaller in size
  • Information hiding is easier with different control points
  • Increased cohesion with delegated points of control
  • Each controller is coupled to less entities. (over-all # of couplings may not decrease)

Delegated contrl

Heuristics for Delegated Control

  • Delegated control is the ideal case we are after.

  • Ensure that each component is responsible for “high level” tasks and as much of the lower ( more detailed, less functional, just different functional areas, etc.) level tasks are delegated as possible.
  • The lower level tasks may be performed in a more collaborative manner among several other components.

Look at diagram 12-3-4 on page 387, where AutoCycle delegates some

responsibilities to Zone. This is mush less coupled and more cohesive

design along with a certain amount of encapsulation of information.

Dispersed Control

  • Too many controls and hard to figure out the interactions:

  • Too much interactions among the entities – high coupling among the parts and possibly very low cohesion within each entity.

Heuristics for avoiding Dispersed control

  • Basically, avoid situations where every component is sending a lot of messages to other components.

  • Ensure that there is not an over-delegation, where each component is responsible for too a small portion of the whole and there are a lot of components involved in accomplishing anything.

Control and Communications

delegated &

hierarchical

centralized &

wheel

dispersed &

all-member

[(n x (n-1))/ 2]

potential coupling

(n-1) potential coupling

but deceiving because - -?

(n-1) potential coupling

but deceiving because - -?

Law of Demeter for OO Interaction Design

  • An operation (method M) of an object, Obj, should send messages only to the following:

  • Within the object, Obj, itself
  • Methods within Obj
  • Attributes of Obj (its instance variables)
  • Argument of the operation (parameters of method M, which may be some object)
  • Elements of a collection that is an argument of the operation or an attribute of the object, Obj.
  • Objects created within the operation (objects instantiated within the method M)
  • Global Classes or objects

The Law of Demeter is meant to help in : (1) information hiding;

(2) lessening centralized control

Note that objects that are returned by messages sent to other object is not included.

“ Talk only to your immediate neighbors”

Example from page 375 of text

  • Design a water heater controller based on:
  • Caldera is a smart water heater controller that attaches to the thermostat of a water heater and provides more efficient control of water temperature to save money and protects the environment.
  • Caldera sets the water heater thermostat high when hot water is much in demand and sets it low when there is no much demand. For example:

  • Caldera can be told to set the thermostat high on weekday mornings and evenings and all day on weekends.

  • And low during the middle of the week days and nights.

  • Caldera can be told to set the thermostat high all the time in case of illness or other needs.

  • Caldera can be told to set the thermostat low all the time in case of vacation or some other prolonged absence from house.

Your Caldera Design may progress as follows:

heaterController

thermostat

set_temp

sd Caldera

heaterController

thermostat

set_temp( )

1. Class Model

2. Class

Interactions

Your Caldera Class Design (further Refinement) ?

heaterController

thermostat

set_temp

calendar

clock

manual

notify_time

notify_date

special_set

3. Further “Refined” Class Model

Your Caldera Interaction Design (further Refinement) ?

sd Caldera

heaterController

thermostat

Set_temp( )

Calendar

Clock

manual

Set_temp( )

Special_set( )

Notify_date( )

Notify_time( )

4. Refined Class Interactions in Sequence Diagram

Further Evaluate and Improve the Caldera Design

  • Consider the notion of adding another entity to represent the notion of “load scaling” or “temp scaling” which traps the inputs from clock and calendar and sends the controller a binary high or low signal.

  • Consider the manual override to go directly to thermostat and be equal to the controller.

Draw the Class diagram and the Sequence diagram for these concepts,

evaluate and see if they are indeed improvements:

- cohesion

- coupling

- size

Questions

New folder/L14. Dynamic Mid-Level State Based Design.ppt

Dynamic Mid-Level State-Based design

SWE 6653-Software Architecture

Chapter 13

Finite State Machines (FSM)

  • An FSM consists of a finite set of input symbols, I, a finite set of states, Q, a specific state, S, called the starting state, and a transition function, F, from

{input x state} to {state}.

State Transition Diagrams

  • A state transition diagram is a technique to depict:

  • The states of an entity
  • The transitions of states of the entity
  • The trigger or the event that caused the transition of state of the entity

  • The entity may be a physical device such as a light switch or a vending machine; it may be a software system or component such as a word processor or an operating system; it may be a biological system such as a cell or a human; or - - - -

Software Program View

  • The end product of a software is a program which executes. In depicting the program (or an object) we can consider:

1. Variables which take on different values

2. Control structure and assignment statements in the program change the values of the variables

1. Combination of values of the variables at any point of the program represent the program state at that point.

2. The change made to the values of the variables through assignment statements represent a transition of state

A very simple example
light switch

From

State

(light)

to

State

(light)

Event

(switch)

on turnOff off

off turnOn on

“State transition table”

for light with switch events

on

off

turnOff

turnOn

“State transition diagram”

for light with switch events

A little more on the light switch

off

turnOff

turnOn

on

off

turnOff

turnOn

on

What happens if we turn on

a light that is already on?

turnOn

turnOff

state “transition” to its

current state

Using State Transition Diagram

  • Model the entity at the level where the number of states is “manageable.”

Using State Transition Diagram

- Design (list) the number of states (should not be big)

- List the number of events that will trigger the state transition (should not be big)

- There must be an starting state

- There must be a terminating state or states

- Design the transition rules (where the bulk of your design work is)

- The above is not necessarily performed in sequence; iterate through these.

- Even with a modest number of states and events, the state transition diagram, which really depicts the transition rules, can be enormous.

Designing the Voice Recorder
(similar to example on page 397 of text)

  • For the entity, voice recorder, design the states of this entity:

  • How many states does ( somewhat based on requirement ) a voice recorder have?
  • Set of recorder states = { off, on, play, record, erase, stop, error-msg }

  • What are the initial and terminating states?

  • Initial state = {off}
  • Terminating state = {off}

  • List the events that will change the state of the entity:
  • What are the events that will change the recorder’s states?
  • Input signals = { 1, 2, 3, 4, 5, 6 } which corresponds to:

{off, on, play, record, erase, stop}

Designing the Voice Recorder
(example from page 397 of text) – cont.

  • Design the transition rules for the voice recorder

from state

to state

events

off 2 on

on 1 off

on 3 play

erase 6 stop

on 4 record

on 5 erase

play 6 stop

record 6 stop

stop 3 play

stop 4 record

stop 5 erase

stop 1 off

More transition rules:

1. Any state transition not described

here will transition to error-msg state

2. once in error-msg state, the system

“displays a message” and

automatically transitions to stop state.

off 1 off

{1=off, 2=on, 3=play, 4=record, 5=erase, 6=stop}

State Transition Diagram of
Voice Recorder

On

play

erase

record

stop

Error-msg

2

1

1

3

5

4

6

6

6

3

5

[always true]

1

4

Off

{1=off, 2=on, 3=play, 4=record, 5=erase, 6=stop}

Finite State Machine (more original usage)

S1

S2

S3

S4

0

0

0

0

1

1

1

1

M1 = {A, S, T, I, term}

where:

A = {0, 1}

S = {s1, s2, s3, s4}

T = {(s1,0)-> s2; (s1,1) -> s4; -----}

I = s1

term = s1

Pseudo code for the design of M1:

Read input string;

If input string includes non - 0’s or 1’s, error msg; break;

if input string length is odd number, error msg; break;

Set state = s1;

While (the string is non-empty)

{ ele = first element from the string

delete the first element from the string

if (state = s1 & ele = 0) then state = s2

if (state = s1 & ele = 1) then state = s4

if (state = s2 & ele = 0) then state = s1

if (state = s2 & ele = 1) then state = s3

if (state = s3 & ele = 0) then state = s4

if (state = s3 & ele = 1) then state = s2

if (state = s4 & ele = 0) then state = s3

if (state = s4 & ele = 1) then state = s1

}

if (state = s1) accept string

else error msg ;

end

M1 is a string checker that accepts all strings that contain even number of 0’s and 1’s

Example

  • For an additional example, see page 400 (Vending Machine)

State Diagram Heuristics

  • Label transitions

  • Check that no arrow leaves a final state

  • Label states with adjectives or verb phrases

  • Name events with verb phrases or with noun phrases describing actions

  • Name actions with verb phrases

  • Combine arrows with the same source and target states.

READ AT LEAST ONE EXAMPLE FROM THE TEXT ON YOUR OWN.

Questions

New folder/L15. Low-Level Detailed design.ppt

Low-Level Detailed Design

Chapter 14

Low-Level Detailed Design

SAD

(Soft Arch Design)

Mid-level

Detailed Design

Low-Level

Detailed Design

Design Finalization

Design

Document

Low-level Detailed Design

  • Once mid-level design is complete (Class, interactions among Classes, state transitions of the class/system), there are a few more topics that need to be explored at the detail level:

  • Packaging and Information Hiding (visibility and accessibility)
  • Operation Specification to provide more processing details
  • Details of algorithms and data structures
  • Design Finalization

Information Hiding

  • Information Hiding is a Design Principle discussed earlier that applies to every level of design

  • Information Hiding is the hiding of design decisions in a system that are most likely to change so that other parts of the system will be minimally impacted should the design really change.

  • The techniques of information hiding includes:

  • Limiting visibility
  • Not extending access

Notion of Visibility

  • A program entity (a variable, a module, a class, a method, etc.) is visible at some point in a program if it can be referred to by name at that point.

  • The portion of the program where a program entity is visible is the entity’s visibility

Types of Visibility

  • Local visibility: the programming entity is visible only within the module where it is defined.

  • Non-local visibility: the programming entity is visible outside the module where it is defined, but not visible from everywhere.

  • Global visibility: the programming entity is visible from everywhere.

In general, we want to design our program entity to be visible in as small a

region as possible to minimize any impact to potential future changes.

OO Visibility and Types of Visibility

  • Public visibility : entity may be global or non-local depending on whether the entity is defined as public in a public Class (global) or in a non-public Class (non-local)
  • Package visibility: entity is non-local in that it is visible in the Class where it is defined as well as all Classes in the same package
  • Protected visibility: entity is non-local in that it is visible in the Class where it is defined and all its sub-classes
  • Private visibility: entity is local in that it is only visible within the Class where it is defined

Notion of Accessibility

  • A program entity is accessible at a point in a program if it can be “used” (read or change its value) at that point.

  • A program entity is accessible everywhere it is visible. But it may still be accessible when it is not visible. { visible is a subset of accessible}
  • Accessing a variable without visibility can happen when we operate with “pointers” or “reference”
  • Making a variable accessible in a portion of the program where it is not visible is called “extending access beyond visibility”

Generally, we should not extend access beyond visibility except possibly for:

- sharing of the variable

- performance

Information Hiding Heuristics

  • Limit Visibility:
  • Make program entities visible in the smallest possible program region
  • Restrict the scope of declarations to the smallest possible program region
  • Make Class attributes at least protected and preferably private
  • Make class helper operations at least protected and preferably private
  • Avoid global visibility
  • Avoid package visibility

  • Don’t Extend Access:
  • Use “defensive copies” instead of actually changing the original variable when the “pointer” of the variable is passed
  • Don’t pass parameters by reference (pointer)
  • Don’t make aliases

Operations Specifications

  • At the low-level detailed design we need to specify more details than the Class, interactions among class, and the state transitions. We need to provide more details in an Operations Specification concerning the behavior of the program:

  • Class or Module: identify the operation
  • Signature: the operation name, interfaces (parameter types and return type) ---- the “syntax” of the operation
  • Description: couple of sentences describing the operations responsibilities
  • Behavior: a detailed account of what the operation does, any constraints on the parameters and operations, what exception handling is performed, etc. ----- the “semantics” of the operation

  • Implementation: Additional details on algorithms and data structure used for the implementation

More on Behavior Specification

  • 2 ways to describe the behavior

  • Declarative: describe the inputs, constraints on the operations, and the resulting outputs

  • Procedural: describes the sequence of steps that transforms the inputs to the outputs (even though the programmer may choose another algorithm to implement the behavior)

The preferred way is to use the declarative specification unless there is

a specific algorithm or data structure that the designer wants the programmer

to use.

Example from page 441 of text

public static int findMax ( int [ ] a )

throws IllegalArgumentException

Declarative specification: The operation findMax accepts a non-null

array of integers with at least one input and

returns the largest value element of that array

of integers

Procedural specification: - The operation findMax is public and static because the

method can be invoked through the name of the Class

- It accepts a non-null array of integers.

- If the array is null or has no element, then an

IllegalArgumentException is thrown.

- Otherwise, the operation saves the first element

of the array in a variable, temp-max. Then each of the

remaining array elements is compared against the

variable temp-max. If anyone of the array elements is

larger in value than temp-max, then that element is placed

in temp-max. This continues until all the array elements have

been compared against temp-max.

- The final value in the variable temp-max is returned.

Declarative Specification & “Contract”

  • A Contract is an agreement between the “caller” and the “provider” of the operation.

  • Caller is obliged to provide valid arguments and perform the call under the correct circumstances
  • Provider is obliged to provide the services, if the caller has conducted all its obligations properly.

One way to specify the contract between the Caller and the Provider is to

specify the pre-condition and the post-condition of the operation.

- pre-condition : asserts the conditions that must be true at the initiation

of an operation.

- post-condition: asserts the condition that must be true at the completion

of an operation.

Example of Pre-Post conditions

public static int findMax ( int [ ] a )

throws IllegalArgumentException

Pre: ( int[ ] a is not null ) AND (array a length is > 0 )

Post: throws IllegalArgumentException if pre-condition is not met.

Post: for every element, a[i] of array a, a[i] <= temp-max for all i.

Post: return the value of temp-max

Do we need to clarify what “temp-max” is ?

Invariants

  • Besides the pre and post conditions, we can also specify those conditions that are true between calls to the operation. These assertions are invariants. Invariants need to be part of the Operation Specification along with pre and post conditions.

  • For a Class, invariants

  • Must be established by Class constructors
  • Must be preserved by every exported operation in the Class

1. In the findMax operation, an “invariant” condition is that the variable temp-max contains

an integer. (It is initialized with the first element of the array, which is an integer, and

temp-max may only be replaced by another array element which is an integer. )

2. Another invariant condition is that (min of array a) <= temp-max <= (max of array a).

Heuristics for Specifying Pre, Post and Invariant
Conditions of the Operation’s Behavior

  • Pre-conditions:
  • Specify restrictions on parameters
  • Specify conditions that must already be established
  • Specify empty conditions as either (true or none)

  • Post conditions:
  • Specify relationships between the parameters and the outcome
  • Specify restrictions on the outcome
  • Specify any changes to the parameters (e.g. parameters by reference)
  • Specify responses to violated preconditions (e.g. exceptions)

  • Invariant conditions:
  • Specify restrictions on attributes
  • Specify relationships among attributes

Operational Specification

  • Class name and Signature (or module name and signature)
  • Brief Description of the operation’s responsibilities
  • A detailed specification of the operation’s Behavior using:

  • Declarative specification:

  • Pre-conditions
  • Post conditions
  • Invariants

  • Procedural specification:
  • Showing step by step algorithms and data structures

Details of the “Procedural” Specification

  • Algorithm in the form of;
  • Pseudo-code: English augmented with some programming language statements.
  • Natural language statements and symbols.

  • Data structure in the form of:
  • Tree
  • Table
  • List
  • etc.

Abstract Data Type (ADT) is a combination of :

(a) data structure

(b) operations to manage the data structure

Design Finalization

  • Complete the Low-Level Detailed Design with a review of the “last” design document and a final review of all the previous design material:

  • Software Architecture Document (SAD)
  • Detailed Design Document (DDD)
  • Low-Level Design in the DDD

Design Finalization Review

  • The designers check the design for:
  • Completeness (all of the DeSCRIPTOR items and the details of packaging, interfaces, algorithms and data structure)
  • Well-formedness (proper notations)
  • Clarity (organized and easy to read)
  • Consistency (no conflict)
  • After the above is fixed, then the design is checked for:
  • Feasibility (can be implemented)
  • Adequacy (meet the functional and non-functional requirements)
  • Economy (meet the budgetary and schedule requirements)
  • Changeability (meet the requirements of maintenance/support)

Questions

New folder/L16. Architectural Styles.ppt

Architectural Styles (Patterns)

Chapter 15

Architectural Styles

  • An Architectural Style defines a set of rules that describe

  • the properties of and constraints on its components and

  • The way in which the components interact

Architectural Styles (Patterns)

  • Architectural Styles may be viewed as a set of Architectural Design solutions that have been used successfully before.

A software design pattern is a model for a class of solutions to a software design problem. At high level we call these patterns architectural styles.

  • These styles (or patterns) offer multiple benefits:
  • Promote communications among the designers because the pattern names are used as a shorthand for a lengthy description

  • Streamline documentation for the same reason above (last slide)

  • Support high level of reuse if the pattern is applicable

  • Improve development efficiency and productivity for above reasons and not having to profile or prototype all the existing patterns

  • Provide a starting point for additional and new design ideas.

Software Design Patterns

  • Software Design Patterns is a recent event, although programming level patterns have been studied in our industry such as Sorts, Search, Access Methods, etc.

Design Patterns come in different levels

1. - the high level architecture is not detailed enough and should only serve as a guideline pattern for further

refining

2. - the middle level ones is where the current work is focused on and may be domain dependent

3. – The low level ones (e.g. data structures and algorithms) have been employed relatively successfully via provided libraries

  • A building architect named Christopher Alexander introduced building designs based on “patterns” in the 1970’s and catalogued these designs in a book.
  • Has not been widely accepted by building architects
  • But has influenced the software design community in the last 15 years in terms of cataloguing and using design patterns

Major Architectural Styles (Patterns)

  • Layered Architecture
  • Pipe and Filter
  • Shared (Central) Data Store
  • Event Driven
  • Model-View-Controller (MVC)
  • “Distributed & Emerging” Service Oriented Architecture (SOA)

Layered architecture

Screen

Presentation layer

Logic layer

File layer

1. If any layer only uses the layer directly below

it, then it is a Strict Layered Style.

2. If a layer may use any of the layers below it,

then it is a Relaxed Layer Style

Problems that seem to fit this architecture include tele-comm and op-sys

Layered architecture

  • The high level design solution is decomposed into Layers:

  • Structurally, each layer provides a related set of services

  • Dynamically, each layer may only use the layers below it
  • Using and evoking is not necessarily the same

  • Layer A may use layer B because it depends on something B does (e.g. data written to a db by B to be used by A), but never call upon it.

  • Layer A calls layer B says Layer A passes control or data or both directly to B.

Simple Example with “Mailing Address” Processing

Recipient Name

Street

City

State

Country

Mail processing to establish which delivery plane/truck to distribute the US Postal mail

The sequence is from top layer to the lower layer.

A Simplified “Experiential” Discussion

customer

info valid.

update

order

info valid.

product

info valid.

add

update

update

delete

add

add

delete

delete

Information i/o Layer

cust info in

ord. info in

prod info in

Viewing and designing directly from

functional requirements

Viewing from internal structure

Ending up with layered architecture

Cust. Info

validation

product Info

validation

. . .

Information validation Layer

Info Processing Layer

Add, Delete, and Update

Sample Layered Architecture for OS

Resource (I/O, page,

network, file, etc.)

management

Utilities (editors, sys commands,

compilers, internet

access, libraries, etc.)

kernel (Device & memory

Processing) drivers

Process (classification &

management)

Sample Layered Communications Architecture

Application layer

Presentation layer

Session layer

Transport layer

Network layer

Data Link layer

Physical layer

Advantages and Disadvantages of
Layered Architecture

Advantages

  • Each layer is selected to be a set of related services; thus the architecture provides high degree of cohesion within the layer.

  • Each layer may hide private information from other layers

  • Layers may use only lower layers, constraining the amount of coupling.

  • Each layer, being cohesive and is coupled only to lower layers, makes it easier for reuse by others and easier to be replaced or interchanged (change of DB touches only the data store/access layer)

Disadvantages

  • Strict Layered Style may cause performance problem depending on the number of layers

  • Debugging in Strict Layered Style may be complex (questionable?)

  • May be difficult to decide on the number of layers

Pipe and Filter Architecture

  • Main components:

  • Filter: process a stream of input data to some out put data

  • Pipe: a mechanism that allows the flow of data

read input file

process file

filter

pipe

This architecture style focuses

on the dynamic (interaction)

rather than the structural

Pipe-Filter architecture

  • The high level design solution is decomposed into 2 parts (filters and pipes):
  • Filter is a service that transforms a stream of input data into a stream of output data

  • Pipe is a mechanism or conduit through which the data flows from one filter to another

Input

time cards

Prepare for

Check processing

Process Checks

Problems that require batch file processing seem to fit this: payroll and compilers

An Example

  • See Page 474 of textbook

Pipe – Filter with error processing

  • Even though interactive error processing is difficult, but batch error processing can be done with pipe and filter architecture

Input

time cards

Validate for

payroll processing

Automatically

Process Checks

Manually Reprocess

Card and Cut Check

Payroll report

Do the data streams

need to be synchronized

here for report?

Splitting the good time

cards from the bad ones

Advantages and Disadvantages of
Pipe-Filter

Advantages

  • Filters are self containing processing service that performs a specific function thus it is fairly cohesive

  • Filters communicate (pass data most of the time) through pipes only, thus it is constrained in coupling

Disadvantages

  • Filters processes and sends streams of data over pipes is a solution that fits well with heavy batch processing, but may not do well with any kind of user-interaction.

  • Anything that requires quick and short error processing is still restricted to sending data through the pipes, possibly making it difficult to interactively react to error-events.

Shared Data

  • The high level design solution is based on a shared data-store which acts as the “central command” with 2 variations:

  • Blackboard style

  • Repository style

  • Blackboard style:

the data-store alerts the participating parties whenever there is a data-store change

  • Repository style:

the participating parties check the data-store for changes

Shared Data

Patient

database

physician

diagnosis

pharmacy &

drug processing

Lab testing

accounting

& administration

Very

Common

In

Business

where

Data is

central

  • Problems that fit this style such as patient processing, tax processing system, inventory control system; etc. have the following properties:

1. All the functionalities work off a single data-store.

2, Any change to the data-store may affect all or some of the functions

3. All the functionalities need the information from the data-store

Blackboard Style & DB triggers

  • In database management system we can set up a trigger which has 3 parts:

1) Event

2) Condition

3) Action

1) Event :

change to the database that alerts or activates the trigger

2) Condition:

a test that is true when the trigger is activated

3) Action:

a procedure which is executed when the trigger is activated and the condition is true.

1) A trigger may be thought as a monitor of the database for changes to the database that matches the event specification (e.g. deletion of record) .

2) Then the condition is checked to see if it is true (e.g. deleted record has negative accnt amount).

3) If the deleted record has a negative accnt amount, then kick off a procedure to send error message out and delay the execution of record deletion.

Advantages and Disadvantages of
Shared Data

Advantages

  • The independent functions are cohesive within itself and the coupling is restricted to the shared data

  • Single data-store makes the maintenance of data in terms of back-up recovery and security easier to manage

Disadvantages

  • (common and control couple through data) Any data format change in the shared data requires agreement and, potentially, changes in all or some the functional areas - - this becomes a bigger problem as more functionalities are introduced that have dependency on the shared data.

  • If the data-store fails, all parties are affected and possibly all functions have to stop (may need to have redundant db for this architecture style; also, should have good back up- and recovery procedures.)

Event-Driven

  • The high level design solution is based on an event dispatcher which manages events and the functionalities which depends on those events. These have the following characteristics:

  • Events may be a simple notification or may include associated data (from the event announcer to the event responder)

  • Events may be prioritized or be based on constraints such as time (honored by the event dispatcher)

  • Events may require synchronous or asynchronous processing

(The dispatcher may wait for the operation it invokes to return or execute them without waiting for them to return)

  • Events may be “registered” or “unregistered”

(with the event dispatcher – either arbitrary during execution or decided when the program is coded)

Event-Driven

Personal (device)

dispatcher

voice

call

text

msg

Image

keypad

Phone

processing

Txt

processing

Image

processing

Problems that fit this architecture includes real-time systems such as: airplane

control, medical equipment monitor, home monitor, embedded device controller

Advantages and Disadvantages of
Event-Driven

Advantages

  • The event sensors and the event processors are separate, providing decoupled and individual functionalities.

  • The replacement and additions are independent and thus easier to perform

  • Any sensor or processing malfunction will not affect the other sensors and processors

Disadvantages

  • It is difficult for the dispatcher to react to a myriad of sensor inputs and respond in time (especially on simultaneous inputs)- -

  • the dispatcher is the “single grand connector”

  • A dispatcher malfunction will bring the whole system down

Model-View-Controller (MVC)

  • The high level design solution is based on 3 main components:

  • Models
  • View
  • Controller

  • Models:

the portion that handles the data model and the logic related to the application functions

  • View:

the component that handles the displaying of information to the users

  • Controller:

the component that handles the users needs in terms of accepting the requests and responding to the requests

Model-View-Controller (MVC)

controller

View

model

<< user interface >>

<< app and db>>

<< app and db>>

controller

<< user interface>>

vew

model

<<use>>

<<use>>

Problems that fit this architecture includes most of the inter-active web-applications.

Advantages and Disadvantages of
MVC

Advantages

  • Views, controller, and model are separate components that allow modification and change in each “layer” without significantly disturbing the other

  • The view component, which often needs changes and updates to keep the users continued interests, is separate

  • The View-Controller can keep on partially functioning even if the model component is down.

Disadvantages

  • Heavily dependent on the development and production system environment and tools that match the MVC architecture

Heterogeneous Architectures

  • An architecture that employs two or more architectural styles

Further Discussion on Software Architecture

We have introduced 5 different software architectural style which described

- the layout of the major components

- the interaction among the components

How do you decide on what should be your major components and the layout?

Who provides the mechanisms for the component interactions?

Questions

New folder/L1-Intro SW Design.ppt

Software Design

  • What?
  • What is software design?
  • Why?
  • Why a “good” design matters?
  • How?
  • How can we produce a “good” design?

*

Software Design

  • What?

  • Design is the creative process of transforming the problem into a solution.

*

One Definition of Design (from K. Lano)

  • Design is the activity of constructing components and organizing their interactions in order to achieve the system that will satisfy the requirements.
  • Components:
  • Identifying the components
  • Specifying their functionalities
  • Specifying any constraints (performance, security, etc.)
  • Interactions:
  • Identify and Specify Component relations (inheritance, aggregation, etc.)
  • Identify and Specify Component dependencies (interfaces, joint responsibilities, sequences of interactions, etc.)

Software Design

  • Why?

  • A good software design

  • - reduces risks in software production,
  • - coordinates development teams to work together orderly,

*

Software Design

  • Why? Cont.
  • A good software design
  • - makes the system traceable for implementation and testing, and
  • - leads to software products that have higher quality attributes.

*

Software Design

  • How?

  • How can we produce a “good” design?

  • Will be discussed in this course

Software Design

  • From requirements specifications to design specifications

SRS  Software Design  SDS

SRS: Software Requirements Specifications

SDS: Software Design Specifications

Software Requirements Specification

  • The SRS is the result of requirement analysis; it records the functional and non-functional requirements that must be met by the software system.

Software Design Specification

  • The SDS (SDD) describes the software architecture or high-level design and the detailed design of the system.

  • The SDD describes the components of a system, the modules that comprise each component, and the detailed information (such as data, attributes, operations, and algorithms) of each module.

  • From the SDD, the system is then implemented using programming language/s, which is followed by debugging, testing, and maintenance.

Software Design

  • Software Product Design

  • Software Engineering Design

Software product design

  • is the activity of specifying software product features, capabilities, and interfaces to satisfy client needs and desires.

Also see slides # 16 and 17

Software engineering design

  • is the activity of specifying programs and sub-systems, and their constituent parts and workings, to meet software product specifications.

Also see slides # 16 and 17

Software Design

  • From Page 19 of your textbook

Text

Engineering Design

Product Redesign and
Engineering Redesign

Requirements Specification

Design

Implementation

Testing

Maintenance

Product Design

Software Product Life Cycle

Software Design Problems and Solutions (Page 23)

Design Interactions

Create High-Level Design

Problem: Needs, Desires, Constraints

Solution: Features and Capabilities

Solution: Interactions

Solution: SRS

Solution: Design Document

Create Low-Level Design

Write Code

Solution: Code

Solution: High-Level Design

Solution: Low-Level Design

Product Design

Engineering Design

Design Features and Capabilities

Software Design

Software Engineering Design

Consists of two major steps

  • Step-1: Architectural Design

  • Step-2: Detailed Design

Design

  • Start from requirements
  • How is the software going to be structured?
  • What are the components (Modules)
  • How are these components related
  • Two parts
  • Architectural (high-level)
  • Detailed design

Software Architecture

  • Structure(s) of system, comprising:
  • Software Elements
  • Their externally visible properties
  • Relationships among elements
  • Every system has an architecture
  • Multiple structures
  • multiple ways of organizing elements
  • External properties of modules

Architectural Tactics

  • Solve smaller, specific problems

  • Do not affect overall structure of system

Detailed Design

  • Refine Architecture and match with Requirements

  • How detailed ?
  • Maybe different level of detail for different views

Questions

*

*

*

*

Engineering Design

Product Redesign and

Engineering Redesign

Product Design

Requirements

Specification

Design

Implementation

Testing

Maintenance

Software Product Life Cycle

Engineering

Design

Product

Design

Solution: SRS

Problem: Needs,

Desires, Constraints

Solution: Features

and Capabilities

Solution:

Interactions

Solution: Design

Document

Solution: High-

Level Design

Solution: Low-

Level Design

Solution: Code

Design Features

and Capabilities

Design Interactions

Create High-Level

Design

Create Low-Level

Design

Write Code

Software Design

New folder/L2-Intro SW Architecture.ppt

An Introduction

SOFTWARE ARCHITECTURE

SOFTWARE ARCHITECTURE

  • We had an introduction to software design last week

  • Here we have an introduction to software architecture

Please note: Some of the slides from last week are intentionally repeated here. This helps with better understanding of the materials.

Software architects use various design strategies in software construction to divide and conquer the complexities of a problem domain and solve the problem.

SOFTWARE ARCHITECTURE

SOFTWARE ARCHITECTURE

  • Software architects use various design strategies in software construction to divide and conquer the complexities of a problem domain and solve the problem.

Software Design

  • From requirements specifications to design specifications

SRS  Software Design  SDS

SRS: Software Requirements Specifications

SDS: Software Design Specifications

Software Design

  • Software Product Design

  • Software Engineering Design

Software product design

  • is the activity of specifying software product features, capabilities, and interfaces to satisfy client needs and desires.

Software engineering design

  • is the activity of specifying programs and sub-systems, and their constituent parts and workings, to meet software product specifications.

Software Design

  • From Page 19 of your textbook

Text

Engineering Design

Product Redesign and
Engineering Redesign

Requirements Specification

Design

Implementation

Testing

Maintenance

Product Design

Software Product Life Cycle

Software Design Problems and Solutions (Page 23)

Design Interactions

Create High-Level Design

Problem: Needs, Desires, Constraints

Solution: Features and Capabilities

Solution: Interactions

Solution: SRS

Solution: Design Document

Create Low-Level Design

Write Code

Solution: Code

Solution: High-Level Design

Solution: Low-Level Design

Product Design

Engineering Design

Design Features and Capabilities

Software Design

Software Engineering Design

  • Step-1: Architectural Design

  • Step-2: Detailed Design

Architectural Design

  • During the architectural design step we describe user accessible components and the interconnections among them that are visible to stakeholders.

Detailed Design

  • During the detailed design step we specify the internal details of each component and we might introduce new invisible components – to the stakeholder, into the design.

  • In practice, designers abstract common features such as similar choices on element types and connections into “families of architectures” using the notion of “architectural style.”

  • Each style represents a layout topology of elements, and connections and interactions among these.

  • Quality attributes are closely related to architectural styles.

See next slide for some examples of quality attributes

Quality Attributes

  • Performance
  • Reliability
  • Portability
  • Usability
  • Security
  • Testability
  • Modifiability
  • Etc.

  • Each architectural style supports some quality features.

For example, there is always a tradeoff between system performance in terms of :

  • Time
  • Resource
  • System Reliability
  • Availability.

Software Architecture: Bridging Requirements and Implementation

  • The actual design is a blueprint and a guideline for developing a software system based on the software requirement analysis specification.

  • The architectural design embodies earliest decisions that have a decisive impact on the ultimate success of the software product.

  • As the description of software construction structure, an architectural design must cover the software functional requirements and non-functional requirements as well.

  • It shows how the system is structured in terms of components, and how its components work together.

SUB-SYSTEMS

  • A sub-system is a system in its own right whose operation does not depend on the services provided by other sub-systems.

SUB-SYSTEMS

  • Sub systems are composed of modules and have defined interfaces which are used for communication with other sub-systems.

MODULES

  • A module is a system component that provides one or more services to other modules.

MODULES

  • It makes use of services provided by other modules.
  • It is not normally considered to be an independent system.

Shaw and Garlan (1996)

  • They regard software architecture as the description of elements that comprise a system, the interactions and patterns of these elements, the principles that guide their composition, and the constraints on these elements.

software architecture specification

  • must describe not only the elements and connections between elements but also the constraints and runtime behaviors.
  • This helps with what?
  • (Think about it, and then see next slide)

software architecture specification

  • must describe not only the elements and connections between elements but also the constraints and runtime behaviors so that developers know what must be implemented and how it should be implemented.

Software architect’s tasks

1. Perform system static partitioning and decomposition into sub-systems and communications between sub-systems.

Software architect’s tasks

2. Establish dynamic control relationships between different sub-systems in terms of data flow, or control flow orchestration, or message dispatching.

Software architect’s tasks

3. Consider and evaluate alternative architecture styles for the problem at hand.

Software architect’s tasks

4. Perform trade-off analysis on quality attributes and other non-functional requirements during the selection of architecture styles.

Software architect’s tasks

5. Map the software requirements specification to the software architecture and guarantee that the software architecture satisfies functional and non-functional requirements (very important task).

Architectural Styles

  • An architectural style (also known as “architecture pattern”) abstracts the common properties of a family of similar designs.

Architectural Styles

  • An architectural style contains a set of rules, constraints, and patterns of how to structure a system into a set of elements and connectors.

Architectural Styles

  • It governs the overall structure design pattern of constituent element types and their runtime interaction of flow control and data transfer.

key components of an architectural style

  • Elements
  • Connectors
  • Constraints
  • Attributes

  • Elements that perform functions required by a system

  • Connectors that enable communication, coordination, and cooperation among elements

  • Constraints that define how elements can be integrated to form the system

  • Attributes that describe the advantages and disadvantages of the chosen structure

Software Architecture Design Guidelines

Think of what to do before thinking of how to do it.

Software Architecture Design Guidelines

  • Functional and non-functional requirements should be identified, verified, and validated (i.e, product design) before architectural and detailed design (i.e, software engineering design)

Software Architecture Design Guidelines

  • Using an abstract architectural design of a system to communicate with stakeholders helps avoid overhauling the system design in later stages of the software development cycle.

Software Architecture Design Guidelines

Think of abstract design before thinking of concrete design.

Software Architecture Design Guidelines

  • Always start with an abstract design that specifies interfaces of components and abstract data types.

Software Architecture Design Guidelines

  • Use multiple levels of abstraction if necessary.

Software Architecture Design Guidelines

  • Make all implementation decisions depend on the abstract interfaces instead of concrete ones because those are more stable – they are the contracts between service providers and services requesters so they are defined at the early stages of software development cycle.

Software Architecture Design Guidelines

Think of non-functional requirements earlier.

Software Architecture Design Guidelines

  • When we map functional requirements to an architectural design, we should consider non-functional requirements as well.

Software Architecture Design Guidelines

  • Communicate with stakeholders and document their preferences of quality attributes.

Software Architecture Design Guidelines

* Balance the quality attributes, and consider heterogeneous architecture styles when necessary.

(It is not possible to find a design that meets all quality attributes)

Software Architecture Design Guidelines

Think of software reusability and extensibility as much as possible.

Software Architecture Design Guidelines

  • For most software systems, it is very likely that new functionalities will be added after they are deployed.

Software Architecture Design Guidelines

  • In addition, we need to consider how to reuse existing software components to increase the reliability and cost-effectiveness of new systems.

Software Architecture Design Guidelines

  • Always try hard to make software extensible in the future.

Software Architecture Design Guidelines

Tolerate refinement of design.

Software Architecture Design Guidelines

  • Never expect to have software design completely perfect within one step.

Software Architecture Design Guidelines

  • We may need to use prototyping and iteration to refine the software design.

Software Architecture Design Guidelines

  • Try to promote high cohesion within each element and loose-coupling between elements.

Summary

  • Software architectural design has emerged as an important part of software development.

Summary

  • A software architecture specification consists of software elements, connections and collaborations among the elements, and desired software quality attributes.

Summary

  • An architectural style is a set of rules, constraints, or patterns that guide how to structure a system into a set of elements and connectors, and how to govern overall structure design patterns of constituent element types and their runtime interaction.

Summary

  • One specific architectural style may not be able to honor all quality attributes of the system.

Summary

  • There are always quality attribute tradeoffs between different styles.

  • Hence how to keep a balance on quality attributes is an important design issue.

Questions?

Engineering Design

Product Redesign and

Engineering Redesign

Product Design

Requirements

Specification

Design

Implementation

Testing

Maintenance

Software Product Life Cycle

Engineering

Design

Product

Design

Solution: SRS

Problem: Needs,

Desires, Constraints

Solution: Features

and Capabilities

Solution:

Interactions

Solution: Design

Document

Solution: High-

Level Design

Solution: Low-

Level Design

Solution: Code

Design Features

and Capabilities

Design Interactions

Create High-Level

Design

Create Low-Level

Design

Write Code

Software Design

New folder/L3-UML Activity Diagrams.ppt

UML Activity Diagrams

UML Activity Diagrams

  • Activity diagrams can represent any process and are useful throughout software design.

  • A process is a collection of related tasks that transforms a set of inputs to a set of outputs.

  • UML activity diagrams model processes by depicting actions and the flow of control and data between them.

Processes and process descriptions

  • A process is a collection of related tasks that transforms a set of inputs into a set of outputs.

  • Process description notations describe design processes as well as computational processes we design.

Activities and Actions

  • An activity is a non-atomic task or procedure decomposable into actions.

  • An action is a task or procedure that cannot be broken into parts.

  • A token is a marker used in executing the virtual machine specified by an activity diagram.

*

Activity Graph Elements (page 35)

activity symbol

action node

initial node

activity final node

Execution Model

  • Execution is modeled by tokens that are produced by action nodes, travel over action edges, and are consumed by action nodes.

Execution Model – cont.

  • When there is a token on every incoming edge of an action node, it consumes them and begins execution.

Execution Model – cont.

  • When an action node completes execution, it produces tokens on each of its outgoing edges.

Execution Model – cont.

  • An initial node produces a token on each outgoing edge when an activity begins.

  • An activity final node consumes a token available on any incoming edge and terminates the activity.

*

Branching Nodes

guards

merge node

decision node

Branching Execution

  • If a token is made available on the incoming edge of a decision node, the token is made available on the outgoing edge whose guard is true.
  • If a token is available on any incoming edge of a merge node, it is made available on its outgoing edge.
  • Guards must be mutually exclusive.

*

Forking and Joining Nodes

fork node

join node

Forking and Joining Execution

  • A token available on the incoming edge of a fork node is reproduced and made available on all its outgoing edges.
  • When tokens are available on every incoming edge of a join node, a token is made available on its outgoing edge.
  • Concurrency can be modeled without these nodes.

*

Control and Data Flow Example

control flow

control flow

data flows

Activity Parameters

  • Activity parameters are object nodes placed on activity symbol boundaries to indicate data or object inputs or outputs.
  • Activity parameters contain the data or object name.
  • Activity parameter types are specified in the activity symbol beneath the activity name.

*

Activity Parameter Example

output activity parameter

input activity parameter

activity parameter types

  • Also see these Figures (for more examples):

  • Figure 2-1-6 Concurrent Problem Solution (page 39)
  • Figure 2-1-9 Pins and Data Flows (page 42)

Activity Diagram Heuristics

  • Flow control and objects down the page and left to right.
  • Name activities and actions with verb phrases.
  • Name object nodes with noun phrases.
  • Don’t use both control and data flows when a data flow alone can do the job.
  • Make sure that all nodes entering an action node can provide tokens concurrently.
  • Use the [else] guard at every branch.

When to Use Activity Diagrams

When making a dynamic model of any process.

  • During analysis

  • During resolution

Questions

Sort

Clothes

Wash

Whites

Wash

Darks

Dry

Clothes

Fold

Clothes

Do Laundry

Run Drier

Fold

Clothes

Dry Clothes

[else]

[still wet]

Sort

Clothes

Wash

Whites

Wash

Darks

Dry

Clothes

Fold

Clothes

Do Laundry

Run Drier

Fold

Clothes

Wash and Dry

Clothes

[else]

[still wet]

Clothes

[wet]

Clothes

Wash

Clothes

max = a[i]

FindMax

a : int[1..*]

max : int

[else]

[i < a.length]

i++

[max < a.[i]]

[else]

max = a[0]

i = 1

a

max

New folder/L4-DesignProcess-management.ppt

Software Design Processes and Management

Software Architecture

*

Analysis and Resolution

  • Regarding Design

  • What do you think analysis is about?

  • What do you think resolution is about?

Please think about them before going to next slide

*

Analysis and Resolution – cont.

  • Analysis is breaking down a
    design problem to understand it.

  • Resolution is solving a design problem.

*

*

Analysis and Resolution in Software Design (p 48)

*

*

A Problem-Solving Process

  • Understand the problem
  • Generate candidate solutions
  • Evaluate candidate solutions
  • Select the best solution/s
  • Iterate if no solution is adequate
  • Ensure the solution is complete and well-documented, and deliver it

*

Analysis and Resolution

  • Let’s first look at iteration between analysis and resolution

and then

elaborate on the resolution activity

see next two slides

*

A Generic Design Process
(p 50)

*

*

A Design Resolution Process (p 51)

This diagram shows details of the resolution activity from the previous diagram.

*

*

Design Process Characteristics

  • The best solutions are rarely the first solutions designers think of.

  • Designers should generate many candidate solutions.

*

Design Process Characteristics

  • The design process is highly iterative.

  • Designers must frequently reanalyze the problem and must generate and improve solutions many times.

*

A Generic Software Product Design Process

*

*

A Generic Software Engineering Design Process

*

Architectural and Detailed Design

  • Architectural design is high-level software engineering design resolution.

  • Detailed design is low-level software engineering design resolution.

*

Operations versus Projects

  • Operations are standardized activities that occur continuously or at regular intervals.

  • Payroll
  • Hiring and performance evaluation
  • Shipping and receiving

*

Operations versus Projects – cont.

  • Projects are one-time efforts to achieve a particular current goal.

  • Process improvement
  • Business restructuring
  • New product introduction (including design)

Project Management Activities

  • Planning

  • Organizing

  • Staffing

  • Tracking

  • Leading

Project Management Activities

  • Planning

  • Formulating a scheme for doing a project.

Project Management Activities

  • Organizing

  • Structuring the organizational entities involved in a project and assigning them authority and responsibilities.

Project Management Activities

  • Staffing

  • Filling the positions in an organizational structure and keeping them filled.

Project Management Activities

  • Tracking

  • Observing the progress of work and adjusting work and plans accordingly.

Project Management Activities

  • Leading

  • Directing and supporting people doing project work.

Project Management Activities

  • Planning—Formulating a scheme for doing a project.
  • Organizing—Structuring the organizational entities involved in a project and assigning them authority and responsibilities.
  • Staffing—Filling the positions in an organizational structure and keeping them filled.
  • Tracking—Observing the progress of work and adjusting work and plans accordingly.
  • Leading—Directing and supporting people doing project work.

*

Project Planning

  • Estimation is calculation of the approximate cost, effort, time or resources required to achieve some end.
  • A schedule specifies the start and duration of work tasks.
  • Risk analysis is an orderly process of identifying, understanding, and assessing risks (any occurrence with negative consequences).
  • Policies, procedures, tools, and techniques are specified to govern work.

*

*

Project Organizing

  • Organizational structures

  • Project organization
  • Functional organization

  • Team structures

  • Hierarchical teams
  • Democratic teams

*

Project Staffing

  • Staffing

  • Often the single most important factor in success is having good people to do the work.

*

Project Tracking

  • Projects may not go as planned for many reasons.
  • Resource consumption is not as expected.
  • Tasks do not take as long as expected.
  • Policies, procedures, tools, or techniques cause problems.
  • Something bad occurs (illness, budget cuts, equipment failures, etc.

  • When plans fail they must be adjusted.

*

*

Leading a Project

  • Direction is needed to follow plans, use resources efficiently, etc.
  • Directing people is not enough—people need inspiration, help, a friendly work environment, emotional support, etc.

*

*

Iterative Planning and Tracking

  • Good planning requires knowledge of tasks and their costs, risks, and other details not known until the project is under way—but this is not known when plans are made.
  • Iterative planning and tracking is making a rough base or initial project plan, and refining it at fixed periods during a project in light of tracking data and completed work products.

*

Iterative Planning and Tracking

  • Many believe that iterative planning and tracking is the best approach to planning and tracking.

*

Design Project Management

  • All five project management activities are needed to manage a design project.
  • Design constitutes the largest activity in software development, so design can drive an entire development project.
  • The design project decomposition on the next slide is useful for planning, organization, staffing, and tracking.

*

*

Design Project Decomposition

Work Phase Typical Work Products
Product Design Analysis: Design Problem Statement of interested parties, product concept, project scope, markets, business goals Models (of the problem) Prototypes (exploring the problem)
Analysis: Detailed Needs Client surveys, questionnaires, interview transcripts, etc. Problem domain description Lists of needs, stakeholders Models (of the problem) Prototypes (exploring needs)
Resolution: Product Specification Requirements specifications Models (of the product) Prototypes (demonstrating the product)
Engineering Design Analysis Models (of the engineering problem) Prototypes (exploring the problem)
Resolution: Architectural Design Architectural design models Architectural design specifications Architectural prototypes
Resolution: Detailed Design Detailed design models Detailed design specifications Detailed design prototypes

*

*

Summary

  • Analysis is breaking a design problem down to understand it; resolution is solving a design problem.

*

Summary

  • Design processes begin with analysis and have a highly iterative resolution phase.

Summary

  • Designers should generate many candidate solutions and expect to reanalyze and resolve the problem repeatedly.

Summary

  • Design management is project management and hence requires planning, organization, staffing, tracking, and leadership.

Summary

  • Iterative planning and tracking is the best way to make and revise plans during a project.

Questions

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

Product Design Analysis

Product Design Resolution

Software Design

Product Idea : Problem

Design Document : Solution

Engineering Design Analysis

Engineering Design Resolution

Product

Idea

SRS

Design

Document

Analyze the

Problem

Generic Design

need : Problem

design : Solution

Resolve the

Problem

need

Problem

Statement

design

[else]

[problem

misunderstood]

Generate/Improve

Candidate Solutions

Generic Design Resolution

problem : Problem Statement

design : Solution

problem

design

[else]

[adequate solution]

Solutions

[candidate]

Evaluate Candidate

Solutions

Solutions

[evaluated]

Select

Solutions

Solutions

[selected]

Finalize

Design

Generic Software Product Design

Project Mission Statement : Problem

SRS : Solution

Project Mission

Statement

SRS

[adequate]

[else]

[complete]

[else]

Analyze Product

Design Problem

Elicit/Analyze

Detailed Needs

Generate/Improve

Candidate Requirements

Evaluate Candidate

Requirements

Select Requirements

Finalize Requirements

Analysis

Resolution

Generic Software Engineering Design

SRS : Problem

Design Document : Solution

Analysis

Architectural

Design

Design

Document

SRS

[adequate architecture]

[else]

[adequate detailed design]

[adequate architecture]

Analyze SRS

Generate/Improve

Candidate Architectures

Evaluate Candidate

Architectures

Select Architecture

Finalize Architecture

Generate/Improve Detailed

Design Alternatives

Evaluate Detailed

Design Alternatives

[else]

Select Detailed

Design

Finalize Design

[else]

Detailed

Design

New folder/L5-Product Design.ppt

Software Product Design

Software Product Design

  • Product Design Planning
  • Chapter 3
  • Product Design Analysis
  • Chapter 4
  • Product Design Resolution
  • Chapter 5

Product plan

  • A product plan is a list of
    approved development projects,
    with start and delivery dates.

Product Planning Process
(Page 75)

Requirements engineering

  • Requirements engineering is

creating, modifying, and managing

requirements over a product’s lifetime.

Requirements development

  • Requirements development is the portion of requirements engineering concerned with initially establishing requirements (aka product design).

Requirements management

  • Requirements management is the portion of requirements engineering concerned with controlling and propagating requirements changes.

*

Requirements Taxonomy

*

Technical Requirements

A technical requirement is a statement of a feature, function, capability, or property that a product must have (that is not a business requirement).

  • A functional requirement is a statement of how a program must map program inputs to program outputs.
  • A non-functional requirement is a statement that a software product must have certain properties.
  • A data requirement is a statement that certain data must be input to, output from, or stored by a product.

*

SRS Template

1. Product Description

1.1 Product Vision

1.2 Business Requirements

1.3 Users and Other Stakeholders

1.4 Project Scope

1.5 Assumptions

1.6 Constraints

2. Functional Requirements

3. Data Requirements

4. Non-Functional Requirements

5. Interface Requirements

5.1 User Interfaces

5.2 Hardware Interfaces

5.3 Software Interfaces

Software requirements specification

  • Software requirements specification (SRS) is a document cataloging all the requirements for a software product.

  • It is the output of the product design process.

Software Product Design Process
(page 79)

Product Design Analysis

Project Mission Statement

  • A project mission statement
  • States the software design problem
  • is the main input to the product design process.

  • A project mission statement is a document that defines a development project’s goals and limits.

Project Mission Statement Template

1. Introduction

2. Product Vision and Project Scope

3. Target Markets

4. Stakeholders

5. Assumptions and Constraints

6. Business Requirements

Software Product Design Process

  • Analyze Product Design Problem
  • Elicit Needs
  • Analyze Needs
  • Generate/Improve Alternatives
  • Evaluate Alternatives
  • Select Alternatives
  • Finalize Design

Stakeholder Roles in Product Design

  • Analyze Product Design Problem

  • Clarify project mission statement
  • Answer questions

Stakeholder Roles in Product Design – cont.

  • Elicit Needs

  • Answer questions
  • Be subjects of empirical studies

Stakeholder Roles in Product Design – cont.

  • Analyze Needs

  • Answer questions
  • Review and validate models and documents
  • Participate in analysis with designers

Stakeholder Roles in Product Design –cont.

  • Generate/Improve Alternatives

  • Participate in generation and improvement

Stakeholder Roles in Product Design – cont.

  • Evaluate Alternatives

  • Answer questions
  • Be subject of empirical studies
  • Participate in evaluation with designers

Stakeholder Roles in Product Design –cont.

  • Select Alternatives

  • Participate in selection with designers

Stakeholder Roles in Product Design – cont.

  • Finalize Design

  • Review and validate requirements

Needs versus Requirements

  • Stakeholder needs and desires define the product design problem.

  • Requirements specify the product design solution.

Elicitation Techniques

  • Interviews
  • Observation
  • Prototype demonstrations
  • Questionnaires

Interviews

  • —Designers question stakeholders

  • Most important technique
  • Many ways to do interviews
  • Recording responses

Observation

—Designers watch users work

  • Better than having people explain their work
  • Several of the right people, several times
  • Recording observations

Prototype demonstrations

  • A prototype is a working model of part or all of a final product.

Questionnaires

  • Designers prepare questions for stakeholders

Modeling

  • Many kinds of models can represent the problem and help designers understand it.

Modeling

  • Many modeling notations and techniques useful for analysis will be discussed later.
  • Various UML diagrams
  • Use case descriptions, user interface diagrams, dialog maps
  • Conceptual modeling, use case modeling

Summary (Product Design Analysis)

  • Product design begins with design problem analysis.
  • Stakeholders can play many roles in product design.
  • Needs define the product design problem; requirements state the solution.

*

Summary (Product Design Analysis)

  • Designers should understand the problem domain and stakeholder goals before eliciting needs.
  • Needs can be elicited in many ways and preferably by direct contact with stakeholders.
  • Many kinds of models can help understand the problem.
  • Needs must be documented, organized, and checked.

Product Design Resolution

*

Software Product Design Process

*

Product Design Resolution

  • Generation
  • Generate/improve candidate requirements
  • Evaluation
  • Evaluate candidate requirements
  • Selection
  • Select requirements

* Finalization

Generating Candidate
Requirements

  • Common failing: too few alternatives

  • Idea sources
  • Users and other stakeholders
  • Competitive products
  • Similar products

Generation techniques

  • Team brainstorming

  • Individual brainstorming

  • Modeling

Improving Candidate Requirements

  • Identify stakeholder need statements relevant to a candidate requirement.

  • Use the idea sources and techniques from the previous slide to improve requirements.

Specification Notations

  • Natural language
  • Easy to understand
  • Prone to ambiguity and vagueness
  • Semi-formal notations
  • More precise than natural language but not defined with mathematical rigor (most UML diagrams)
  • More precise than natural language
  • Easy to understand
  • Formal notations
  • Mathematical and logical notations
  • Very precise
  • Hard to understand

Stating Requirements

  • Follow the rules of good technical writing.
  • Write complete, simple sentences in the active voice.
  • Define terms clearly and use them consistently.
  • Etc.
  • Use “must” or “shall.”
  • Write verifiable requirements.
  • There is a definitive procedure to determine whether the requirement is satisfied.

Product Design Principles

  • Adequacy—Designs that meet stakeholder needs, subject to constraints, are better.
  • Beauty—Beautiful design are better.
  • Economy—Design that can be built for less money, in less time, with less risk, are better.
  • Feasibility—A design is acceptable only if it can be realized.
  • Simplicity—Simpler designs are better.

*

Requirements Evaluation Techniques

  • With respect to design principles (heuristic evaluation)

  • By collecting data from stakeholders (empirical evaluation)

Selecting Requirements Alternatives

  • Selection among alternatives can be made by the following parties:

  • Stakeholders only

  • Designers only
  • Still based on stakeholder needs and desires

  • Stakeholders and designers in collaboration

Stakeholders only

  • Pros and cons—List advantages and disadvantages and decide by vote or consensus
  • Easy and fast
  • Driven by persuasion
  • Crucial experiments—Decide based on the results of a survey or usability study
  • Clear and objective results
  • Slow and expensive
  • Applies only when a single selection criterion is in question

Designers only

  • Multi-dimensional ranking—assign criteria weights, score alternatives, and compare weighted sums
  • Fairly objective
  • Takes multiple criteria into account
  • Fast and easy
  • Difficult to use with many alternatives and criteria
  • Use the techniques most appropriate for the decision at hand.

Weighted Matrices

  • List alternatives as column headers
  • Determine the selection criteria and weights to be used
  • Add the selection criteria and weights as row headers
  • Rate each alternative with respect to each criterion, fill a cell
  • Fill in score cells by multiplying ratings by weights
  • Total the scores—Select the one with highest score

*

Weighted Matrices – An example

Evaluation Criteria Moisture Controlled Timer controlled Manually Controlled
Description Weight Rating Score Rating Score Rating Score
Irrigation Control   Reliability   Ease of Use   Robustness   Risk 25%     20%   20%   20%   15% 2     3   4   3   4 0.5     0.6   0.8   0.6   0.6 3     2   3   3   3 0.75     0.4   0.6   0.6   0.45 5     2   2   5   2 1.25     0.4   0.4   1.0   0.3
Total Score 3.1 2.8 3.35

Prioritizing Requirements

  • Needed to make decisions about what to do first or what to leave out
  • Based on needs priorities, if available
  • Otherwise
  • Designers can assign priorities based on needs
  • Stakeholders can assign priorities
  • Stakeholder should always check priorities

Product Design Finalization

  • Design finalization ensures that the SRS is of high quality.

  • Final product design step
  • Ensures that requirements are properly documented
  • Designer review
  • Ensures that requirements are valid
  • Stakeholder review

SRS Quality Characteristics

  • Well-formedness—An SRS is well formed if it conforms to all rules about stating requirements.
  • Clarity—An SRS is clear if it is easy to understand.
  • Consistency—A set of requirements is consistent if a single product can satisfy them all.
  • Completeness—An SRS is complete if it includes every relevant requirement.

*

SRS Quality Characteristics

  • Verifiability—Every requirements in an SRS must be verifiable.
  • Feasibility—An SRS contains feasible requirements when designers are confident that they can be satisfied.

Developers should check all these characteristics.

*

SRS Quality Characteristics

  • Correctness—An SRS is correct if it specifies a product that satisfies stakeholder needs and desires, subject to constraints.
  • Proper requirements prioritization—All requirements are prioritized in accord with stakeholder needs and desires.

Stakeholders should check these requirements validation characteristics.

*

Inspection and Review

  • Mostly applicable for documents and non-machine executable material

  • Requires preparation and some training in looking for problem, recording, follow-up, etc.

Inspections Process

  • Planning and appointment of moderator and inspectors
  • Moderator—Manages and facilitates the process
  • Inspector—Searches for defects

  • Preparation for the inspection
  • Conduct inspection
  • Post inspection follow-up
  • If no re-inspection needed, then issue inspection result document

*

Inspection Process (page 139)

*

Readiness check

  • Usually done by the moderator

  • Ensures that the work product has no obvious defects

Overview meeting

  • Short (~20 minutes)
  • Tasks
  • Schedule review meeting
  • Distribute work product, checklist, etc.
  • Answer questions
  • May be done electronically

  • Each inspector carefully reviews the work product using a checklist
  • Takes several hours

Inspection Meeting

  • Moderator ensures that inspectors are ready; if not, the meeting is rescheduled
  • Reader reads through the work product
  • Inspectors note defects or raise issues
  • Recorder notes all defects, issues, comments, collects data, etc.
  • The meeting should not last more than two hours
  • There should not be more than one inspection meeting per day

*

Requirements Inspection Checklist Example (PAGE 141)

Every requirement is atomic. Every requirement statement uses “must” or “shall.” Every requirement statement is in the active voice. Terms are used with the same meaning throughout. No synonyms are used. Every requirement statement is clear. No requirement is inconsistent with any other requirement. No needed feature, function, or capability is unspecified. No needed characteristic or property is unspecified. All design elements are specified to the physical level of abstraction. Every requirement is verifiable. Similar design elements are treated similarly. Every requirement can be realized in software. Every requirement plays a part in satisfying some stakeholder’s needs or desires. Every requirement correctly reflects some stakeholder’s needs or desires. Every requirement statement is prioritized. Every requirement priority is correct.

*

Inspection Conclusion

  • Defects found by inspectors are corrected.
  • The moderator ensures that all defects are dealt with.
  • If the work product is much changed or still appears to have defects, another inspection may be scheduled.

Prototypes

  • A prototype is a working model
    of part or all of a final product.

Prototype Uses

  • Needs elicitation

  • Needs analysis

  • Requirements generation and refinement

  • Requirements evaluation and selection

  • Design finalization

Throwaway and Evolutionary Prototypes

  • A throwaway prototype is developed as a design aid and then discarded.

  • An evolutionary prototype is a prototype that becomes (part of) the final product

Summary (Product Design Resolution)

  • Designers should use a variety of sources and techniques to generate many design alternatives.
  • Alternatives stated as requirements should be atomized, verifiable, use “must” or “shall” and be well written.
  • Alternatives can be evaluated heuristically or empirically
  • Designers or stakeholders can select design alternatives.
  • Several techniques can be used to select alternatives depending on the circumstances.

Summary (Product Design Resolution)

  • Design finalization ensures that the SRS is of high quality.
  • Designers and stakeholders review the SRS for various quality characteristics.
  • Reviews include desk checks, walkthroughs, and inspections.
  • Inspections are reviews with explicit goals, assigned roles, and a formal process, that relies on checklists to find defects.

*

Summary (Product Design Resolution)

  • Prototypes are useful for needs elicitation, for alternative generation, evaluation, and selection, and for design finalization.

Review Quiz

  • Work on the following “Review Quiz”
  • Review Quiz 3.1, Number 3 (page 74)
  • Review Quiz 3.2, Number 4 (page 79)
  • Review Quiz 3.3, Numbers 1 and 2 (page 85)
  • Review Quiz 3.4, Numbers 2 and 3 (page 92)
  • AFTER carefully working on them, see pages 96-97 to compare answers given there with your answers.

Questions

*

*

*

*

*

*

*

*

*

*

*

*

Requirements

Business

Technical

Functional

Non-Functional

Data

Generic Software Product Design

Project Mission Statement : Problem

SRS : Solution

Project Mission

Statement

SRS

[adequate]

[else]

[complete]

[else]

Analyze Product

Design Problem

Elicit/Analyze

Detailed Needs

Generate/Improve

Candidate Requirements

Evaluate Candidate

Requirements

Select Requirements

Finalize Requirements

[reinspect]

[ok]

[else]

...

[else]

[else]

[major defects]

[ok]

[else]

Check Readiness

Modify

Overview Meeting

Inspector 1

Prepares

Inspector 2

Prepares

Inspector k

Prepares

Team Inspection

Rework

Follow Up

Inspection

New folder/L6-Use Case.ppt

Use case Modeling in Product design

Use Case Modeling

  • Use Case Diagrams
  • Is discussed here

  • Use Case Descriptions
  • Will be discussed next

Objectives

  • To explain what use cases are

  • To suggest processes for creating use case diagrams

  • To explain when to use use case diagrams

A “Transitional Technique” for Requirements
Specification

Requirements Document

(pages of English

Statements and

Diagrams)

Analyze &

Organize the

“function/features”

Use Case

Diagram

Use Case

Description

Why Use Case Modeling?

  • User-level requirements are generated from stakeholder needs.

  • Operational-level requirements are hard to generate in isolation.

Why Use Case Modeling?

  • Considering the interactions between a program and its environment
  • Organizes operational level requirements
  • Provides context for refinement
  • Helps avoid inconsistencies, omissions, redundancies, etc.

Use Cases

  • A use case is a type of complete interaction between a product and its environment.

  • An actor is a type of agent that
    interacts with a product

  • The collection of use cases characterizes all externally observable behavior.

  • A use case is an entire, coherent interaction.

  • Actors are roles not individuals.

  • The product is never an actor.

*

Use Case Diagrams

  • A use case diagram represents a product’s use cases and the actors
    involved in each use case.

  • Static model
  • Catalog of all use cases

Scenario & Use Case

  • Many of the function and features in the Requirements Document may be viewed as scenarios:

  • Scenario: describes a set of interactions between the system and a “particular” individual

  • A Use Case generalizes the scenarios: describes the interactions (in general form) between the system and an “actor” (abstract individual or another system or environment)


Scenarios

  • A scenario is an interaction between
    a product and particular individuals.

  • Instance of a use case
  • Help envision how a product can be used
  • Abstracted into use cases

Scenario for Buying a Car Wash

  • Michael drives to the kiosk outside the carwash and attempts to insert five dollars. The kiosk accepts the money and displays the message “You have paid enough for a complete wash. Insert another dollar for a deluxe wash.” Michael presses the button for an express wash. The kiosk refunds one dollar. The carwash queries its stall sensors. The stall sensors report that no car is detected, so the kiosk displays the message “Please drive forward into the wash stall.”

Use Case Development Process

Study/rewrite

scenarios

Analyze the scenarios

& pick the “actors”

Use Case Diagram

Initial

Req. Document

Use Case Development

Initial Req. Document: Docs

Use Case Diagram: Docs

Use Case Description : Docs

Rewrite the scenarios

Into Use Cases

Associate Actors to

the Use Cases

Abstract the Use Cases

And Draw Use Case

Diagram

Use Case Description

*

Use Case Diagramming Process (Page 163)

*

Use Case Diagram

  • A diagram is made of the following:
  • Use cases (functional/feature in the system which interact with the actor) in a “bubble” diagram.

  • Actors that interact with the use cases in a stick figure diagram

  • Association lines that relates the actors to the use case

  • A frame that distinguishes the “system” and the external actors.

*

Use Case Diagram Symbols (page 160)

*

*

Use Case Diagram Example

Use Case Diagram for an Automated Carwash

*

Use Case Diagramming using Event Lists

  • An event list is a list of all internal and external events to which the product must respond.

Use Case Diagramming using Event Lists

  • Invent use cases to handle each event in the list; add it to the diagram

  • Consider each use case and determine its actors; add them to the diagram

Use Case Briefs

  • A use case brief or actor brief is a short description of a use case or actor.

  • Supplements the use case diagram
  • Usually only one or two sentences or phrases

Formation Rules

  • Every use case diagram must have
  • At least one use case
  • At least one actor
  • At least one actor associated with each use case
  • At least one use case associated with each actor
  • No association line between actors
  • No association line between use cases
  • Name every actor and use case
  • Not label any association line

Use Case Diagram Heuristics

  • Never make the product an actor.
  • Name actors with noun phrases.
  • Name use cases with verb phrases.
  • Achieve a stakeholder’s goal in a use case.
  • Make use cases that can be finished in a single session.

Use Case Diagram Heuristics

  • Make use cases of uniform size and complexity.
  • Draw use case diagrams on one page.
  • Organize use cases by actor, problem domain categories, or solution categories.

Checking Use Case Diagrams

  • Review the stakeholders goals list to make sure no actors are missing.
  • Review the needs list to make sure no uses cases are missing.
  • Review constraints and limitations to make sure they are no violated.

Checking Use Case Diagrams

  • Generate an event list and check that all events are handled.
  • Check that the collection of use cases covers all externally visible behavior.
  • Check the diagram against the use case heuristics .

When to use Use Case Diagrams

  • User-level product design alternatives (more on this later)
  • Summarizing design alternatives
  • Catalog use cases elaborated in use case descriptions (more on this later)
  • A component of a use case model (more on this later)

Summary

  • Use cases are types of episodes of interaction between a product and its environment.

  • Working with use cases help organize, analyze, generate, evaluate, and select functional requirements.

Summary

  • UML use case diagrams are static models of all the use cases in a product.

  • There are several processes for creating use case diagrams.

  • Rules govern use case diagram formation, and heuristics and checks help achieve and ensure their quality.

Questions

*

*

*

*

Write

Scenarios

Check Each Actor’s

Needs for Use Cases

Draw a Use Case Diagram

mission : Project Mission Statement

goals : Stakeholders-Goals List

needs : Needs List

diagram : Use Case Diagram

Abstract Scenario

Individuals as Actors

Check Development

Documents for Actors

Abstract Scenarios

as Use Cases

goals

mission

needs

diagram

Actor Name

Use Case Name

Association LineUse Case SymbolActor Symbol

Customer

Soap Sensor

Buy Wash

Stall Sensors

Wash Car

Produce Log

Manager

Activate/

Deactivate

New folder/L7-Use Cases Descriptions.ppt

Use Case Descriptions and Use Case Models

A “Transitional Technique” for Requirements
Specification

Requirements Document

(pages of English

Statements and

Diagrams)

Analyze &

Organize the

“function/features”

Use Case

Diagram

Use Case

Description

Scenario & Use Case

  • Many of the function and features in the Requirements Document may be viewed as scenarios:

  • Scenario: describes a set of interactions between the system and a “particular” individual

  • A Use Case generalizes the scenarios: describes the interactions (in general form) between the system and an “actor” (abstract individual or another system or environment)

Use Case Development Process

Study/rewrite

scenarios

Analyze the scenarios

& pick the “actors”

Use Case Diagram

Initial

Req. Document

Use Case Development

Initial Req. Document: Docs

Use Case Diagram: Docs

Use Case Description : Docs

Rewrite the scenarios

Into Use Cases

Associate Actors to

the Use Cases

Abstract the Use Cases

And Draw Use Case

Diagram

Use Case Description

Use Case Diagram

  • A diagram is made of the following:
  • Use cases (functional/feature in the system which interact with the actor) in a “bubble” diagram.

  • Actors that interact with the use cases in a stick figure diagram

  • Association lines that relates the actors to the use case

  • A frame that distinguishes the “system” and the external actors.

UML: Use Case Diagram to represent Use Cases
(this is a “static” model)

High Level Steps:

  • Analyze the scenarios
  • Decide on and create the system boundary
  • Identify the actor(s)
  • Convert the scenarios into abstract use cases
  • Describe the threads of activities that are necessary to support the actors’ needs; these threads of activities “expands” into more detailed use-case descriptions

rotate picture

users

Solar System

Display

Individual item

details

<<extends>>

<<include>>

<<include>>

Extension pts : planets,

sun

Display Static

Solar System

In reality, we iterate over these steps!

UML: Use Case Descriptions
(this provides a “dynamic” model)

  • A Use Case Description is a specification of the interaction between the actor(s) and the use case in system(product):

  • Specifies the actions by the actor
  • Specifies the system responses to the actions

  • There is no one standard notation for Use Case Descriptions
  • You can include any of the “forms” or pictures
  • but preferred one is “text”

A Sample Use Case Description Template

  • Use Case Name or/number: for identification purpose
  • Actors: agents participating in the use case
  • Stakeholders & needs: identify those who have the needs for this use case (e.g. sources of this requirements)
  • Pre-Conditions: conditions that must be true prior to the activity or operation
  • Post-Conditions: conditions that must be true when the operation or activity completes
  • Trigger: an event that causes the use case to begin
  • Basic Flow: A description of the flow of interaction between the actor(s) and the product use case
  • Extensions : description of alternative flow of interaction from the normal flow, such as an error processing flow.

Meat

Of

Descrip.

We may include diagrams (such as the activity diagram or the pictorial

representation of the UI screens) in the Use Case Description.

See example –page 170 of your text

Use Cases Descriptions

  • A use case description is a specification of the interaction between a product
    and the actors in a use case.

  • What each party does
  • The order in which each party acts
  • All possible courses of interaction

Use Case Description Contents

  • Use case name and number
  • Actors
  • Stakeholders and their needs
  • Preconditions
  • An assertion that must be true when an activity or operation begins.
  • Postconditions
  • An assertion of what must be true when an activity or operation ends.
  • Must satisfy stakeholder needs

Use Case Description Contents

  • Trigger—A trigger is an event that causes a use case to begin.
  • May be the first step in the use case

  • Basic flow
  • Begins at the trigger, continues until the use case ends

  • Extensions
  • May begin and end anywhere

Car Wash Example

  • Use Case 2: Activate/Deactivate

  • Actors: Soap sensor

  • Stakeholders and needs:
    Customers—Need their cars washed with soap, and want a complete wash
  • Operations—Want the carwash to operate without constant attention

  • Preconditions: None

  • Postconditions:
  • The carwash is active if and only if the soap sensor indicates that there is soap.
  • No wash currently in progress is interrupted.

Car Wash Example

  • Trigger: One minute has passed since the last time the soap sensor was checked.
  • Basic Flow:
  • The carwash queries the soap sensor.
  • The soap sensor indicates that there is soap.
  • If the carwash is active, it continues its operation and the use case ends.

Car Wash Example

  • Extensions:
  • 1a: The carwash is unable to query the soap sensor:
  • 1a1. The controller logs the problem and the use case ends.
  • 2a: The soap sensor indicates that there is no more soap:
  • 2a1. If the carwash is inactive, the use case ends.
  • 2a2. If the carwash is active, the controller displays an out-of- order message and becomes inactive; the use case ends.

  • 2b: The soap sensor does not respond:
  • 2b1. The controller logs the problem.
  • 2b2. If the carwash is inactive, the use case ends.
  • 2b3. If the carwash is active, the controller displays an out-of-order message and becomes inactive; the use case ends.

  • 3a: The carwash is inactive:
  • 3a1. The carwash becomes active and displays a ready message.

Use Case Description Formats

  • Many alternatives

  • Underlined text refers to another use case.
  • Extensions use a special numbering scheme:
  • Numbers are for action step sequencing;
  • Letters are for extension triggers;
  • Extension identifiers have interleaved numbers and letters;
  • An asterisk refers to all action steps;
  • A dash is used for ranges of action steps;
  • A comma separates action steps in a list.

Use Case Description Template (page 171)

Use Case number: name

Actors: actorList

Stakeholders and Needs:
stakeholder—needsList.

stakeholder—needsList.

Preconditions: what is assumed at the start.

Postconditions: what is guaranteed at the end.

Trigger: the event that starts the use case.

Basic Flow:
# stepDescription

Extensions:
extensionIdentifier condition:
extensionIdentifier # stepDescription

*

*

Description Writing Process (page 176)

*

*

Filling in the Initial Fields

  • Stakeholders are human use case actors or anyone with an interest to protect.
  • Only state things that really matter as use case preconditions.
  • Postconditions must be true when the use case ends whether it is successful or not.
  • The trigger is often the first step in the use case (but not always).

*

*

Writing the Basic Flow

  • Choose a common, simple activity flow.
  • Trace it from the trigger through use case completion.
  • Scenarios are often good resources.

*

*

Writing the Basic Flow

  • Steps may assume the preconditions and should achieve the postconditions
  • Each step should state an action of a single agent (the product or an actor).
  • Supplemental directions about conditions, iteration, or currency are allowed.

*

Brainstorming Branch Points

  • A branch point is a place where the action flow may diverge.
  • Brainstorm a list of branch points and failure conditions.
  • Look at scenarios for failed or alternative interactions.
  • Consider errors, faults, and alternatives at every step.
  • Don’t forget an actor’s failure to act.

*

*

Rationalizing Branch Points

  • Remove from further considerations any conditions that the product
  • Cannot detect
  • Cannot do anything about

  • Rewrite poorly stated conditions

*

*

Writing Extensions

  • Treat an extension as if it were a separate use case:
  • The condition is the trigger;
  • Extension steps are the basic flow;
  • Completing the use case or returning to the branch point are the goals.
  • Scenarios are a good resource.
  • Repeat the extension writing process for the extension (extensions may have extensions).

*

*

Use Case Description Heuristics

  • Fill in the use case template from top to bottom.
  • Obtain use case and actor names from the use case diagram.
  • Make human actors stakeholders whose needs include completion of the task done by the use case.
  • Write simple declarative sentences in the active voice.

*

Use Case Models

  • A use case model is a use case diagram together with use case descriptions
    for each use case in the diagram.
  • The diagram is a static model cataloging product interactions.
  • The descriptions are dynamic models detailing the interactions.

*

Designing with Use Case Diagrams

  • Model a design alternative for the interactions that a product will support

  • Generate several design alternatives

*

  • Alternatives can be evaluated in terms of
  • Unmet needs
  • Extraneous features or capabilities
  • Development costs
  • Time and risk
  • Conformance to constraints
  • Feasibility, simplicity, beauty

*

Designing with Use Case Descriptions

  • Use case descriptions refine the user-level specification in a use case diagram into operational-level specifications.
  • Design alternatives are specified in different descriptions.
  • Alternatives can be evaluated as already described.

*

*

Requirements and Use Case Models

  • Use case models do not provide atomized requirements statements.
  • They are not traceable;
  • Some product functions may not appear;
  • Data and non-functional requirements are not explicit.
  • Use case models sometimes serve as surrogates for requirements.

*

*

Extracting Requirements

  • Extracting requirements from use case models
  • Helps designers understand their designs better;
  • Helps find errors and improve designs;
  • Produces a useful artifact for engineering design.

*

*

Use-Case-Driven Iterative Development

In an iterative development project

  • Choose several use cases for implementation in an iteration;
  • Furnish product design details;
  • Do engineering design, code, test, and (perhaps) deploy;
  • Evaluate the result for the next iteration;
  • Repeat these steps.

*

*

Process Guidelines

  • Start with a complete use case diagram.
  • Choose use cases for each iteration according the following criteria:
  • Important to stakeholders
  • Requires a core system function
  • Requires the essentials of the system architecture
  • The implementation is technically challenging

*

Summary

  • A use cases description is structured text that specifies the details of a use case.

  • Templates, processes, and heuristics guide use case description writers.

  • Use case descriptions, though not requirements, can be a source for them.

*

Summary

  • Use case diagrams and descriptions together form use case models.

  • These models are a powerful product design tool.

  • Use cases can drive iterative development.

Questions

*

*

*

*

*

*

*

*

*

*

*

*

*

*

Fill in the

Initial Fields

Write Extensions

Write a Use Case Description

diagram : Use Case Diagram

goals : Stakeholders-Goals List

needs : Needs List

scenarios : Collection of Scenarios

description : Use Case Description

Write Basic

Flow

Brainstorm Branch

Points and Conditions

Rationalize Branch

Points and Conditions

goals

diagram

needs

description

scenarios

New folder/L8-EngDesignAnalysis.ppt

Software Engineering Design

Software Engineering Design

  • Engineering Design Analysis
  • Is discussed here

  • Engineering Design Resolution
  • Will be discussed next

Engineering Design Analysis

Chapter 7

*

A Generic Software Engineering Design Process
(page 195)
See next slide first

*

Software Product Design Process
(Remember this?)

Software Engineering Design Analysis

  • Goal of engineering design analysis is to understand the software product design and the constraints (from requirements)
  • The Engineering Design Analysis consist of 2 main tasks
  • Understanding (studying, clarifying, prioritizing, etc.) the SRS and product design
  • Develop a “new” model of the design problem if necessary
  • The result of design analysis “often” requires further clarification and rework of the SRS and product model

Analyze (SRS &

Product Design)

SRS

Design

Doc

Rest of Design

Steps

software engineering design

Engineering Design Analysis

  • Engineering Design Analysis Model is a representation of a design “problem” (the modeling of the issues related to requirements)

  • Dynamic aspects may be represented with Use Case

  • Defines the major system functionalities
  • Defines the entities (mostly users and other systems) that interact with the system
  • Describes the actual interactions via scenarios

  • Static aspects may be represented with Conceptual Model (or Analysis Class Model if using OO).

(Using OO techniques)

  • Defines the “Classes” in the problem
  • Associations among Classes

Both Use Case and Conceptual Model may used for requirements and design

activities

Use Case and Conceptual Model

  • Use Case:
  • Represents the requirements and the behavior of the needed system
  • Does not describe the solution
  • Usually does not describe in detail the entities or the structure in the problem (interaction between actors and the system)
  • Conceptual Model:
  • Also represents the problem, the static aspects

  • Also Does not describe the solution

  • Does describe (more detail of)
  • the real world entities
  • structure among these entities

3 Levels of Model in Analysis and Design

  • Conceptual Model (or Domain Model) : represents the entities in the problem domain - a) their characteristics, and b) relationships among the entities (the entities may be represented in the form of OO classes)

  • Design Class Model: represents the entities in the solution – a) their attributes, b) operations, and c) relationships among the entities independent of the implementation language or platform

  • Implementation Class Model: represents the classes in the implementation of the solution and all the details which were left out in the Design Class Model

OO Model

OO Code

Analyze SRS

  • Understand an engineering design problem using
  • SRS
  • Product design models
  • Achieve understanding by
  • Studying the SRS and design models
  • Making analysis models

Analysis Models

  • An analysis model is any representation of a design problem.

  • Both static and dynamic models
  • Object-oriented and other kinds of models

Engineering Design Analysis

  • Class & Object Modeling

  • Conceptual Modeling

Class and Object Models

  • A class model is a representation of classes
    in a problem or a software solution.
  • Class diagrams are graphical forms of class models.

  • An object model is a representation of objects in a problem or a software solution.
  • Object diagrams are graphical forms of object models.

  • Other forms are possible, such as CRC cards.

CRC cards

  • Note cards recording information about
  • Classes
  • Their Responsibilities
  • Other classes with which they Collaborate

  • Not covered here

Types of Class Models

  • Analysis or conceptual models—Important entities or concepts in the problem, their attributes, important relationships
  • Design class models—Classes in a software system, attributes, operations, associations, but no implementation details
  • Implementation class models—Classes in a software system with implementation details

*

  • Analysis models represent the problem; design and implementation models represent the solution.

Classes and Objects

  • An object is an entity that holds data and exhibits behavior.

  • A class is an abstraction of a set of objects with common operations and attributes.

  • An attribute is a data item held by an object or class.

Classes and Objects

  • An operation is an object or class behavior.

  • An association is a connection between classes representing a relation on the sets of instances of the connected classes.

UML Class and Object Diagrams

  • UML Names
  • A name in UML is character string that identifies a model element.
  • Simple name: sequence of letters, digits, or punctuation characters
  • Composite name: sequence of simple names separated by the double colon (::)

UML Names

  • Examples

  • Java::util::Vector
  • veryLongNameWithoutPunctuationCharacters
  • short_name

  • In UML, classes are represented by rectangles divided vertically into 3 or more compartments as follows (from top):
  • Class name compartment
  • Attributes compartment
  • Operations compartment
  • Other compartment (to supply additional info if needed)

*

UML Class Symbol Examples
(page 201)

  • Compartments?

*

Attribute Specification Format

  • name : type [ multiplicity ] = initial-value
  • name—simple name, cannot be suppressed
  • type—any string, may be suppressed with the :
  • multiplicity—number of values stored in attribute
  • list of ranges of the form n..k, such that n <=k
  • k may be * (stands for unlimitted upper bound)
  • n..n is the same as n
  • 0..* is the same as *
  • 1 by default
  • if suppressed, square brackets are omitted
  • initial-value—any string, may be suppressed along with the =
  • (see next slide for some examples)

Examples (from Page 202)

  • weight: float (weight attribute is of type float)
  • toBuy: stings[*] = 0 (a collection of stings of arbitrary size, initially set to contain no values)
  • toDo: string[0..10] (a collection of 0 to 10 strings)
  • size: integer = 128 (an integer attribute holding a single value set to 128 when an instance is created)

Operation Specification Format

  • name( parameter-list ) : return-type-list
  • name—simple name, cannot be suppressed

  • parameter-list
  • direction param-name : param-type = default-value

  • direction—in, out, inout, return; in when suppressed
  • param-name—simple name; cannot be suppressed
  • param-type—any string; cannot be suppressed
  • default-value—any string; if suppressed, so is =

Operation Specification Format

  • name( parameter-list ) : return-type-list

  • return-type-list—any comma-separated list of strings; if omitted (with :) indicates no return value
  • The parameter-list and return-type-list may be suppressed together.

*

Attribute and Operation Specifications
(page 204)

*

  • Remember: An association is a connection between classes representing a relation on the sets of instances of the connected classes.

*

Association Lines

*

*

Association Multiplicity

The multiplicity at the target class end of an association is the number of instances of the target class that can be associated with a single instance of the source class.

*

Class Diagram Rules

  • Class symbols must have a name compartment.
  • Compartments must be in order.
  • Attributes and operations must be listed one per line.
  • Attribute and operation specifications must be syntactically correct.

Class Diagram Heuristics

  • Name classes, attributes, and roles with noun phrases.
  • Name operations and associations with verb phrases.
  • Capitalize class names only.
  • Center class and compartment names but left-justify other compartment contents.

*

Class Diagram Heuristics

  • Stick to binary associations.
  • Prefer association names to rolenames.
  • Place association names, rolenames and multiplicities on opposite sides of the line.

Class Diagram Uses

  • Central static modeling tool in object-oriented design
  • Conceptual models
  • Design class diagrams
  • Implementation class diagrams
  • Can be used throughout both the product and engineering design processes

Object Diagrams

  • Object diagrams are used much less often than class diagrams.
  • Object symbols have only two compartments:
  • Object name
  • Attributes (may be suppressed)

*

Object Name Format

  • object-name—simple name
  • class-name—a name (simple or composite)
  • stateList—list of strings; if suppressed, the square brackets are omitted
  • The object-name and class-name may both be suppressed, but not simultaneously.

object-name : class-name
[ stateList ]

*

*

Object Attribute Format

  • attribute-name—simple name
  • value—any string
  • Any attribute and its current value may be suppressed together.

attribute-name = value

*

*

Examples of Object Symbols

*

*

Object Links

  • Show that particular objects participate in a relation between sets of objects
  • Instances of associations
  • Shown using a link line
  • Solid line (no arrowheads)
  • Underlined association name
  • Link lines never have multiplicities

*

*

Object Diagram Uses

  • Show the state of one or more objects at a moment during execution

  • Dynamic models as opposed to class diagrams, which are static models

*

*

Conceptual Modeling

*

Conceptual Models

  • An conceptual model is a static model
    of the important entities in a problem,
    their responsibilities or attributes, the important relationships among them,
    and perhaps their behaviors.
  • Conceptual models are about real-world entities in the problem domain and not about software.

*

Uses of Conceptual Models

  • In product design
  • Understanding the problem domain
  • Setting data requirements
  • Validating requirements
  • In engineering design
  • Understanding a product design
  • Providing a basis for engineering design modeling

*

*

Conceptual Modeling Process
(page 213)

*

*

Identifying Classes—Brainstorming

  • Study the product design (SRS, use case models, other models)
  • Look for nouns and noun phrases for
  • Physical entities
  • Individuals, roles, groups, organizations
  • People, devices, or systems that interact with the product (actors)

*

*

Identifying Classes-Rationalizing

  • Remove noun phrases designating properties (they may be attributes).
  • Remove noun phrases designating behaviors (they may be operations).
  • Combine different names for the same thing.

*

Identifying Classes-Rationalizing

  • Remove entities that do not directly interact with the product.
  • Clarify vague nouns or noun phrases.
  • Remove irrelevant or implementation entities.

*

Caldera Example, Draft 1
(see shaded area on page 214)

*

Adding Attributes

  • Study the SRS and product design models looking for adjectives and other modifiers.
  • Use names from the problem domain.
  • Include only those types, multiplicities, and initial values specified in the problem.

*

Adding Attributes

  • Don’t add object identifiers unless they are important in the problem.
  • Don’t add implementation attributes.
  • Add operations sparingly.

*

Caldera Example, Draft 2

*

Adding Associations-Brainstorming

  • Study the SRS and product design models looking for verbs and prepositions describing relationships between model entities.
  • Look for relationships such as
  • Physical or organizational proximity;
  • Control, coordination, or influence;
  • Creation, destruction, or modification;
  • Communication; and
  • Ownership or containment.

*

*

Adding Associations—Rationalizing

  • Limit the number of associations to at most one between any pair of classes.
  • Combine different names for the same association.
  • Break associations among three or more classes into binary associations.

*

*

Adding Associations—Rationalizing

  • Make association names descriptive and precise.
  • Add rolenames where they are needed.

*

Caldera Example, Draft 3

*

Adding Multiplicities

  • Take pairs of associated entities in turn.
  • Make one class the target, the other the source.
  • Determine how many instances of the target class can be related to a single instance of the source class.
  • Reverse the target and source and determine the other multiplicity.
  • Add only multiplicities important in the problem.

*

*

Caldera Example, Final Draft

*

Summary

  • Engineering design begins with analysis of the SRS and product design models.
  • Analysis modeling helps designers understand the design problem.
  • Class models include analysis (conceptual), design, and implementation class models.

*

*

Summary

  • UML class diagrams can be used for all types of class models, and throughout the design process.
  • UML object diagrams represent the state of objects during execution.

Summary

  • A conceptual model represents the important entities in a design problem along with their properties and relationships.
  • Conceptual models represent the design problem, not the software solution.
  • Conceptual models are useful throughout product design and in engineering design analysis.

Summary

  • There is a process for conceptual modeling.
  • Process steps can be done by analyzing the text of product design artifacts.
  • Several heuristics guide designers in conceptual modeling.

Questions

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

*

Generic Software Engineering Design

SRS : Problem

Design Document : Solution

Analysis

Architectural

Design

Design

Document

SRS

[adequate architecture]

[else]

[adequate detailed design]

[adequate architecture]

Analyze SRS

Generate/Improve

Candidate Architectures

Evaluate Candidate

Architectures

Select Architecture

Finalize Architecture

Generate/Improve Detailed

Design Alternatives

Evaluate Detailed

Design Alternatives

[else]

Select Detailed

Design

Finalize Design

[else]

Detailed

Design

Generic Software Product Design

Project Mission Statement : Problem

SRS : Solution

Project Mission

Statement

SRS

[adequate]

[else]

[complete]

[else]

Analyze Product

Design Problem

Elicit/Analyze

Detailed Needs

Generate/Improve

Candidate Requirements

Evaluate Candidate

Requirements

Select Requirements

Finalize Requirements

Phone

number

color

java::util::Random

nextBoolean()

nextDouble()

nextFloat()

nextInt()

nextLong()

setSeed()

Table

Book

author

title

ISBN

ring()

dial()

redial()

hangUp()

Exceptions

noNumberException

lowPowerException

Player

roundScore : int = 0

totalScore : int = 0

words : String[*] = ()

resetScores()

setRoundScore( in size : int )

findWords( in board : Board )

getRoundScore() : int

getTotalScore() : int

getWords() : String[*]

WaterHeaterController

mode : HeaterMode = OFF

occupiedTemp : int = 70

emptyTemp : int = 55

setMode( newMode : Mode = OFF )

setOccupiedTemp( newTemp : int )

setEmptyTemp( newTemp : int )

clockTick( out ack : Boolean )

Person

Property

manager

rents

subordinate

manages

renter

rental

Student

Course

0..1

takes

teaches

occupies

DormRoom

Professor

0..3

1..*

*

1..*

1..*

:Rectangle

a1

t:Telephone

b:Book

[checked out]

width = 720

height = 320

color = blue

title = “Ivanhoe”

author = “Sir Walter Scott”

x = 10

y = 14

number = 8792460

color = black

status = ONHOOK

Identify

Classes

Add

Attributes

Conceptual Modeling

Add

Associations

Add

Multiplicities

Homeowner

WaterHeaterController

Thermostat

Clock

mode

lowTemp

highTemp

weekendDays

peakTimes

time

Homeowner

WaterHeaterController

Thermostat

Clock

mode : ModeType

lowTemp : Temperature

highTemp : Temperature

weekendDays : Day[0..7]

peakTimes : TimePeriod[1..3]

setting : Temperature

time

checks

sets

setsParameters

Homeowner

WaterHeaterController

Thermostat

Clock

mode : ModeType

lowTemp : Temperature

highTemp : Temperature

weekendDays : Day[0..7]

peakTimes : TimePeriod[1..3]

setting : Temperature

time

checks

sets

setsParameters

Homeowner

WaterHeaterController

Thermostat

Clock

1

1

1

11

*

mode : ModeType

lowTemp : Temperature

highTemp : Temperature

weekendDays : Day[0..7]

peakTimes : TimePeriod[1..3]

setting : Temperature

time

New folder/L9-EngDesignResolution.ppt

Software Engineering Design Resolution

Software Engineering Design Resolution

  • At the end of Design Analysis, we looked at the requirements and the “System” mainly as a black box in terms of the external behavior and external characteristics – although we started to get into “potential” internals with Class Diagrams.

*

A Generic Software Engineering Design Process
(page 195)

*

Software Engineering Design Resolution

  • Goal of Design Resolution is to develop a design of the solution to the problem stated in the requirements.

  • The Design Resolution consist of 2 main parts
  • Architectural Design
  • Detailed Design

  • The result of design resolution is the design document from which code implementation can be performed.

Design Analysis

SRS

Design

Doc

Design Resolution:

- Architectural

- Detailed

software engineering design

Design Resolution

  • Designing is composed of two levels:

  • Architectural: where the following are defined or “opened”

  • major components,
  • their high level structure (responsibilities, properties, interfaces), and
  • their relationships and interactions

  • Detailed: where the following are defined and “opened”

  • internal elements of the major components,
  • those elements’ structures, relationships, and interactions,
  • their processing algorithms and attribute structure (data structure)

Main Parts of Software Architecture

  • Decomposition of “main” components

  • Assignment of responsibilities (functionalities) to the main components

  • Specification of properties of the main components

{ Specification of the states and transitions of states of the main components (note that state is a property) }

  • Specification of relationships among components
  • Specification of collaboration among components (note that collaboration is a kind of relationship)

  • Specification of interfaces among components

The Role of “Decomposition” in Design

Water Heating

System (Caldera)

Water Heater

Controller

User

Interface

Heating

Control

Thermostat

Interface

Timer

Interface

Decomposition

A Decomposition - Pictorial Discussion
(closer to Application Domain Driven)

Financial

System

Acct.

Pay.

Acct.

Rec.

Gen.

Ledger

- Decomposed into main parts by “Responsibilities”

- What other criteria may be used for decomposing into parts?

Acct-Pay

Acct-Rec.

Gen_Ledger

Post data

Post data

Identifying relationships

We still need to specify interfaces among the components and key properties

Another Decomposition - Pictorial Discussion
(closer to Software-Architecture Domain Driven)

Financial

System

UI

Financial

Logic

DB

Process/Control

(messages, interrupts, etc.)

Architectural Design Considerations

  • DeSCRIPTR

Architectural Design Considerations

  • DeSCRIPTR
  • ** Decomposed system into major components **
  • DeSCRIPTR
  • States that the major components may exist in
  • DeSCRIPTR
  • Collaboration among components to achieve a goal
  • DeSCRIPTR
  • ** Relationships among the major components in terms of dependencies and communications **
  • DeSCRIPTR
  • ** Interfaces among the components that have relationships **
  • DeSCRIPTR
  • ** Properties that the major components must possess or satisfy **
  • DeSCRIPTR
  • Transitions of components’ states
  • DeSCRIPTR
  • ** Responsibilities of the major components **

An Architectural Design may contain all or parts of this list. Should have the **

items.

Detailed Design Considerations

  • Detailed Design is a further refinement of the Architecture Design, starting with detailed decomposition of major components and all the subsequent refinements associated with smaller elements. Thus a refined DeSCRIPTR is part of the detailed design.

Detailed Design Considerations

  • There are 4 more considerations in Detailed Design

  • Packaging of the components and related elements
  • Implementation specifications for the packaged components
  • Algorithms that need to be used to implement the services/functionalities
  • Data structures and data types needed for the implementation

Some Basic Design Principles

  • Design Principles help make the design better.

  • Some are the same with other discipline and some are specific to software engineering.

  • The Basic Design Principles are meant to “improve satisfying product specification”

Basic Design Principles

  • Feasibility
  • The proposed design can be technically implemented, thus realizable
  • Adequacy
  • The proposed design meets the stakeholders needs and expectations (note: expectations are sometimes desires)
  • Economy
  • The proposed design can be implemented within reasonable cost (people resource and tool resources) and reasonable schedule.
  • Changeability
  • The proposed design results in implemented system that is “easily” modifiable (for both functional maintenance and quality maintenance.)

Some Observations about Basic Principles

  • Most of the Basic Principles are not easy to assess:

  • Feasibility : even though this can end up in a binary yes/no answer, it may take a while to assess. (Often, we choose the easy way out and design what we know works.)

Some Observations about Basic Principles

  • Adequacy: This may not be a binary answer, but a sliding scale answer in the form of “degree” of adequacy.

  • Number of requirements implemented / total requirements

  • Any other potential metric? (Next slide)

You Do It

  • Any other potential metric?

  • Go to this week Discussion area and share your thoughts with your classmates.

See next slide

Please Note

  • Remember, any slide with the title of “You Do It” in this course is for you to practice and learn more about the subject. Do not submit your work for grading.
  • You can go to the week Discussion area and share your thoughts with your classmates.
  • For better understanding of the materials in this course I expect that you take the slides with title “You Do It” seriously.
  • I’ll monitor your solutions and give my feedback when necessary.

Some Observations about Basic Principles

  • Economy : Some parts of this may be easy to assess and others more difficult.

  • Effort needed – person months

  • Elapsed time – calendar days or months

  • Cost – dollars expended

  • Risk - ??

Some Observations about Basic Principles

  • Changeability: how would you gauge this?
  • Modular size?

  • Amount of documentation and type of documentation?

  • Existence of external interfaces?

  • Use “abstract” Classes and inheritance

Design Criteria

  • Constructive (Construction) Design Principles are design criteria that experience has shown to lead to “good quality” product that also satisfy the Basic Design Principles:

  • Modularity Principles:
  • Self contained modules with well defined interfaces lead to high quality product
  • Implementability Principles:
  • Designs that are easier to implement leads to high quality product
  • Aesthetic Principles:
  • “beauty” and “ease of use” are concerns that lead to designs that please the users

Modularity in Design

  • Construct (via decomposition and reconstruction) the design in the form of well-defined “modules,” which are independent (self contained) units that perform specific services and have clear interfaces.

  • The definition of a module is not clear: (module may be a Class)

  • Is it size oriented (number of parts or lines of code)?
  • Is it complexity oriented (relations and dependencies)?

  • Advantages of “clearly-defined” modular (less size and complexity) design :

  • Easier to understand and explain to others
  • Easier to document
  • Easier to change
  • Easier to test and debug
  • Easier to re-use
  • Easier to improve upon for performance and other properties

Modularity Principles

  • 3 sub-principles:

  • Principle of “Small” Modules: Design with Smaller Modules are Better
  • Physical size based (small number of loc or parts)
  • Mental states based (small number of binary decisions)

  • Principle of Information Hiding: Design that Shields Internal Details of a Module’s Structure and Processing is Better
  • Shield the internal structure and processing
  • Must have clearly defined interfaces that do not expose the module’s internals

  • Principle of Least Privilege: Design that Does not Allow Access to Unneeded Resources is better
  • Restrict the modules from accessing unneeded resources
  • A bit related to coupling (next slide)

Information Hiding Example Similar to Text (p238)

Employee

Employee

Name

Address

Age

. .

Name

Address

BirthDate

. .

If we want to get the age of the person, it would be nice

to just evoke getAge( ) and have the age returned regardless

of how the attributes of the person is set. So, we may hide the

“age” or “birthdate” attribute of Employee.

i) getAge is easy in case (a)

ii) getAge may require a computation of [current date – birthdate] in (b)

however ---- we may need birthdate for other reason where age won’t

suffice

(a)

(b)

Low Coupling and High Cohesion

  • Coupling is the degree of connectedness among modules

  • Coupling should be kept to minimum – low coupling in design

  • Cohesion is the degree of relatedness of the parts within a module

  • Cohesion should be maximized --- high cohesion in design

Levels of Coupling

  • Content coupling (worst – high coupling)
  • One module directly references the content of another module. (such as using a pointer to get to another module’s data and modifying that data.)
  • Common coupling
  • Two or more modules all use a common, “global” data.
  • Usage of a database as a common “blackboard” for some control purpose. (This one is used very heavily in commercial applications.)
  • Control coupling
  • One module passes information or a parameter to control the logic of another module. (This one is often done in our design.)
  • Stamp coupling
  • One module passing a complete structure to another, through parameter, even though only a small part of the data structure is needed. (Passing a complete employee record when only the birth-date field is required. This also happens often in lazy design.)
  • Data coupling (best – low coupling)
  • Only the necessary items are passed from one module to another.

Levels of Cohesion

  • Coincidental cohesion (worst – weakest)
  • A module that performs multiple, unrelated tasks.
  • Logical cohesion
  • A module that performs a series of related functionalities. (This is often done in commercial world where a module performs the insertion, deletion, and modification of records of a “master-file”)
  • Temporal cohesion
  • A module that performs a set of tasks that are related in time (temporal). (This is also often done in commercial world where all the databases are “opened” at once during the beginning of a module.)
  • Procedural cohesion
  • A module that performs two related procedures that probably should be done separately (such as read a record form one file and based on the information go update another file.)
  • Communicational cohesion
  • A module performing a sequence of related tasks on a same piece of data where the sequence of tasks is based on some specific procedure.
  • Sequential cohesion
  • A module performing related sequence of tasks where an output of one is the input to the next task in sequence.

  • Functional cohesion (best – strongest)
  • A module that performs exactly one task to achieve a single goal.

Balancing the Design

  • Design small, single purpose, cohesive modules --- sounds good

  • But if the whole design is composed of these, then there may be a lot of passing of control and/or data among these in order to accomplish anything significant ---- causing high coupling.

  • So we need to constantly balance between low coupling and high cohesion. These two criteria may sometimes collide against each other.

Balance low coupling and high

cohesion in design by thinking

of :

  • Easier to understand & explain
  • Easier to document
  • Easier to change
  • Easier to test and debug
  • Easier to re-use
  • Easier to improve upon

Implementability Principles

  • Once we have an implementable design, it is still important to address how easy is it to implement:

  • “Simpler” design are easier to understand and implement (e.g. simple in # number of steps?)
  • Reuse the existing artifacts to save effort and time
  • Design with reuse for the future.

Design with reuse often introduces more work and possibly even more

complexity. --- why?

Again, design is a balancing act here, too. Design for reuse may conflict

with design for only the specific and simple solution.

Aesthetic Principles

  • A design is better because it is more pleasing to the mind (or beautiful).
  • Gelernter of Yale states that beauty is:

  • Simplicity
  • Yet powerful (functionalities and speed)

Simple and powerful is hard to measure and is still new. However, many

Mathematical proofs have been labeled “elegant” because they are simple

and powerful.

Other Principles

  • User Oriented Design:

  • Design to “delight” the users
  • Matches or exceeds user expectations
  • Stays within users’ knowledge and experience context

  • Design to “improve the user experience”
  • matches users’ past experience and extends the experience by extrapolating and improving some part of the interaction

These are just as hard to measure and define as the aesthetic principles.

Yet, Steve Jobs of Apple seem to introduce new products that capture this concept.

Summarizing Design Principles

Design Principles

Feasible

Adequate

Economical

Changeable

Basic

Design Criteria

User

Oriented

small

Modularity

Info hiding

least

privilege

simple

cohesion

coupling

reuse

reusable

Aesthetic

beauty

(simple

& power)

delight

Improve &

extend

experience

Implementability

Questions

*

Generic Software Engineering Design

SRS : Problem

Design Document : Solution

Analysis

Architectural

Design

Design

Document

SRS

[adequate architecture]

[else]

[adequate detailed design]

[adequate architecture]

Analyze SRS

Generate/Improve

Candidate Architectures

Evaluate Candidate

Architectures

Select Architecture

Finalize Architecture

Generate/Improve Detailed

Design Alternatives

Evaluate Detailed

Design Alternatives

[else]

Select Detailed

Design

Finalize Design

[else]

Detailed

Design