Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

27
Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU

Transcript of Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

Page 1: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

Computing and SE II

Chapter 6: Software Design

Er-Yu Ding

Software Institute, NJU

Page 2: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

Main Contents

1. What is Software Design?

Page 3: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of design situations (1) Design situations start with a need and require

intention A need so identified acts as the initial motivational force

that provides the basis for starting design work. Design situations involve transformation

Design is the restructuring of a current situation to achieve some preferred situation

Generation of new ideas is fundamental to design situations Design occurs whenever there is an “imaginative jump from

present facts to future possibilities.” The precise manner in which new ideas are generated

cannot be codified.

Page 4: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of design situations (2) Constraint satisfaction

An initial need determines the most basic constraints and requirements on a design situation.

In general, more constraints are eventually discovered during the design work itself.

The constraints that apply both to the designed artifact and to the processes and participants involved during the design activity.

Problem solving or decision making The solution space for design problems is very large and its

sheer size eliminates exhaustive search as a possible problem solving technique

“design” is characterized by a series of decisions between various design alternatives

Each divergent perspective may influence the progress of the design in different and unpredictable ways.

Page 5: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of design situations (3) Design results in a scheme for implementing an

artifact “Design” is essentially “the formulation of a prescription or

model for a finished work in advance of its embodiment” Design representation serves as the basis to conceptualize

and compare various design decisions. Sometimes, a design does not result in a distinct “plan-

then-implement” situation. Often the design output occurs incrementally while the design

and the artifact evolve together.

Page 6: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design? ----Characteristics of design situations (4) Diversity and evolution

Any particular design situation could be drawn in many different directions.

The designer’s act of making decisions among the various identified design alternatives ties together this evolution of the design.

The evolution of a design is often closely linked to the consolidation of the constraints and requirements applied in a particular design situation.

Page 7: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (1) Design situations start with a need and require

intention RE is needed before software design

Finding the problems, defining the requirements Design situations involve transformation

Software changes the world Designing base on limited objects (shared phenomenon共享现象 ) and fixed rules (domain characteristics领域特性 )

So, Requirements, Shared Phenomenon and Domain Characteristics comprising the basis of software design, that is Analysis Model

Page 8: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

Analysis Model

use-cases - text use-case diagrams activity diagrams swim lane diagrams

data flow diagrams control-flow diagrams processing narratives

f low-oriented elements

behavioralelements

class-basedelements

scenario-basedelements

class diagrams analysis packages CRC models collaboration diagrams

state diagrams sequence diagrams

Data/ Class Design

Architec tural Design

Interface Design

Component - Level Design

Design Model

Analysis Model -> Design Model

Page 9: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (2) Generation of new ideas is fundamental to

design situations Styles of idea generation in Software Design

Abstract Elaboration Modularization Information Hiding

Encapsulation

Outcomes of idea generation Functional independent (Separating concerns)

General Styles of Design Theory

Specific Styles of Software Design

Page 10: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (2) Abstraction

Abstraction manages complexity by emphasizing essential characteristics and suppressing implementation details Procedural abstract Data abstract

Allows postponement of certain design decisions that occur at various levels of analysis, e.g., Interface and Implementation Inherit

Page 11: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (2) Elaboration

Stepwise Refinement Decomposition Hierarchical Structures

open

walk to door;reach for knob;

open door;

walk through;close door.

repeat until door opensturn knob clockwise;if knob doesn't turn, then take key out; find correct key; insert in lock;endifpull/push doormove out of way;end repeat

Page 12: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (2) Modularization

High Cohesion: A module should encapsulate some well-defined, coherent piece of functionality (more on that later)

Low Coupling: Minimize the amount of dependencies between modules

Page 13: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (2) Information Hiding

Information hiding is an important means of achieving abstraction i.e., design decisions that are subject to change should be

hidden behind abstract interfaces Application software should communicate only through

well-defined interfaces Each interface should be specified by as little information

as possible If internal details change, clients should be minimally

affected May not even require recompilation and relinking...

Page 14: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (3) Constraint satisfaction

Managing Software Quality, especially nonfunctional requirements

Page 15: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (3) Software Quality

Functional and nonfunctional Visible and invisible

Quality Guidelines A design should exhibit an architecture A design should be modular A design should contain distinct representations A design should lead to data structures that are appropriate. A design should lead to components that exhibit independent

functional characteristics. A design should lead to interfaces that reduce the complexity. A design should be derived using a repeatable method. A design should be represented using a notation that effectively

communicates its meaning.

Page 16: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (4) Problem solving or decision making

Emphasis on fundamental decision Architectures Design

Dividing decisions making work with different concerns HCI Design Distribution Design Safety Design Real-Time Design …

Page 17: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (4) Architectures

“The overall structure of the software and the ways in which that structure provides conceptual integrity for a system.” [SHA95a]

Structural properties. This aspect of the architectural design representation defines the components of a system (e.g., modules, objects, filters) and the manner in which those components are packaged and interact with one another. For example, objects are packaged to encapsulate both data and the processing that manipulates the data and interact via the invocation of methods Extra-functional properties. The architectural design description should address how the design architecture achieves requirements for performance, capacity, reliability, security, adaptability, and other system characteristics.Families of related systems. The architectural design should draw upon repeatable patterns that are commonly encountered in the design of families of similar systems. In essence, the design should

have the ability to reuse architectural building blocks.

Page 18: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (5) Design results in a scheme for implementing

an artifact Software Model: Design Model

Page 19: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

The Design Modelprocess dimension

architecture elements

interface elements

component-level elements

deployment-level elements

low

high

class diagrams analysis packages CRC models collaboration diagrams

use-cases - text use-case diagrams activity diagrams swim lane diagrams collaboration diagrams data flow diagrams

control-flow diagrams processing narratives

data flow diagrams control-flow diagrams processing narratives

state diagrams sequence diagrams

state diagrams sequence diagrams

design class realizations subsystems collaboration diagrams

design class realizations subsystems collaboration diagrams

refinements to:

deployment diagrams

class diagrams analysis packages CRC models collaboration diagrams

component diagrams design classes activity diagrams sequence diagrams

refinements to:

component diagrams design classes activity diagrams sequence diagrams

design class realizations subsystems collaboration diagrams

component diagrams design classes activity diagrams sequence diagrams

analysis model

design model

Requirements: constraints interoperability targets and configuration

technical interface design Navigation design GUI design

Page 20: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (5) Design Model Elements

Data elements Data model --> data structures Data model --> database architecture

Architectural elements Application domain Analysis classes, their relationships, collaborations and

behaviors are transformed into design realizations Patterns and “styles”

Page 21: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (5) Design Model Elements

Interface elements the user interface (UI) external interfaces to other systems, devices, networks

or other producers or consumers of information internal interfaces between various design components.

Component elements Local data structures, behaviors and algorithms

Deployment elements Environment, Distribution

Page 22: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (6) Diversity and evolution

Sharing common knowledge of Problems Solving: Patterns

Architecture styles Design Patterns Coding Patterns: data structures

Software evolution: Refactoring Reusing successful solution

Frameworks Components (构件 )

Page 23: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (6) Design Patterns

The best designers in any field have an uncanny ability to see patterns that characterize a problem and corresponding patterns that can be combined to create a solution

A description of a design pattern may also consider a set of design forces. Design forces describe non-functional requirements

(e.g., ease of maintainability, portability) associated the software for which the pattern is to be applied.

The pattern characteristics (classes, responsibilities, and collaborations) indicate the attributes of the design that may be adjusted to enable the pattern to accommodate a variety of problems.

Page 24: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (6) Refactoring

Fowler [FOW99] defines refactoring in the following manner: "Refactoring is the process of changing a software

system in such a way that it does not alter the external behavior of the code [design] yet improves its internal structure.”

When software is refactored, the existing design is examined for redundancy unused design elements inefficient or unnecessary algorithms poorly constructed or inappropriate data structures or any other design failure that can be corrected to

yield a better design.

Page 25: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

1. What is Software Design?----Characteristics of Software Design (6) Frameworks

A framework is not an architectural pattern, but rather a skeleton with a collection of “plug points” (also called hooks and slots) that enable it to be adapted to a specific problem domain.

Gamma et al note that: Design patterns are more abstract than frameworks. Design patterns are smaller architectural elements than

frameworks Design patterns are less specialized than frameworks

Page 26: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

Components A software components is a software element that

conforms to specific interactions and composition standards

can be independently deployed and composed without modification (according to a composition standard)

Common components Local: ActiveX, OLE, JavaBean, COM Network: COM+, EJB, CORBA, Web Service

1. What is Software Design?----Characteristics of Software Design (6)

Page 27: Computing and SE II Chapter 6: Software Design Er-Yu Ding Software Institute, NJU.

The End

Recommended Paper Abstract from <Design Theory and Software

Design> Next Lecture

Software Architecture Design