Software Engineering Prof. Dr. Bertrand Meyer March–June 2007 Chair of Software Engineering Lecture 7: From Requirements to Design (with material by Marco.

Slides:



Advertisements
Similar presentations
Building Bug-Free O-O Software: An Introduction to Design By Contract A presentation about Design By Contract and the Eiffel software development tool.
Advertisements

Chair of Software Engineering OOSC - Summer Semester Object-Oriented Software Construction Bertrand Meyer Lecture 3: Abstract Data Types.
IT Requirements Capture Process. Motivation for this seminar Discovering system requirements is hard. Formally testing use case conformance is hard. We.
Karolina Muszyńska Based on:
Analysis Modeling.
Introduction To System Analysis and Design
Use-case Modeling.
Slide 1 Chapter 7 Structural Modeling. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 4: The Interface of a Class.
Chapter 1 Software Development. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 1-2 Chapter Objectives Discuss the goals of software development.
Chair of Software Engineering OOSC - Lecture 4 1 Object-Oriented Software Construction Bertrand Meyer.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Lecture 4: The Interface of a Class.
Software Requirements
Fall 2007CS 2251 Software Engineering Intro. Fall 2007CS 2252 Topics Software challenge Life-cycle models Design Issues Documentation Abstraction.
Creating Architectural Descriptions. Outline Standardizing architectural descriptions: The IEEE has published, “Recommended Practice for Architectural.
1 Lecture 5 Introduction to Software Engineering Overview  What is Software Engineering  Software Engineering Issues  Waterfall Model  Waterfall Model.
© Copyright Eliyahu Brutman Programming Techniques Course.
7. 2Object-Oriented Analysis and Design with the Unified Process Objectives  Detailed Object-Oriented Requirements Definitions  System Processes—A Use.
Classes Chapter 4. Terms and Concepts A class is a description of a set of objects that share the same attributes, operations, relationships, and semantics.
The Software Product Life Cycle. Views of the Software Product Life Cycle  Management  Software engineering  Engineering design  Architectural design.
Introductory case study. 2 The problem The most difficult part of any design project is understanding the task you are attempting You have been contacted.
Course Instructor: Aisha Azeem
Architectural Design Establishing the overall structure of a software system Objectives To introduce architectural design and to discuss its importance.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Software Engineering Case Study Slide 1 Introductory case study.
The chapter will address the following questions:
USE Case Model.
Introduction To System Analysis and design
Object Oriented Analysis By: Don Villanueva CS 524 Software Engineering I Fall I 2007 – Sheldon X. Liang, Ph. D.
Chapter 2 The process Process, Methods, and Tools
MSF Requirements Envisioning Phase Planning Phase.
المحاضرة الثالثة. Software Requirements Topics covered Functional and non-functional requirements User requirements System requirements Interface specification.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Introduction To System Analysis and Design
Faculty of Computer & Information Software Engineering Third year
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 4, Requirements Elicitation.
CSC 395 – Software Engineering Lecture 13: Object-Oriented Analysis –or– Let the Pain Begin (At Least I’m Honest!)
Slide 1 Structural Modeling Chapter 7. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
Lecture 3 Uses Cases Topics UML Use Cases pop quiz Readings: Chapter 3 January 24, 2008 CSCE 492 Software Engineering.
1 Introduction to Software Engineering Lecture 1.
1 Software Development Software Engineering is the study of the techniques and theory that support the development of high-quality software The focus is.
UML Use Case Diagramming Guidelines. What is UML? The Unified Modeling Language (UML) is a standard language for specifying, visualizing, constructing,
Requirements Engineering Methods for Requirements Engineering Lecture-30.
1 What is OO Design? OO Design is a process of invention, where developers create the abstractions necessary to meet the system’s requirements OO Design.
1 Capturing Requirements As Use Cases To be discussed –Artifacts created in the requirements workflow –Workers participating in the requirements workflow.
DOMAIN MODEL: ADDING ATTRIBUTES Identify attributes in a domain model. Distinguish between correct and incorrect attributes.
1-1 Software Development Objectives: Discuss the goals of software development Identify various aspects of software quality Examine two development life.
Architecture View Models A model is a complete, simplified description of a system from a particular perspective or viewpoint. There is no single view.
Requirements Engineering Requirements Engineering in Agile Methods Lecture-28.
ANU COMP2110 Software Design in 2003 Lecture 10Slide 1 COMP2110 Software Design in 2004 Lecture 12 Documenting Detailed Design How to write down detailed.
Winter 2011SEG Chapter 11 Chapter 1 (Part 1) Review from previous courses Subject 1: The Software Development Process.
22 August, 2007Information System Design IT60105, Autumn 2007 Information System Design IT60105 Lecture 8 Use Case Diagrams.
Lecture 14 22/10/15. The Object-Oriented Analysis and Design  Process of progressively developing representation of a system component (or object) through.
ITEC0724 Modern Related Technology on Mobile Devices Lecture Notes #2 1.
From Use Cases to Implementation 1. Structural and Behavioral Aspects of Collaborations  Two aspects of Collaborations Structural – specifies the static.
CSCI 383 Object-Oriented Programming & Design Lecture 7 Martin van Bommel.
Requirements capture: Using UML Use Cases David Millard and Yvonne Howard {dem,
From Use Cases to Implementation 1. Mapping Requirements Directly to Design and Code  For many, if not most, of our requirements it is relatively easy.
Welcome to M301 P2 Software Systems & their Development
Classifications of Software Requirements
Unified Modeling Language
Object oriented system development life cycle
Object-Oriented Analysis
Service-centric Software Engineering
Chapter 5 Architectural Design.
Software Architecture Prof. Dr. Bertrand Meyer
Software Development Process Using UML Recap
CS 501: Software Engineering
From Use Cases to Implementation
Presentation transcript:

Software Engineering Prof. Dr. Bertrand Meyer March–June 2007 Chair of Software Engineering Lecture 7: From Requirements to Design (with material by Marco Piccioni)

Software Engineering, lecture 7: From Requirements to Design 2 Lecture objectives  Understand which problems may arise when trying to bridge the semantic gap between requirements and the concrete design of the software system in object oriented terms  Provide some caveats…  …and some suggestions  Show an example

Software Engineering, lecture 7: From Requirements to Design 3 Why O-O analysis? Same benefits as O-O programming, in particular reliability, extendibility, reusability Direct modeling of the problem domain Seamlessness and reversibility with the continuation of the project (design, implementation, maintenance)

Software Engineering, lecture 7: From Requirements to Design 4 What is object-oriented analysis?  Classes around object types (not just physical objects but also important concepts of the application domain)  Abstract Data Types approach  Deferred classes and features  Inter-component relations: “client” and inheritance  Distinction between reference and expanded clients  Inheritance — single, multiple and repeated for classification.  Contracts to capture the semantics of systems: properties other than structural  Libraries of reusable classes: reuse is for analysis too!

Software Engineering, lecture 7: From Requirements to Design 5 Expanded classes You may declare a class as expanded class C... The rest as usual...

Software Engineering, lecture 7: From Requirements to Design 6 Reminder: expanded & reference types Reference types; value of an entity is a reference If COMPANY is a reference type: b : COMPANY Expanded types; value of an entity is an object. If COMPANY is an expanded class: d : COMPANY b (COMPANY) d

Software Engineering, lecture 7: From Requirements to Design 7 Subobjects Expanded classes and entities support the notion of subobject class RECTANGLE_R feature corner1, corner2, corner3, corner4: POINT... end class RECTANGLE_E feature corner1, corner2, corner3, corner4: POINT_E … end expanded class POINT_E inherit POINT end

Software Engineering, lecture 7: From Requirements to Design 8 The meaning of expanded classes More than implementation notion: a system modeling tool. Two forms of client relation:  Simple client  Expanded client What is the difference between these two statements?  A car has an engine  A car has an originating factory

Software Engineering, lecture 7: From Requirements to Design 9 The main problem  A requirements specification  IEEE Std , UML use cases,… Semantic gap!  A description that possibly encompasses all the relevant abstractions and the related semantic properties (i.e. constraints)

Software Engineering, lecture 7: From Requirements to Design 10 Two common questions  How much should we trust a requirements specification?  How can we deal with important, semantic properties of the system right from the start?

Software Engineering, lecture 7: From Requirements to Design 11 Suggested answers How much should we trust a requirements specification?  Not too much:  Natural language is imprecise  Crucial abstractions may not be directly deducible from the requirements  Tends to suggest a specific, non-reusable solution  How can we deal with important, semantic properties of the system right from the start?  Using a method that enforces seamless development, e.g. enabling the insertion of class invariants when sketching the first design of the system

Software Engineering, lecture 7: From Requirements to Design 12 A well known grammatical game  How can we assess the famous “Underline the nouns” grammatical criterion?  Use this with caution! Nouns can  Suggest notions that do not yield classes  Fail to suggest notions that should yield classes

Software Engineering, lecture 7: From Requirements to Design 13 Trying to bridge the gap  How to find the classes then?  What to consider?  What to reject?

Software Engineering, lecture 7: From Requirements to Design 14 What to reject (advisory negatives)  The grand mistake: not semantically rich enough ADTs  Know the business domain and what is relevant to it  Mixed abstractions  Should be split into several classes, one per abstraction  Premature classification  Beware of the PH factor (Polymorphistic Hysteria)  May be a case of “taxomania”  Known examples of bad/poor class choices for the specific domain

Software Engineering, lecture 7: From Requirements to Design 15 Other danger signals  Class with verbal name (infinitive or imperative)  May be a routine  Class described as “performing something”  May not be a proper data abstraction  Fully effective, single-exported-routine class  May be a routine  Class with no routines  May be some routines are missing, or may be it is not an ADT

Software Engineering, lecture 7: From Requirements to Design 16 What to consider: practical heuristics  Analysis classes  Belong to the problem space  Describe a data abstraction directly drawn from the domain model  Design classes  Belong to the solution space  Describe an architectural choice  Implementation classes  Belong to the solution space  Describe data abstractions introduced for the internal needs of the software algorithms

Software Engineering, lecture 7: From Requirements to Design 17 Finding the analysis classes Any software system is based on an operational model of some aspect of the external world

Software Engineering, lecture 7: From Requirements to Design 18 Finding the design classes  Understand the importance of reuse: beware of the NIH (Not Invented Here) syndrome  Reuse previous known designs in the same domain  Know standard design patterns (e.g. GoF book)  Consider describing abstractions as “machines” rather than “objects”

Software Engineering, lecture 7: From Requirements to Design 19 Finding the implementation classes  Reuse  Know and use the classical data structures & algorithms  Know and use existing libraries of your language  Consider the use of deferred classes

Software Engineering, lecture 7: From Requirements to Design 20 Other sources of classes  Previous developments  Evaluating candidate decompositions  Adaptation through inheritance relationship  Adaptation through client relationship

Software Engineering, lecture 7: From Requirements to Design 21 Additional ways of discovering classes  Discussions with customers and future users  Terms that are taken for granted in a certain domain  Discussions with experienced designers  CRC (Class Responsibility Collaboration) cards  Use cases (see next)

Software Engineering, lecture 7: From Requirements to Design 22 Use Cases (scenarios) One of the UML diagram types A use case describes how to achieve a single business goal or task through the interactions between external actors and the system A good use case must:  Describe a business task  Not be implementation-specific  Provide appropriate level of detail  Be short enough to implement by one developer in one release

Software Engineering, lecture 7: From Requirements to Design 23 Use case example Place an order:  Browse catalog & select items  Call sales representative  Supply shipping information  Supply payment information  Receive conformation number from salesperson May have precondition, postcondition, invariant

Software Engineering, lecture 7: From Requirements to Design 24 Use cases for requirements?  Use cases are not a good tool for finding classes, because they:  Emphasize ordering  Focus on how users see the (non-existing) system’s operation  Favor a functional, top-down approach They are, however, good for validation (e.g. for QA team)

Software Engineering, lecture 7: From Requirements to Design 25 Hints from non–O-O approaches  Analyze data structures  Data elements passed as arguments, especially if they travel far  Shared memory areas like Fortran COMMON blocks and Cobol LINKAGE SECTION  Pascal record types  C and C++ structures  Cobol DATA DIVISION  Files  Entities in ER modeling

26 Television station example class SCHEDULE feature segments : LIST [SEGMENT] end Source: OOSC

27 Schedules note description : “ 24-hour TV schedules” deferred class SCHEDULE feature segments : LIST [SEGMENT ] -- Successive segments deferred end air_time : DATE hour period -- for this schedule deferred end set_air_time (t : DATE) -- Assign schedule to -- be broadcast at time t. require t.in_future deferred ensure air_time = t end print -- Produce paper version. deferred end

28 Contracts Feature precondition: condition imposed on the rest of the world Feature postcondition: condition guaranteed to the rest of the world Class invariant: Consistency constraint maintained throughout on all instances of the class

29 Why contracts Specify semantics, but abstractly! (Remember basic dilemma of requirements:  Committing too early to an implementation Overspecification!  Missing parts of the problem Underspecification! )

30 Segment note description : "Individual parts of a schedule " deferred class SEGMENT feature schedule : SCHEDULE deferred end -- Schedule to which -- segment belongs index: INTEGER deferred end -- Position of segment in -- its schedule starting_time, ending_time : INTEGER deferred end -- Beginning and end of -- scheduled air time next: SEGMENT deferred end -- Segment to be played -- next, if any sponsor : COMPANY deferred end -- Segment’s principal sponsor rating : INTEGER deferred end -- Segment’s rating (for -- children’s viewing etc.)  Commands such as change_next, set_sponsor, set_rating omitted  Minimum_duration : INTEGER = Minimum length of segments, -- in seconds Maximum_interval : INTEGER = 2 -- Maximum time between two -- successive segments, in seconds

31 Segment (continued) invariant in_list: (1 <= index) and (index <= schedule. segments. count) in_schedule: schedule. segments. item (index) = Current next_in_list: (next /= Void ) implies (schedule. segments. item (index + 1) = next) no_next_iff_last: (next = Void) = (index = schedule. segments. count) non_negative_rating: rating >= 0 positive_times: (starting_time > 0 ) and (ending_time > 0) sufficient_duration: ending_time – starting_time >= Minimum_duration decent_interval : (next. starting_time) - ending_time <= Maximum_interval end

32 Commercial note description: "Advertizing segment " deferred class COMMERCIAL inherit SEGMENT rename sponsor as advertizer end feature primary: PROGRAM deferred -- Program to which this -- commercial is attached primary_index: INTEGER deferred -- Index of primary set_primary (p: PROGRAM) -- Attach commercial to p. require program_exists: p /= Void same_schedule: p,schedule = schedule before: p.starting_time <= starting_time deferred ensure index_updated: primary_index = p.index primary_updated: primary = p end i nvariant meaningful_primary_index: primary_index = primary. index primary_before: primary. starting_time <= starting_time acceptable_sponsor: advertizer. compatible (primary. sponsor) acceptable_rating: rating <= primary. rating end

Software Engineering, lecture 7: From Requirements to Design 33 Obligations & benefits in a contract Client Supplier (Satisfy precondition:) Bring package before 4 p.m.; pay fee. (Satisfy postcondition:) Deliver package by 10 a.m. next day. OBLIGATIONS (From postcondition:) Get package delivered by 10 a.m. next day. (From precondition:) Not required to do anything if package delivered after 4 p.m., or fee not paid. BENEFITS deliver

Software Engineering, lecture 7: From Requirements to Design 34 Diagrams: UML, BON Text-Graphics Equivalence

Software Engineering, lecture 7: From Requirements to Design 35 O-O analysis process Identify abstractions  New  Reused Describe abstractions through interfaces, with contracts Look for more specific cases: use inheritance Look for more general cases: use inheritance, simplify Iterate on suppliers At all stages keep structure simple and look for applicable contracts

Software Engineering, lecture 7: From Requirements to Design 36 Practical advice Take advantage of O-O techniques from the requirements stage on Use contracts to express semantic properties

Software Engineering, lecture 7: From Requirements to Design 37 Practical advice Write ADT specifications for delicate parts of the system requirements

Software Engineering, lecture 7: From Requirements to Design 38 An example specification Identified Stakeholders  Company Management  System Administrator  Project Team Leader  Project Team Member

Software Engineering, lecture 7: From Requirements to Design 39 Statements: management (1) We develop custom software solutions for different customers. Having a project-driven management model, we have organized our developers into project teams. Each team is led by a team leader and typically includes 2 to 20 developers. Increasingly, our development is distributed: team members may be in different locations, often several time zones apart. Currently every team manager is using a specific software product, or no software at all, for maintaining the project schedule and to organize the tasks of the project. This situation causes numerous problems:

Software Engineering, lecture 7: From Requirements to Design 40 Statements: management (2)  It is difficult for the company management to get an overview of the project status.  It is difficult to move project leaders from one project to another, as there is no common standard for the important project information  Data is stored on the individual laptops of project leaders, with all the well-known implications on safety and security  Management has trouble understanding the effect of changed circumstances such as a delay in one part of the project (what is the effect on the rest of the project and the final delivery date?), the temporary unavailability of a team member  Marketing has trouble obtaining realistic costs for change requests by customers or initial offers to new customers, as comparable tasks are not available The goal of the project is to develop a global solution that will remedy these problems. MM

Software Engineering, lecture 7: From Requirements to Design 41 Statements: team leader A (1) The system must support the specific needs of the management of software projects. Applicability to other kinds of projects is not required. The functionalities must include:  Defining tasks and subtasks  Defining dependencies between tasks  Assigning time estimates to tasks  Assigning people to tasks (one person may be assigned to multiple tasks, and one task may be assigned to multiple people)  Assigning availability levels to people (e.g. number of hours per week)

Software Engineering, lecture 7: From Requirements to Design 42 Statements: team leader A (2)  Changing any previous assignment  Reporting completion of task  Estimating the completion time of a task, on the basis of timing estimates for subtasks, dependencies between tasks, project members’ assignments and availability, completion data.  Providing output in various forms including individual project member schedules, overall project schedules, PERT, Gantt  “What-if?” scenarios: assessing the results of various hypothetical changes.  User login with various privileges, including at least “manager” and “project member”

Software Engineering, lecture 7: From Requirements to Design 43 Statements: team leader B As I am traveling a lot and do many of the project management tasks during these travels. I am currently using a spreadsheet to manage projects. The most important ability of a software project management system for me is the ability to experiment with the scheduling of tasks. That way, I can interactively develop the project schedule together with the other developers and the customer. Report generation should offer many different views. Specifically, the possibility to plot GANTT diagrams is important to me. Other functionality should include the definition of tasks, the assignments of developers to tasks, describing the dependency of tasks, and to connect risks with tasks. It would be great if the project management tool could also interface with a bug tracking tool. Currently we seem to converge on Mozilla but it doesn’t really matter what the tool is as long as we can interface with it. The tool should also interface with a configuration management systems such as CVS or SourceSafe. Team Members A questionnaire with six questions was issued among all team developers. A number of statements were rated. The scale is between 1 (strong disagree) to 5 (strong agree). Results:  “I always want to know the exact time frame of the project.” 2.8  “My vacations are important to me and I need to book them half a year in advance.” 4.2  “Rescheduling of tasks must be avoided.” 1.7  “I am not interested in the exact schedule of the project. That is the job of the team leader.” 4.1  “It would be great if I could easily switch tasks within a project.” 3.5  “I do not want to be moved away from a project until it is finished.” 2.2  “There needs to be better ways to collaborate with other developers.” 3.2.

Software Engineering, lecture 7: From Requirements to Design 44 Statements: team leader B As I am traveling a lot and do many of the project management tasks during these travels. I am currently using a spreadsheet to manage projects. The most important ability of a software project management system for me is the ability to experiment with the scheduling of tasks. That way, I can interactively develop the project schedule together with the other developers and the customer. Report generation should offer many different views. Specifically, the possibility to plot GANTT diagrams is important to me. Other functionality should include the definition of tasks, the assignments of developers to tasks, describing the dependency of tasks, and to connect risks with tasks. It would be great if the project management tool could also interface with a bug tracking tool. Currently we seem to converge on Mozilla but it doesn’t really matter what the tool is as long as we can interface with it. The tool should also interface with a configuration management systems such as CVS or SourceSafe.

Software Engineering, lecture 7: From Requirements to Design 45 Statements: system administrator We are supporting a very heterogeneous landscape of operating systems. The application should run on several operating systems, including at least Windows (XP and perhaps Vista), Linux and MacOS X. It is very important that there is clean procedure on how to do updates and fix security bugs. I believe that the application should be implemented as a web-based application that runs on our web server. That way, it is located within our DMZ, accessible from the outside as well as from within the company. This is important, as the project teams often work at customers and not within the company building. The web server is running a standard LAMP (Linux, Apache, MySQL, Perl) environment.