From Module Decomposition to Interface Specification Software Architecture Part 2.

Slides:



Advertisements
Similar presentations
Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Advertisements

COMPSCI 105 S Principles of Computer Science 12 Abstract Data Type.
Chapter 2 – Software Processes
Architecture III Uses and Process Structures 1. Outline Lecture: –Design for extension and contraction: the “uses” structure –Design for run-time separation.
Software Architecture for DSD DSD Team. Overview What is software architecture and why is it so important? The role of architecture in determining system.
Software Architecture for DSD
Introduction To System Analysis and Design
7M701 1 Software Engineering Object-oriented Design Sommerville, Ian (2001) Software Engineering, 6 th edition: Chapter 12 )
THE OBJECT-ORIENTED DESIGN WORKFLOW Interfaces & Subsystems.
Design The goal is to design a modular solution, using the techniques of: Decomposition Abstraction Encapsulation In Object Oriented Programming this is.
1 Objectives To introduces the concept of software Design. To introduce the concept of Object- Oriented Design (OOD). To Define various aspects about object.
From Module Breakdown to Interface Specifications Completing the architectural design of Map Schematizer.
Chapter 1 Principles of Programming and Software Engineering.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Principle of Functional Verification Chapter 1~3 Presenter : Fu-Ching Yang.
The Modular Structure of Complex Systems D.L. Parnas, P.C. Clement, and D.M. Weiss Published in IEEE Transactions on Software Engineering, March 1985 Presented.
CSC230 Software Design (Engineering)
[ §4 : 1 ] 4. Requirements Processes II Overview 4.1Fundamentals 4.2Elicitation 4.3Specification 4.4Verification 4.5Validation Software Requirements Specification.
Software Architecture for DSD The “Uses” Relation.
The Project AH Computing. Functional Requirements  What the product must do!  Examples attractive welcome screen all options available as clickable.
What is Software Architecture?
USE Case Model.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Managing Software Requirements in DSD Stuart Faulk University of Oregon.
Lesson 7 Guide for Software Design Description (SDD)
From Module Decomposition to Interface Specification Software Architecture Part 2.
Introduction to Object-oriented programming and software development Lecture 1.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
CSE 303 – Software Design and Architecture
CS 360 Lecture 3.  The software process is a structured set of activities required to develop a software system.  Fundamental Assumption:  Good software.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Software Requirements Engineering CSE 305 Lecture-2.
Software Engineering Management Lecture 1 The Software Process.
SOFTWARE DESIGN (SWD) Instructor: Dr. Hany H. Ammar
SOFTWARE DESIGN.
SE: CHAPTER 7 Writing The Program
David Weiss Software Product-Line Engineering: A Family-Based Software Development Process: Designing The Family David Weiss
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Systems Analysis and Design in a Changing World, 3rd Edition
UHD::3320::CH121 DESIGN PHASE Chapter 12. UHD::3320::CH122 Design Phase Two Aspects –Actions which operate on data –Data on which actions operate Two.
Design Concepts By Deepika Chaudhary.
Instructor: Tasneem Darwish1 University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Software Systems.
SOFTWARE DESIGN. INTRODUCTION There are 3 distinct types of activities in design 1.External design 2.Architectural design 3.Detailed design Architectural.
1 CS 501 Spring 2004 CS 501: Software Engineering Lecture 2 Software Processes.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
1 CS161 Introduction to Computer Science Topic #9.
Chapter 2 – Software Processes Lecture 1 Chapter 2 Software Processes1.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Architecture View Models A model is a complete, simplified description of a system from a particular perspective or viewpoint. There is no single view.
Software Engineering Issues Software Engineering Concepts System Specifications Procedural Design Object-Oriented Design System Testing.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 4 Slide 1 Software Processes.
Oman College of Management and Technology Course – MM Topic 7 Production and Distribution of Multimedia Titles CS/MIS Department.
CSIS 4850: CS Senior Project – Spring 2009 CSIS 4850: Senior Project Spring 2009 Object-Oriented Design.
Software Development Process CS 360 Lecture 3. Software Process The software process is a structured set of activities required to develop a software.
Chapter 2 Principles of Programming and Software Engineering.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
SOFTWARE DESIGN & SOFTWARE ENGINEERING Software design is a process in which data, program structure, interface and their details are represented by well.
Software Design and Development Development Methodoligies Computing Science.
Achieving Critical System Qualities Through Software Architecture Dr. Stuart Faulk Computer and Information Science University of Oregon.
 System Requirement Specification and System Planning.
Principles of Programming & Software Engineering
Software Engineering Management
Data Abstraction: The Walls
Principles of Programming and Software Engineering
What Is Good Software(Program)?
Oriented Design and Abstract Data Type
Presentation transcript:

From Module Decomposition to Interface Specification Software Architecture Part 2

Outline Module decomposition with example Module interface specification © S. Faulk 20102

DSD Architectural Design Goals Limit the necessity for communication by limiting the dependencies (coupling) between components Goals: divide the system into work assignments such that – Each part can be assigned to a different team and developed independently – Parts can be independently verified – It is possible to change the implementation details of one module without affecting other modules – Only properties of the system that are unlikely to need to be change are used by other modules – Role of each part in the overall system is clear (and when together, implement the requirements) © S. Faulk 20103

Information-Hiding Structure Architectural model: called the “information hiding” structure Components – Called modules – Leaf modules are work assignments Relations – “submodule-of” – The set of submodules of any module X partition X’s functionality – Constrained to be acyclic tree (hierarchy) Module interfaces – Modules at the leaves of the tree provide the methods implementing the system’s functionality – The set of methods and their behavior define the module interfaces The interface methods provide the only access to a module’s internal state – Information encapsulated (internal) by the module are called its “secrets” © Stuart Faulk 20094

Submodule-of Relation To define the structure, need the relation and the rule for constructing the relation Relation: sub-module-of Rules – If a module consists of parts that can change independently, then decompose it into submodules – Don’t stop until each module contains only things likely to change together – Anything that other modules should not depend on become secrets of the module (e.g., implementation details) – If the module has an interface, only things not likely to change can be part of the interface © S. Faulk 20105

Module Hierarchy © S. Faulk Problem Interface Encapsulated “Secrets” Interface Encapsulated Interface Encapsulated Interface Encapsulated Submodule-of relation Leaf Modules = Work assignments

An Example: The FWS Module Structure

Floating Weather Stations (FWS) Floating weather stations (FWS) are buoys that float at sea and that are equipped with sensors to monitor weather conditions. Each FWS has an on-board computer that maintains a history of recent weather data. At regular intervals the buoy transmits the weather data using a radio transmitter. The initial prototype for the buoy will measure the wind speed in knots. The buoys will use four small wind speed sensors (anemometers): two high-resolution sensors and two, less expensive, low-resolution sensors. Accuracy is software enhanced by computing a weighted-average of the sensor readings over time. Each sensor is read once every second with the readings averaged over four readings before being transmitted. The calculated wind speed is transmitted every two seconds. Over the course of development and in coming versions, we anticipate that the hardware and software will be routinely upgraded including adding additional types of sensors (e.g. wave height, water temperature, wind direction, air temperature). A system that can be rapidly revised to accommodate new features is required..

FWS Likely Changes Likely changes B ehavior C 1. The formula used for computing wind speed from the sensor readings may vary. In particular, the weights used for the high resolution and low resolution sensors may vary, and the number of readings of each sensor used (the history of the sensor) may vary. C2. The format of the messages that an FWS sends may vary. C3. The transmission period of messages from the FWS may vary. C4. The rate at which sensors are scanned may vary. Devices C4. The number and types of wind speed sensors on a FWS may vary. C5. The resolution of the wind speed sensors may vary. C6. The wind speed sensor hardware on a FWS may vary. C7. The transmitter hardware on a FWS may vary. C8. The method used by sensors to indicate their reliability may vary.

Classifying Changes Three classes of change – hardware new devices new computer – required behavior new functions new rules of computing values new timing constraints – software decisions new ways to represent data types different algorithms or data structures © S. Faulk From Requirements Specification

Top-Level Module Decomposition Device Interface (DI) – Secret = properties of physical hardware – Encapsulates any hardware changes Behavior-Hiding (BH) – Secret = algorithms/data addressing requirements – Encapsulates requirements changes Software Decision (SD) – Secret = decisions by designer – Encapsulates internal design decisions © Stuart Faulk Device Interface Behavior Hiding Software Decision

DI Submodules Windspeed Sensor Driver – Service: provides access wind speed values – Secrets: Anything that would change if the current wind speed sensor were replaced with another. For example, the details of data formats and how to communicate with the sensor Transmitter Driver – Service: transmit given data on request – Secrets: details of transmitter hardware © Stuart Faulk Device Interface Windspeed Sensor Driver Transmitter Driver

FWS Modular Structure FWS Behavior Hiding Device Interface Software Decision Windspeed Sensor Driver Transmitter Driver Controller Message Generation Message Format Sensor Monitor Data Banker WindValue Generator Submodule-of Encapsulates all changes to the message format Module

Module Guide The module structure is documented in a module guide Contents describe: – The set of modules – The responsibility of each module in terms of the module’s secret – The “submodule-of relationship” – The rationale for design decisions Document purposes – Orientation for new team members – Guide for finding the module responsible for some aspect of the system behavior Where to find or put information Determine where changes must occur – Baseline design document – Provides a record of design decisions (rationale) © Stuart Faulk

Excerpts From The FWS Module Guide (1) 1.Behavior Hiding Modules The behavior hiding modules include programs that need to be changed if the required outputs from a FWS and the conditions under which they are produced are changed. Its secret is when (under what conditions) to produce which outputs. Programs in the behavior hiding module use programs in the Device Interface module to produce outputs and to read inputs. 1.1 Controller Service Provide the main program that initializes a FWS. Secret How to use services provided by other modules to start and maintain the proper operation of a FWS. © S. Faulk

Excerpts From The FWS Module Guide (2) 2.Device Interface Modules The device interface modules consist of those programs that need to be changed if the input from hardware devices to FWSs or the output to hardware devices from FWSs change. The secret of the device interface modules is the interfaces between FWSs and the devices that produce its inputs and that use its output Wind Sensor Device Driver Service Provide access to the wind speed sensors. There may be a submodule for each sensor type. Secret How to communicate with, e.g., read values from, the sensor hardware. Note This module hides the boundary between the FWS domain and the sensors domain. The boundary is formed by an abstract interface that is a standard for all wind speed sensors. Programs in this module use the abstract interface to read the values from the sensors. © S. Faulk

Module Structure Accomplishments What have we accomplished in creating the module structure? Divided the system into parts (modules) such that – Each module is a work assignment for a person or small team – Each part can be developed independently – Every system function is allocated to some module Informally described each module – Services: services that the module implements that other modules can use – Secrets: implementation decisions that other modules should not depend on © S. Faulk

Abstract Interface Specifications Defining the Contract Between Module Developers and Users © S. Faulk

Need for Precise Interface Specifications But, informal description is not enough to write the software To support independent, distributed development, need a precise interface specification – For the implementer: describes the requirements the module must satisfy – For other developers: defines everything you need to know to use the module’s services correctly – For tester: specifies the range of acceptable behaviors for unit test The interface specification defines a contract between the module’s developers and its users © S. Faulk

A Simple Stack Module A simple integer stack The interface specifies what a programmer needs to know to use the stack correctly, e.g. – push: push integer on stack top – pop: remove top element – peek: get value of top element The secrets (encapsulated) any details that might change from one implementation to another – Data structures, algorithms – Details of class/object structure Is this enough to define a contract? © S. Faulk stack peek(int) push(int) pop()

What is an abstract interface? An abstract interface defines the set of assumptions that one module can make about another By “abstract” we mean that there is a one-to-many relation While detailed, an abstract interface specification does not describe the implementation – Does not specify algorithms, private data, or data structures – Preserves the module’s secrets one-to-many: one abstract module specification allows many possible implementations – Developer is free to use any implementation that is consistent with the interface – Developer is free to change the implementation © S. Faulk

Abstraction and Interface Specs We strongly prefer an interface spec that is abstract in the sense that it hides implementation details – Allows the implementation to change without affecting other modules BUT … you can’t really design a good interface without thinking about possible implementation(s) © S. Faulk

A method for constructing abstract interfaces Define services provided and services needed (assumptions) Decide on syntax and semantics for accessing services In parallel Define access method effects Define terms and local data types Define states of the module Record design decisions Record implementation notes Define test cases and use them to verify access methods Cover testing effects, parameters, exceptions – Test both positive and error use cases Support automation Design test cases before implementing module Can use Javadoc or similar © S. Faulk

Data Banker Module 24 Data Banker Data Banker Write(s,r) Read(s,v) Sensor devices & input processing Actuator devices & output processing DB sits between input sensor side and output side. Stores sensor values for later use

An FWS Example: The Data Banker Interface Specification Define services provided © S. Faulk

An FWS Example: The Data Banker Interface Specification Decide on syntax and semantics for accessing services Access Methods © S. Faulk

An FWS Example: The Data Banker Interface Specification Decide on syntax and semantics for accessing services Access Method Semantics Values returned State changes Legal call sequences Synchronization and other call interactions © S. Faulk

An FWS Example: The Data Banker Interface Specification Decide on syntax and semantics for accessing services Local Data Types and Types Used © S. Faulk

An FWS Example: The Data Banker Interface Specification Define test cases and use them to verify access method Example © S. Faulk

An FWS Example: The Data Banker Interface Specification Record design decisions Interface Design Issues 1, Should we let the user read an empty vector of sensor readings after initialization, or just throw an exception? A1. Yes. An empty vector should be treated just as any other. A2. No. There are no valid values in an empty vector that can be averaged, so we should let he user know that the vector is empty by throwing the exception. Resolution: Yes. We will check values during testing during testing to save space and CPU cycles. © S. Faulk

Using Javadoc

© S. Faulk

Should you use UML? + UML is widely used and understood + UML can capture signatures and some relations reasonably well – UML doesn’t help much with semantics – UML doesn’t help much with judging completeness, consistency, abstractness, or almost anything else important So go ahead if you want, but don’t confuse “nice UML” with “well-designed interface spec”

Benefits Good Module Specs Enables development of complex projects: – Support partitioning system into separable modules – Complements incremental development approaches Improves quality of software deliverables: – Clearly defines what will be implemented – Errors are found earlier – Error Detection is easier – Improves testability Defines clear acceptance criteria Defines expected behavior of module Clarifies what will be easy to change, what will be hard to change Clearly identifies work assignments © S. Faulk

Summary Module Implementer The specification tells me exactly what capabilities my module must provide to users I am free to implement it any way I want to I am free to change the implementation if needed as long as I don’t change the interface Module User The specification tells me how to use the module’s services correctly I do not need to know anything about the implementation details to write my code If the implementation changes, my code stays the same © S. Faulk Key idea: the abstract interface specification defines a contract between a module’s developer and its users that allows each to proceed independently

Interface Design Considerations in Interface Design Design Principles Role of Information Hiding and Abstraction

Module Interface Design Goals General design goals addressed by module interface design – Carry forward architectural goals: Independent work assignments, maintainability, understandability, testability, etc. – Addressed by two module interface design goals 1.Control dependencies – Encapsulate anything other modules should not depend on – Hide design decisions and requirements that might change (data structures, algorithms, assumptions) 2.Provide services – Provide all the capabilities needed by the module’s users – Provide only what is needed (complexity) – Provide problem appropriate abstraction (useful services and states) – Provide reusable abstractions Specific goals need to be captured (e.g., in the module guide and interface design documents) © S. Faulk

1. Controlling Dependencies Addressed using the principle of information hiding IH: design principle of limiting dependencies between components by hiding information other components should not depend on When thinking about what to put on the interface – Design the module interface to reveal only those design decisions considered unlikely to change – Required functionality allocated to the module and considered likely to change must be encapsulated – Each data structure is used in only one module – Data structures may be accessed by programs within the module but not by those outside the module – Any other program must access internal data by calling access programs on the interface Consistent with good OOD principles © S. Faulk

2. Provide Services Interface provides the capabilities of the module to other modules in the system, addressed by: Abstraction: interface design principle of providing only essential information and suppressing unnecessary detail © S. Faulk

Abstraction Two primary uses Reduce Complexity – Goal: manage complexity by reducing the amount of information that must be considered at one time – Approach: Separate information important to the problem at hand from that which is not – Abstraction suppresses or hides “irrelevant detail” – Examples: stacks, queues, abstract device Model the problem domain – Goal: leverage domain knowledge to simplify understanding, creating, checking designs – Approach: Provide components that make it easier to model a class of problems May be quite general (e.g., type real, type float) May be very problem specific (e.g., class automobile, book object) © S. Faulk

Example: Car Object What are the abstractions? – Purpose of each? What information is hidden? © S. Faulk Throttle: double Mass: int Friction: int Speed: double Car GetCThrottle() Euler() EvaluateModel() GetSpeed()

Which Principle to Use Use abstraction when the issue is what should be on the interface (form and content) Use information hiding when the issue is what information should not be on the interface (visible or accessible) © S. Faulk

Summary Every module has an abstract interface that provides a way for other modules to use its secret without knowing how the secret is implemented An interface is the set of assumptions that the users of a module can make about the module The interface specification for a module is a contract between the users of the module and the implementers of a module An abstract interface specification specifies both syntax and semantics for the interface There is a systematic process for developing interface specifications © S. Faulk

End © S. Faulk