This material is approved for public release. Distribution is limited by the Software Engineering Institute to attendees. Sponsored by the U.S. Department.

Slides:



Advertisements
Similar presentations
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
Advertisements

This material is approved for public release. Distribution is limited by the Software Engineering Institute to attendees. Sponsored by the U.S. Department.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
The System and Software Development Process Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
The software process A software process is a set of activities and associated results which lead to the production of a software product. This may involve.
SEP1 - 1 Introduction to Software Engineering Processes SWENET SEP1 Module Developed with support from the National Science Foundation.
Describing Process Specifications and Structured Decisions Systems Analysis and Design, 7e Kendall & Kendall 9 © 2008 Pearson Prentice Hall.
Copyright © 1994 Carnegie Mellon University Disciplined Software Engineering - Lecture 1 1 Disciplined Software Engineering Lecture #7 Software Engineering.
Personal Software ProcessSM
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Process Specifications and Structured Decisions Systems Analysis and Design, 8e Kendall.
Chapter 9 Describing Process Specifications and Structured Decisions
Chapter 1 Software Development. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 1-2 Chapter Objectives Discuss the goals of software development.
Chapter 1 Principles of Programming and Software Engineering.
9 1 Chapter 9 Database Design Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
This material is approved for public release. Distribution is limited by the Software Engineering Institute to attendees. Sponsored by the U.S. Department.
Copyright © 1994 Carnegie Mellon University Disciplined Software Engineering - Lecture 1 1 Disciplined Software Engineering Lecture #14 Software Engineering.
This material is approved for public release. Distribution is limited by the Software Engineering Institute to attendees. Sponsored by the U.S. Department.
Software Quality Chapter Software Quality  How can you tell if software has high quality?  How can we measure the quality of software?  How.
This material is approved for public release. Distribution is limited by the Software Engineering Institute to attendees. Sponsored by the U.S. Department.
This material is approved for public release. Distribution is limited by the Software Engineering Institute to attendees. Sponsored by the U.S. Department.
1 Shawlands Academy Higher Computing Software Development Unit.
ITEC224 Database Programming
Disciplined Software Engineering Lecture #8 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Sponsored by the U.S. Department.
1 The Software Development Process  Systems analysis  Systems design  Implementation  Testing  Documentation  Evaluation  Maintenance.
Describing Process Specifications and Structured Decisions Systems Analysis and Design, 7e Kendall & Kendall 9 © 2008 Pearson Prentice Hall.
This material is approved for public release. Distribution is limited by the Software Engineering Institute to attendees. Sponsored by the U.S. Department.
This chapter is extracted from Sommerville’s slides. Text book chapter
Disciplined Software Engineering Lecture #7 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Sponsored by the U.S. Department.
This material is approved for public release. Distribution is limited by the Software Engineering Institute to attendees. Sponsored by the U.S. Department.
SE: CHAPTER 7 Writing The Program
This material is approved for public release. Distribution is limited by the Software Engineering Institute to attendees. Sponsored by the U.S. Department.
Copyright © 1994 Carnegie Mellon University Disciplined Software Engineering - Lecture 1 1 Disciplined Software Engineering Lecture #8 Software Engineering.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
This material is approved for public release. Distribution is limited by the Software Engineering Institute to attendees. Sponsored by the U.S. Department.
1 Introduction to Software Engineering Lecture 1.
This material is approved for public release. Distribution is limited by the Software Engineering Institute to attendees. Sponsored by the U.S. Department.
1 Software Development Software Engineering is the study of the techniques and theory that support the development of high-quality software The focus is.
Copyright © 1994 Carnegie Mellon University Disciplined Software Engineering - Lecture 7 1 Design and Code Reviews - Overview What are design and code.
Introduction to Problem Solving. Steps in Programming A Very Simplified Picture –Problem Definition & Analysis – High Level Strategy for a solution –Arriving.
The System and Software Development Process Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
This material is approved for public release. Distribution is limited by the Software Engineering Institute to attendees. Sponsored by the U.S. Department.
Disciplined Software Engineering Lecture #2 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Sponsored by the U.S. Department.
Copyright © 1994 Carnegie Mellon University Disciplined Software Engineering - Lecture 1 1 Disciplined Software Engineering Lecture #2 Software Engineering.
This material is approved for public release. Distribution is limited by the Software Engineering Institute to attendees. Sponsored by the U.S. Department.
The Software Development Process
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.
This material is approved for public release. Distribution is limited by the Software Engineering Institute to attendees. Sponsored by the U.S. Department.
1-1 Software Development Objectives: Discuss the goals of software development Identify various aspects of software quality Examine two development life.
Disciplined Software Engineering Lecture #12 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Sponsored by the U.S. Department.
Copyright © 1994 Carnegie Mellon University Disciplined Software Engineering - Lecture 1 1 Disciplined Software Engineering Lecture #12 Software Engineering.
Disciplined Software Engineering Lecture #10 Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Sponsored by the U.S. Department.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Topic 4 - Database Design Unit 1 – Database Analysis and Design Advanced Higher Information Systems St Kentigern’s Academy.
Winter 2011SEG Chapter 11 Chapter 1 (Part 1) Review from previous courses Subject 1: The Software Development Process.
Focus on design principles and on a process for doing design = To produce a precise, complete, high- quality foundation for product implementation.
Software Requirements Specification (SRS)
Prof. Hany H. Ammar, CSEE, WVU, and
The Hashemite University Computer Engineering Department
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Copyright © 2011 Pearson Education Process Specifications and Structured Decisions Systems Analysis and Design, 8e Kendall & Kendall Global Edition 9.
Requirement Specification SRS document is a contract between the development team and the customer How do we communicate the Requirements to others? Firm.
Lecture 3 Prescriptive Process Models
Definition CASE tools are software systems that are intended to provide automated support for routine activities in the software process such as editing.
Writing Requirements Lecture # 23.
Disciplined Software Engineering Lecture #10
About the Presentations
Chapter 11 Describing Process Specifications and Structured Decisions
Presentation transcript:

This material is approved for public release. Distribution is limited by the Software Engineering Institute to attendees. Sponsored by the U.S. Department of Defense © 2006 by Carnegie Mellon University January 2006 Pittsburgh, PA PSP II - Software Design I - 1 Personal Software Process SM for Engineers: Part II Software Design I

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 2 Lecture Topics The design framework Design completeness Design representation The PSP design templates operational specification functional specification state specification logic specification The design hierarchy

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 3 Design is a Learning Process Design involves discovery, invention, and intuitive leaps from one abstraction level to another. While the design must reflect the requirements, requirements usually are not stable until the product has been used, if then. Design work is iterative, and it must be driven by feedback from all involved parties. The critical problem is knowing when to freeze the design to produce the next iteration.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 4 The Design Framework

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 5 Development Framework

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 6 Design Quality Design is a defect prevention activity. Poor quality designs are a major source of rework, maintenance, and user dissatisfaction. A quality design is complete and precise meets the user’s needs precisely guides implementation

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 7 Design Levels Design work is an inverted pyramid in which each level provides a foundation for the following levels debugs the preceding levels To save time and prevent defects, document all design decisions at all levels when they are made.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 8 Structuring the Design Process Good software designers follow a dynamic process. They jump from concept to detail simultaneously consider issues at several design levels explore multiple alternatives A structured design process can help you to manage the dynamics of design. capture what has been learned record and manage issues track design status A properly-implemented design process will reduce rework, manage routine tasks, and give the designer the freedom to be creative.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 9 The Design Hierarchy

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 10 The PSP Design Process Since there is no single best design method, the PSP supports multiple methods. The PSP focuses on what a complete design should contain. The goal is to eliminate requirements and design defects. The PSP uses design templates to provide criteria for design completeness reviewable designs

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 11 Design Completeness Under-specified and incomplete designs are expensive and error-prone. Designs can be over-specified, especially when they are produced without completeness criteria. In the PSP course, most students find that their designs are incomplete and do not adequately guide implementation. To avoid over- or under-specification examine your defect data establish design completeness criteria focus on design quality

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 12 Design Representation It is important to separate two issues. how to do the design how to represent the design when it is completed Since the PSP can be used with any design method, it does not specify a specific design approach. However, the PSP does address design representation.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 13 Design Methods and Notations There are many design methods. None have been proven best for every domain. The best method often depends on individual skills and preferences. A widely-usable process must work with many different design methods. There are also many types of design notations. Graphics assist in visualizing structure. Formality provides precision. Text provides intuitive understanding. Often all three types of design notations are needed.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 14 Poor Design Notations Cause Defects Design visibility Complex designs are difficult to visualize. A poor representation compounds visualization problems. A well-represented design captures all design decisions unambiguously. Design redundancy A redundant design is often inconsistent. Inconsistency breeds errors and causes defects. A quality design has minimum duplication. Where possible, use design tools that ensure consistency.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 15 Design Notation Requirements The design notation must precisely define all significant design aspects be commonly understood communicate the designers’ intent help to identify design problems and omissions be suitable for representing a broad range of designs The design should also be concise and easy to use provide a complete and accessible reference have minimum redundancy Formal notations meet these criteria.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 16 Using Formal Notation Advantages: using a formal notation produces precise and compact designs builds familiarity with an important notation is consistent with the notation used in formal methods for proving program correctness distinguishes logic from other expressions Disadvantages: formal designs generally take more time to create take practice to build familiarity may not be understood by users and co-workers

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 17 Mathematical Notation

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 18 Program Functional Statements When describing program functions, actions and conditions are separated. Condition → Action Read, “When Condition is true, do Action.” Several condition/action pairs are written as Condition A → Action A when Condition A, do Action A  or Condition B → Action B when Condition B, do Action B  or Condition C → Action C when Condition C, do Action C

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 19 If x is positive, set y to zero. x > 0 → y := 0 If x is even, return the sum of x and y, otherwise return the difference between x and y. even(x) → return( x + y )  odd(x) → return( x – y ) Notation Examples -1

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 20 State that an array a[0..N-1] has no duplicate elements. Notation Examples -2 This expression reads as follows. For all indexes i and j with values in the range 0 to N-1, where i and j are not equal, the corresponding elements of the array a are not equal.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 21 Users of Design Information The principal users of the design are implementers design reviewers and verifiers testers and test developers documenters, maintainers, and enhancers These users potentially need a large amount of material. Not all information is needed immediately. Some information can be obtained from other sources. It is wise to limit the design workload as much as possible.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 22 Essential Design Information The information that designers should provide includes a picture of where the program fits into the system a description of how the program will be used a specification for all related classes and parts a structural view of the product a specification of all external calls and references a list of all external variables, parameters, and constants a clear statement of the program’s logic The essential design information can be categorized into static or dynamic views, and internal or external views.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 23 Design Views

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 24 Design Templates Four design templates are used in the PSP to cover the four design views. operational specification template functional specification template state specification template logic specification template These four templates provide the framework for completely and precisely recording a software design.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 25 Mapping Templates to Views

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 26 Operational Template The operational specification template describes the users’ normal and abnormal interactions with the system. It contains the principal user actions and system responses anticipated error and recovery conditions The operational specification template can be used to define test scenarios and test cases resolve development questions about operational issues resolve requirements discussions with users

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 27 Example Operational Template

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 28 Operational Template Exercise -1 A simple stopwatch has three buttons (start/stop, reset and hold) and a single display. Initially, the stopwatch shows zero. Pressing the start/stop button starts the timer. The display shows the times. Pressing the reset button at any time causes the stopwatch to return to its initial state.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 29 Operational Template Exercise -2 Pressing the hold button while the stopwatch is running causes the display to hold its current value while the timer continues. Pressing the hold button again displays the timer value. Pressing the start/stop button when the stopwatch is running or on hold causes the timer to stop.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 30 Operational Template Exercise -3 For this exercise, produce an operational specification template for the stopwatch.exercise The scenario objective is to test the stopwatch. Pair up and take 20 minutes to produce an operational specification template for the stopwatch. 20 minutes

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 31 Exercise Discussion Producing the operational template exposes some requirements questions. When the stopwatch is running, what happens if the hold button is pushed twice? The requirements statement could be read several ways. With the subsequent holds, the display could show either the timer value or more lap times. Precise designs often expose questions that must be resolved by talking to the user.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 32 Exercise Operational Template

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 33 Functional Template The functional specification template allows you to unambiguously define the external functions provided by the product. classes and inheritance externally visible attributes external functions provided relationships with other classes or parts Where possible, specify the behavior of each function or method with a formal notation.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 34 Example Functional Template

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 35 Producing the Functional Template To produce a functional template, you must decide how to build the product define the product’s functions define the key product attributes The functional specification is usually developed in steps. Produce an initial design. Refine the elements of that design. Revise the functional specification template as you better understand how to build the product.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 36 Functional Template Exercise For this exercise, produce a functional specification template for the stopwatch.exercise The objective is to specify the principal stopwatch elements and define their functions. Pair up and take 20 minutes to produce a functional specification template for the stopwatch. 20 minutes

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 37 Exercise Functional Template

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 38 State Specification Template -1 The state specification template (SST) precisely defines the program states required transitions among the states actions taken with each transition With the SST, you can define state machine structure analyze the state machine design recognize mistakes and omissions

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 39 State Specification Template -2 The SST specifies the name of every state a brief description of each state the name and description of any functions or parameters used in the SST the conditions that cause transitions from the state to itself or to any other state the conditions that cause transitions from any other state to this state the actions taken during each transition

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 40 Example State Template

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 41 State Machine Exercise For this exercise, produce a state specification template for the stopwatch.exercise Pair up and take 20 minutes to produce the state template and a state diagram for the stopwatch state machine. 20 minutes

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 42 Exercise Discussion A state machine is needed because two buttons cause different actions depending on the watch’s state. Start/stop - the watch may stop or run. Hold – the watch may run or hold. To properly cause these actions, the watch must know if it is running, on hold, or stopped. It must also know if it has been reset. This means that we need four states.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 43 Exercise: State Diagram

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 44 Exercise: State Template Note: this solution will be reviewed in the following lecture.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 45 Logic Specification Template -1 The logic specification template precisely defines the program’s internal logic. Its objective is to describe the logic in a concise and convenient notation. A pseudocode compatible with the implementation language is often appropriate. Formal notation is also appropriate. Both the designers and the implementers must be familiar with the notation used.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 46 Logic Specification Template -2 The logic specification template should specify the logic for each item or method, each part and class, and the overall program the precise call to each program, part, or method any external references special data types and data definitions

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 47 Example Logic Template

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 48 Using Pseudocode In producing pseudocode designs use spoken language where possible, avoid programming constructs where unavoidable, use constructs from the implementation language where the program’s action is clear, make a brief note be more specific about complex constructs, loops, and state-machine structures Consider writing the pseudocode in your development environment. Later, when implementing the program, include the pseudocode in the comments.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 49 Logic Template Exercise For this exercise, produce a logic specification template for the stopwatch.exercise The objective is to define the logic of the stopwatch program. Pair up and take 20 minutes to produce a logic specification template for the stopwatch. 20 minutes

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 50 Logic Template Discussion Although the stopwatch logic template is relatively simple, it involves more functions than you might expect. With such simple programs, it is important to be completely clear and consistent. Check the operational, functional, state, and logic templates to ensure that they are completely consistent.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 51 Exercise Logic Template

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 52 Using Design Templates The PSP design templates provide one way to represent a design. They are precise, unambiguous, non-redundant, and complete. Use the PSP design templates in conjunction with your other design methods. Other representations may be substituted if they are equally precise, unambiguous, non-redundant, and complete.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 53 Design Guidelines When designing large programs, use a dynamic design strategy that allows for uncertainty. Some design problems cannot be resolved without first building and testing a potential solution. For these cases, use prototyping. When modifying or enhancing an existing system without a documented design, use the design templates to record the design as you decipher it.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 54 The Design Hierarchy You can use the design templates to refine the specification and design of large or small software products. system program component module Starting with requirements, produce a set of design templates to describe the highest-level product. Use these design templates as the requirements for producing the design templates for the next product level.

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 55 Program Design

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 56 Module Design

© 2006 by Carnegie Mellon UniversityJanuary 2006PSP II - Software Design I - 57 Messages to Remember While design is a creative process, its routine aspects can be defined. A good design notation will reduce design defects. Using precise design specifications and formats will improve design quality. Use the PSP design templates in the course exercises, and whenever you can do so in your work.