30
Design Phase Design Phase What’s design? What’s design? the process of applying various techniques and principles the process of applying various techniques and principles for the purpose of defining a device, a process, or a system for the purpose of defining a device, a process, or a system in sufficient detail to permit its physical realization in sufficient detail to permit its physical realization Design Issues: Modularity (Refinement, Design Issues: Modularity (Refinement, Abstraction) Abstraction) Design Model: Classical vs. Object-Oriented Design Model: Classical vs. Object-Oriented Model Model Design Process: Classical vs. Object-Oriented Design Process: Classical vs. Object-Oriented Model Model * *Software Engineering: a Practitioner’s Approach (chap 13, 14, 21) [Pressman, 1997]

Design Phase

Embed Size (px)

DESCRIPTION

Design Phase. What’s design? the process of applying various techniques and principles for the purpose of defining a device, a process, or a system in sufficient detail to permit its physical realization Design Issues: Modularity (Refinement, Abstraction) - PowerPoint PPT Presentation

Citation preview

Page 1: Design Phase

Design PhaseDesign Phase

What’s design?What’s design? the process of applying various techniques the process of applying various techniques

and principles for the purpose of defining a and principles for the purpose of defining a device, a process, or a system in sufficient device, a process, or a system in sufficient detail to permit its physical realizationdetail to permit its physical realization

Design Issues: Modularity (Refinement, Abstraction)Design Issues: Modularity (Refinement, Abstraction) Design Model: Classical vs. Object-Oriented ModelDesign Model: Classical vs. Object-Oriented Model Design Process: Classical vs. Object-Oriented ModelDesign Process: Classical vs. Object-Oriented Model

**Software Engineering: a Practitioner’s Approach (chap 13, 14, 21) [Pressman, 1997]

Page 2: Design Phase

Design PrinciplesDesign Principles

not suffer from tunnel vision not suffer from tunnel vision be traceable to the analysis modelbe traceable to the analysis model not reinvent the wheelnot reinvent the wheel minimize the intellectual distance minimize the intellectual distance

between software and the between software and the problems in the real world.problems in the real world.

exhibit uniformity and integrationexhibit uniformity and integration

Page 3: Design Phase

Design IssuesDesign Issues

What’s design quality? Are there What’s design quality? Are there uniform criteria that define the uniform criteria that define the technical quality of a software design?technical quality of a software design?

What criteria can be used to partition What criteria can be used to partition software into individual components?software into individual components?

How is function or data structure detail How is function or data structure detail separated from a conceptual separated from a conceptual representation of the software?representation of the software?

Page 4: Design Phase

Design QualityDesign Quality

Implement all of the Implement all of the explicit requirements explicit requirements contained in the contained in the analysis modelanalysis model

A readable, A readable, understandable understandable guide for developersguide for developers

Provide a complete Provide a complete picture of the picture of the softwaresoftware

Makes intelligent Makes intelligent use of control use of control among elements of among elements of softwaresoftware

Contain both data Contain both data and procedural and procedural abstractionsabstractions

Lead to interfaces Lead to interfaces to reduce to reduce complexitycomplexity

Page 5: Design Phase

Modularity Modularity (Abstraction & (Abstraction & Refinement)Refinement)

Each step in the software engineering Each step in the software engineering process is a refinement in the level of process is a refinement in the level of abstraction of the software solution.abstraction of the software solution.

Refinement causes the designer to Refinement causes the designer to elaborate on the solution statement, elaborate on the solution statement, providing more and more detail as each providing more and more detail as each successive refinement occurs.successive refinement occurs.

Software is divided into separately named Software is divided into separately named and addressable components that are and addressable components that are integrated to satisfy problem requirements.integrated to satisfy problem requirements.

Page 6: Design Phase

How to defineHow to define Module?Module?[Meyer, 88][Meyer, 88]

DecomposabilityDecomposability: decompose a large : decompose a large problem into subproblemsproblem into subproblems

ComposabilityComposability: enables existing : enables existing design components to be assembled design components to be assembled into a new systeminto a new system

UnderstandabilityUnderstandability Continuity & ProtectionContinuity & Protection: make small : make small

change and reduce the propagation of change and reduce the propagation of side effects of an error.side effects of an error.

Page 7: Design Phase

EffectiveEffective Modular DesignModular Design

Functional independenceFunctional independence: a : a direct outgrowth of modularity and direct outgrowth of modularity and the concepts of abstraction and the concepts of abstraction and information hiding information hiding

CohesionCohesion: a measure of the relative : a measure of the relative functional strength of a module.functional strength of a module.

CouplingCoupling: a measure of the relative : a measure of the relative interdependence among modulesinterdependence among modules

Page 8: Design Phase

Design Heuristics for Design Heuristics for Effective ModularityEffective Modularity

Evaluate the first Evaluate the first iteration of the iteration of the program structure to program structure to reduce coupling and reduce coupling and improve cohesion.improve cohesion.

Keep scope of effect Keep scope of effect of a module within of a module within the scope of control the scope of control of that moduleof that module

Evaluate module Evaluate module interfaces to reduce interfaces to reduce complexity and complexity and redundancy and redundancy and improve consistency improve consistency

Define modules Define modules whose function is whose function is predictable, but not predictable, but not overly restrictive.overly restrictive.

Page 9: Design Phase

Software ArchitectureSoftware Architecture

The architecture of a software systemThe architecture of a software system defines the system in terms of components and defines the system in terms of components and

interactions among componentsinteractions among components shows correspondence between requirements and shows correspondence between requirements and

elements of the constructed systemelements of the constructed system addresses system-level properties (scale, capacity, addresses system-level properties (scale, capacity,

throughput, consistency, compatibility)throughput, consistency, compatibility) An architectural definition identifiesAn architectural definition identifies

components: define the locus of computationcomponents: define the locus of computation e.g., filters, database, objects, clients, serverse.g., filters, database, objects, clients, servers

connectors: mediate interactions of componentsconnectors: mediate interactions of components e.g., procedure call, pipes, event broadcaste.g., procedure call, pipes, event broadcast

properties: specify info for construction & analysisproperties: specify info for construction & analysis e.g., signatures, pre/post conditionse.g., signatures, pre/post conditions

Page 10: Design Phase

Control Hierarchy (View)Control Hierarchy (View)

A module controls another module or is controlled by (superordinate vs. subordinate)

Visibility: components are invoked or used as data by a given component (directly or indirectly)

Connectivity: set of components are directly invoked or used as data by a given component.

Page 11: Design Phase

Structural PartitioningStructural Partitioning

Horizontal partitioningHorizontal partitioning: separate : separate branches of the modular hierarchy for branches of the modular hierarchy for each major program function each major program function (input/computation/output)(input/computation/output)

Vertical partitioningVertical partitioning: control and : control and work should be distributed top-down work should be distributed top-down (controller-at-top, worker-at-bottom)(controller-at-top, worker-at-bottom)

BenefitsBenefits:easier to test and maintain, :easier to test and maintain, fewer side effects, easier to extendfewer side effects, easier to extend

Page 12: Design Phase

Data StructureData Structure

A representation of the logical A representation of the logical relationship among individual relationship among individual elements elements organizationorganization methods of access methods of access degree of associativitydegree of associativity processing alternatives for processing alternatives for

informationinformation

Page 13: Design Phase

Classical Design ModelClassical Design Model

Data designData design: transform the information domain : transform the information domain model created during analysis into the data model created during analysis into the data structurestructure

Architectural designArchitectural design: define the relationship : define the relationship among major structural elements of the program.among major structural elements of the program.

Interface designInterface design: describe how the software : describe how the software communicates within itself, to systems that communicates within itself, to systems that interoperate with it, and with humans who use it.interoperate with it, and with humans who use it.

Procedural designProcedural design: transforms structural : transforms structural elements of the program architecture into a elements of the program architecture into a procedural description of software components.procedural description of software components.

Page 14: Design Phase

Object-Oriented Design Object-Oriented Design ModelModel

The subsystem layer: The subsystem layer: a representation of each of the a representation of each of the subsystems to achieve its customer defined requirements subsystems to achieve its customer defined requirements and to implement the technical infrastructure that supports and to implement the technical infrastructure that supports customer requirements.customer requirements.

The class and object layer:The class and object layer: the class hierarchies that the class hierarchies that enable the system to be created using generalizations and enable the system to be created using generalizations and increasingly more targeted specializations; design increasingly more targeted specializations; design representations of each object. representations of each object.

The message layer:The message layer: the details that enable each object to the details that enable each object to communicate with its collaborators (the external and communicate with its collaborators (the external and internal interfaces).internal interfaces).

The responsibility layer:The responsibility layer: the data structure and the data structure and algorithmic design for all attributes and operations for each algorithmic design for all attributes and operations for each other.other.

Page 15: Design Phase

Object-Oriented Design ModelObject-Oriented Design Model

What’s Subsystem? What’s Subsystem?

A subset of all classes collaborate A subset of all classes collaborate among themselves to accomplish a among themselves to accomplish a set of cohesive responsibilities. set of cohesive responsibilities. [Wirfs-Brock et al, 1990][Wirfs-Brock et al, 1990]..

Page 16: Design Phase

Classical Design Process Classical Design Process (Data Design) (Data Design)

Identify all data structures and the Identify all data structures and the operations to be performed on each.operations to be performed on each.

Establish a data dictionary (data library) to Establish a data dictionary (data library) to be used both data and program designbe used both data and program design

Defer low-level data design decisions.Defer low-level data design decisions. A software design and programming A software design and programming

language should support the specification language should support the specification and realization of abstract data type.and realization of abstract data type.

Page 17: Design Phase

Classical Design Process Classical Design Process (Architecture Design) (Architecture Design)

Data flow-oriented design: Data flow-oriented design: Information flow type/ boundary are Information flow type/ boundary are

establishedestablished The DFD is mapped into program structureThe DFD is mapped into program structure

Mapping individual transforms of a DFD into Mapping individual transforms of a DFD into appropriate modules within the program structure.appropriate modules within the program structure.

Control hierarchy is defined by factoring (a Control hierarchy is defined by factoring (a top-down distribution of controls)top-down distribution of controls)

The resultant structure is refined using The resultant structure is refined using design measures and heuristicsdesign measures and heuristics

Page 18: Design Phase

Classical Design Process Classical Design Process (Data flow-oriented design) (Data flow-oriented design)

Figure 12.3 Data flow diagramFigure 12.3 Data flow diagram Figure 12.4 & 12.5 Structure chartsFigure 12.4 & 12.5 Structure charts Figure 12.6 Detailed designFigure 12.6 Detailed design Figure 12.7 PDL (pseudocode) representationFigure 12.7 PDL (pseudocode) representation Figure 12.8 Data flow diagram with multiple Figure 12.8 Data flow diagram with multiple

input & output streamsinput & output streams to find the point of highest abstraction of input/output for to find the point of highest abstraction of input/output for

each input/output streameach input/output stream use these points to decompose the given data flow diagram use these points to decompose the given data flow diagram

into modules with fewer input/output streams. Continue in into modules with fewer input/output streams. Continue in this way until each module has high cohesion.this way until each module has high cohesion.

Page 19: Design Phase

Classical Design Process Classical Design Process (Interface Design) (Interface Design)

The design of interface b/w software modulesThe design of interface b/w software modules The design of interface b/w the software and The design of interface b/w the software and

other external entitiesother external entities The design of the interface b/w a human and The design of the interface b/w a human and

a computera computer User model: novices, knowledgeable, User model: novices, knowledgeable,

intermittent users, knowledgeable, intermittent users, knowledgeable, frequent usersfrequent users

General interaction, Information display, General interaction, Information display, Data inputData input

Page 20: Design Phase

Classical Design Process Classical Design Process (Procedural Design) (Procedural Design)

Structured programmingStructured programming Graphical design notationGraphical design notation Program description language Program description language

(PDL)(PDL)

Page 21: Design Phase

Classical Design Process Classical Design Process (Post Processing) (Post Processing)

Processing narrative must be developed Processing narrative must be developed for each modulefor each module

An interface description is provided for An interface description is provided for each moduleeach module

Local and global data structures are Local and global data structures are defineddefined

All design restrictions/limitations are All design restrictions/limitations are noted.noted.

A design review is conducted: Optimization A design review is conducted: Optimization (time, space, etc) is considered.(time, space, etc) is considered.

Page 22: Design Phase

Object-Oriented Design Object-Oriented Design Process (Process (Partitioning OOAPartitioning OOA))

The classes within a subsystem should The classes within a subsystem should collaborate only with other classes within collaborate only with other classes within the subsystem.the subsystem.

The number of subsystems should be kept The number of subsystems should be kept small.small.

Subsystems can be partitioned internally to Subsystems can be partitioned internally to help reduce complexity.help reduce complexity.

A well-defined interface through which all A well-defined interface through which all communication with the rest of the system communication with the rest of the system occurs.occurs.

Page 23: Design Phase

OO Design Process (Process & OO Design Process (Process & Task Management)Task Management)

Allocate each subsystem to an independent Allocate each subsystem to an independent processorprocessor

Allocate the subsystems to the same Allocate the subsystems to the same processor and provide concurrency support processor and provide concurrency support through operating system features through operating system features

The characteristics of the task, coordinator The characteristics of the task, coordinator task and associated objects are definedtask and associated objects are defined

The coordinator and other tasks are The coordinator and other tasks are integrated (task name, description, priority, integrated (task name, description, priority, services, coordinates by, communicates via)services, coordinates by, communicates via)

Page 24: Design Phase

OO Design Process (UML)OO Design Process (UML)

Construct interaction diagramsConstruct interaction diagrams Figure 12.12 Sequential diagram: Figure 12.12 Sequential diagram:

emphasize the explicit chronological emphasize the explicit chronological sequence of message, useful in situations sequence of message, useful in situations where the order in which event occur is where the order in which event occur is important. important.

Figure 12.13 Collaboration diagram: Figure 12.13 Collaboration diagram: emphasize the relationship between objects emphasize the relationship between objects and are a powerful tool for understanding and are a powerful tool for understanding the structure of the software product.the structure of the software product.

Page 25: Design Phase

OO Design Process (UML)OO Design Process (UML) Construct the detailed class diagramConstruct the detailed class diagram

Figure 12.14 Detailed Class Diagram: determine Figure 12.14 Detailed Class Diagram: determine which actions (method) should be associated with which actions (method) should be associated with each class or client that sends a message to an each class or client that sends a message to an object of that class (responsibility-driven design), object of that class (responsibility-driven design), information hiding, inheritanceinformation hiding, inheritance

Design the product: clients of objectsDesign the product: clients of objects Figure 12.15 Client-object relations: clients of each Figure 12.15 Client-object relations: clients of each

object; missing (object; missing (requests, log-request, update-requests, log-request, update-requestrequest) in ) in Elevator-controllerElevator-controller

Proceed to the detailed designProceed to the detailed design Figure 12.16 Detailed designFigure 12.16 Detailed design

Page 26: Design Phase

OO Design Process (Data & OO Design Process (Data & Resource Management)Resource Management)

The design of the attributes and The design of the attributes and operations required to manage operations required to manage objects.objects.

External entities (disk drive, External entities (disk drive, processor, communication processor, communication channel, etc) and abstractions channel, etc) and abstractions (database, objects)(database, objects)

Human and computer interface Human and computer interface

Page 27: Design Phase

OO Design Process OO Design Process (Intersubsystem Commun.)(Intersubsystem Commun.)

List each request that can be made by List each request that can be made by collaborators of the subsystems.collaborators of the subsystems.

For each contract, note the operations that For each contract, note the operations that are required to implement the responsibilities are required to implement the responsibilities implied by the contract (implied by the contract (contract is the contract is the specification of the service provided by a specification of the service provided by a subsystem to its clientssubsystem to its clients))

For each contract, define type, collaborator, For each contract, define type, collaborator, class, operationclass, operation

A subsystem collaboration graph or table can A subsystem collaboration graph or table can be constructed for complex system.be constructed for complex system.

Page 28: Design Phase

Object Design Process (pObject Design Process (protocol rotocol & implementation description)& implementation description)

Establish the interface of an object by Establish the interface of an object by defining each message, the related defining each message, the related operations.operations.

Implementation details for each operation Implementation details for each operation implied by a message that is passed to an implied by a message that is passed to an object. object. A specification of the object’s name and reference to A specification of the object’s name and reference to

classclass Specification of private data structures with indication Specification of private data structures with indication

of data items and types of data items and types A procedural description of each operationA procedural description of each operation

Page 29: Design Phase

Object Design ProcessObject Design Process algorithm & data structurealgorithm & data structure

A specification for all operations and A specification for all operations and attributes. attributes. Algorithm is created to implement the Algorithm is created to implement the

specification for each operation. specification for each operation. Since operations invariably manipulate Since operations invariably manipulate

the attributes of a class, the design of the the attributes of a class, the design of the data structures that best reflect the data structures that best reflect the attributes will have a strong bearingattributes will have a strong bearing on on the algorithm design of the corresponding the algorithm design of the corresponding operations.operations.

Page 30: Design Phase

Object Design Process Object Design Process components & interfacescomponents & interfaces

MModularity- specification of odularity- specification of componentcomponent Modules are combined to form a Modules are combined to form a

complete program (defines the object as complete program (defines the object as a program component that is linked to a program component that is linked to other components)other components)

The interface that exist between objects The interface that exist between objects and the overall structure of the objects and the overall structure of the objects must be identified (stepwise refinement)must be identified (stepwise refinement)