schach5-chap05-14[1]

download schach5-chap05-14[1]

of 42

Transcript of schach5-chap05-14[1]

  • 8/14/2019 schach5-chap05-14[1]

    1/42

    Slide 5.1

    The McGraw-Hill Companies, 2002

    Object-Oriented and Classical Software

    Engineering

    Fifth Edition, WCB/McGraw-Hill, 2002

    Stephen R. [email protected]

  • 8/14/2019 schach5-chap05-14[1]

    2/42

    Slide 5.2

    The McGraw-Hill Companies, 2002

    CHAPTER 5

    THE TOOLSOF THE TRADE

  • 8/14/2019 schach5-chap05-14[1]

    3/42

    Slide 5.3

    The McGraw-Hill Companies, 2002

    Overview

    q Stepwise refinementq Costbenefit analysisq Software metricsq CASEq Taxonomy of CASEq Scope of CASEq Software versionsq Configuration controlq Build tools

  • 8/14/2019 schach5-chap05-14[1]

    4/42

    Slide 5.4

    The McGraw-Hill Companies, 2002

    Stepwise Refinement

    q A basic principle underlying many softwareengineering techniques Postpone decisions as to details as late as possible

    to be able to concentrate on the important issuesq Millers law (1956)

    A human being can concentrate on 72 items at atime

  • 8/14/2019 schach5-chap05-14[1]

    5/42

    Slide 5.5

    The McGraw-Hill Companies, 2002

    Stepwise Refinement Case Study

    q Design a product to update a sequential master file containing name and address data for monthly magazine True Life Software Disasters

    q Three types of transactions Type 1: INSERT (new subscriber into master file) Type 2: MODIFY (existing subscriber record) Type 3: DELETE (existing subscriber record)

    q Transactions are sorted into alphabetical order,and by transaction code within alphabeticalorder

  • 8/14/2019 schach5-chap05-14[1]

    6/42

    Slide 5.6

    The McGraw-Hill Companies, 2002

    Typical file of input transactions

  • 8/14/2019 schach5-chap05-14[1]

    7/42

    Slide 5.7

    The McGraw-Hill Companies, 2002

    Decompose Process

    q No further refinement is possible

  • 8/14/2019 schach5-chap05-14[1]

    8/42

    Slide 5.8

    The McGraw-Hill Companies, 2002

    First Refinement

  • 8/14/2019 schach5-chap05-14[1]

    9/42

    Slide 5.9

    The McGraw-Hill Companies, 2002

    Stepwise Refinement Case Study (contd)

    q Assumption We can produce a record when PROCESS requires it

    q Separate INPUT and OUTPUT, concentrate onPROCESS

    q What is this PROCESS?

  • 8/14/2019 schach5-chap05-14[1]

    10/42

    Slide 5.10

    The McGraw-Hill Companies, 2002

    Second Refinement

  • 8/14/2019 schach5-chap05-14[1]

    11/42

    Slide 5.11

    The McGraw-Hill Companies, 2002

    Third Refinement

    q This designhas a major fault

  • 8/14/2019 schach5-chap05-14[1]

    12/42

    Slide 5.12

    The McGraw-Hill Companies, 2002

    Stepwise Refinement Case Study (contd)

    q The third refinement is WRONG Modify JONES followed by Delete JONES

    q After the third refinement has been corrected Details like opening and closing files have been ignored

    up to now Fix after the logic of the design is complete The stage at which an item is handled is vital

    q Opening and closing files is Ignored in early steps, but Essential later

  • 8/14/2019 schach5-chap05-14[1]

    13/42

    Slide 5.13

    The McGraw-Hill Companies, 2002

    Appraisal of Stepwise Refinement

    q A basic principle used in Every phase Every representation

    q The power of stepwise refinement

    The software engineer can concentrateon the relevant aspects

    q Warning Millers Law is a fundamental restriction

    on the mental powers of human beings

  • 8/14/2019 schach5-chap05-14[1]

    14/42

    Slide 5.14

    The McGraw-Hill Companies, 2002

    CostBenefit Analysis

    q Compare estimated future benefits, costs Estimate costs Estimate benefits State all assumptions explicitly

  • 8/14/2019 schach5-chap05-14[1]

    15/42

    Slide 5.15

    The McGraw-Hill Companies, 2002

    CASE (Computer-Aided Software Engineering)

    q Scope of CASE Can support the entire life-cycle

    q Graphical display tools (many for PCs) Data flow diagrams

    Entity-relationship diagrams Module-interconnection diagrams Petri nets Structure charts

  • 8/14/2019 schach5-chap05-14[1]

    16/42

    Slide 5.16

    The McGraw-Hill Companies, 2002

    Software Metrics

    q To detect problems early, it is essential tomeasure

    q Examples: LOC per month Defects per 1000 lines of code

  • 8/14/2019 schach5-chap05-14[1]

    17/42

    Slide 5.17

    The McGraw-Hill Companies, 2002

    Different Types of Metrics

    q Product Metrics Examples:

    Size of product Reliability of product

    q Process Metrics Example:

    Efficiency of fault detection duringdevelopment

    q Metrics specific to a given phase

    Example: Number of defects detected per hour inspecification reviews

  • 8/14/2019 schach5-chap05-14[1]

    18/42

    Slide 5.18

    The McGraw-Hill Companies, 2002

    The Five Basic Metrics

    q Size In Lines of Code, or better

    q Cost In dollars

    q Duration In months

    q Effort

    In person monthsq Quality Number of faults detected

  • 8/14/2019 schach5-chap05-14[1]

    19/42

    Slide 5.19

    The McGraw-Hill Companies, 2002

    Taxonomy of CASE

    q UpperCASE versus lowerCASE

    q Tool versus workbench versus environment

  • 8/14/2019 schach5-chap05-14[1]

    20/42

    Slide 5.20

    The McGraw-Hill Companies, 2002

    Graphical Tool

    q Additional features Data dictionary Screen and report generators Consistency checker; the various

    views are always consistent Specifications and design workbench

    q Online Documentation Problems with

    Manuals

    Updatingq Essential online documentation

    Help information Programming standards

    Manuals

  • 8/14/2019 schach5-chap05-14[1]

    21/42

    Slide 5.21

    The McGraw-Hill Companies, 2002

    Essential Coding Tools

    q Coding tools Products (such as text editors, debuggers, and

    pretty printers) designed to Simplify programmers task Reduce frustration Increase programmer productivity

    q Conventional coding scenario for programming-in-the-small Editor-compiler cycle

    Editor-compiler-linker cycle Editor-compiler-linker-execute cycleq There must be a better way

  • 8/14/2019 schach5-chap05-14[1]

    22/42

    Slide 5.22

    The McGraw-Hill Companies, 2002

    Syntax-directed Editor

    q Understands language Speeds up implementation User interface of an editor is different to that of a compile

    There is no need to change thinking mode No mental energy is wasted on these adjustments

    One piece of system software, two languages High-level language of module Editing command language

    Pretty-printer

  • 8/14/2019 schach5-chap05-14[1]

    23/42

    Slide 5.23

    The McGraw-Hill Companies, 2002

    Online Interface Checker

    q Example The programmer tries to call procedure

    computeAverage , but the linker cannot find it The programmer realizes that the actual name

    of the procedure is computeMean

    q A structure editor must support onlineinterface checking Editor must know name of every procedure

    q Interface checking is an important part of programming-in-the-large

  • 8/14/2019 schach5-chap05-14[1]

    24/42

    Slide 5.24

    The McGraw-Hill Companies, 2002

    Online Interface Checker (contd)

    q Example The user enters the call

    average = computeAverage (dataArray, numberOfValues);

    Editor immediately responds with a message such asProcedure computeAverage not known

    q Programmer is given two choices Correct the name of the procedure Declare new procedure computeAverage and specify

    its parametersq Enables full interface checking

  • 8/14/2019 schach5-chap05-14[1]

    25/42

    Slide 5.25

    The McGraw-Hill Companies, 2002

    Online Interface Checker (contd)

    q Example Declaration of q is

    void q ( float floatVar, int intVar, String s1, String s2);

    Call (invocation) isq (intVar, floatVar, s1, s2);

    Online interface checker detects the faultq Help facility

    Online information as to parameters of method q

    Better: Editor generates a template for the call Shows type of each parameter Programmer replaces formal by actual parameter

  • 8/14/2019 schach5-chap05-14[1]

    26/42

    Slide 5.26

    The McGraw-Hill Companies, 2002

    Online Interface Checker (contd)

    q Advantages No need for different tools with different interfaces Hard-to-detect faults are immediately flagged for

    correction Wrong number of parameters Parameters of wrong type

    q Essential when software is produced by a team If one programmer changes the interface specification,

    all modules calling that changed module must bedisabled

  • 8/14/2019 schach5-chap05-14[1]

    27/42

    Slide 5.27

    The McGraw-Hill Companies, 2002

    Online Interface Checker (contd)

    q Remaining problem The programmer still has to exit from the editor to

    invoke the compiler (to generate code) Then, the linker must be called to link the product Must adjust to the JCL, compiler, and linker output

  • 8/14/2019 schach5-chap05-14[1]

    28/42

    Slide 5.28

    The McGraw-Hill Companies, 2002

    Operating System Front-End in Editor

    q Single command go or run Use of the mouse to choose icon, or menu

    selectionq

    Causes editor to invoke the compiler, linker,loader, and execute the product

  • 8/14/2019 schach5-chap05-14[1]

    29/42

    Slide 5.29

    The McGraw-Hill Companies, 2002

    Operating System Front-End in Editor (contd)

    q Online documentation Help information regarding

    Operating system Editor Programming language

    Programming standards Manuals

    Editor manuals Programming manuals

  • 8/14/2019 schach5-chap05-14[1]

    30/42

    Slide 5.30

    The McGraw-Hill Companies, 2002

    Source Level Debugger

    q Example: Product executes terminates abruptly and prints

    Overflow at 4B06 , or Core dumped , or Segmentation fault

  • 8/14/2019 schach5-chap05-14[1]

    31/42

    Slide 5.31

    The McGraw-Hill Companies, 2002

    Source Level Debugger (contd)

    q The programmer works in a high-level language,but must examine Machine code core dumps Assembler listings

    Linker listings Similar low-level documentationq Destroys the advantage of programming in a

    high-level languageq We need

    Interactive source level debugger (like dbx )

  • 8/14/2019 schach5-chap05-14[1]

    32/42

    Slide 5.32

    The McGraw-Hill Companies, 2002

    Programming Workbench

    q Structure editor with Online interface checking capabilities Operating system front-end Online documentation Source level debugger

    q Constitutes a simple programming environment

  • 8/14/2019 schach5-chap05-14[1]

    33/42

    Slide 5.33

    The McGraw-Hill Companies, 2002

    Programming Workbench (contd)

    q This is by no means new All the above features are supported by FLOW (1980) The technology has been in place for years

    q Surprisingly, some programmers still implement

    code Ye Olde-Fashioned Way

  • 8/14/2019 schach5-chap05-14[1]

    34/42

    Slide 5.34

    The McGraw-Hill Companies, 2002

    Software Versions

    q During maintenance, at all times there are atleast two versions of the product: The old version, and The new version

    q

    Two types of versions: revisions and variations

  • 8/14/2019 schach5-chap05-14[1]

    35/42

    Slide 5.35

    The McGraw-Hill Companies, 2002

    Revisions and Variations

    q Revision Version to fix a fault in the module We cannot throw away an incorrect version

    q Perfective and adaptive maintenance alsoresults in revisions

  • 8/14/2019 schach5-chap05-14[1]

    36/42

    Slide 5.36

    The McGraw-Hill Companies, 2002

    Revisions and Variations (contd)

    q Variation Version for different operating systemhardware Variations are designed to coexist in parallel

  • 8/14/2019 schach5-chap05-14[1]

    37/42

    Slide 5.37

    The McGraw-Hill Companies, 2002

    Configuration Control

    q Every moduleexists in threeforms Source code;

    object code;executable loadimage

    q Configuration

    Version of eachmodule fromwhich a givenversion of aproduct is built

    l l

  • 8/14/2019 schach5-chap05-14[1]

    38/42

    Slide 5.38

    The McGraw-Hill Companies, 2002

    Version Control Tool

    q Essential for programming-in-the-many First step toward configuration management

    q Must handle Updates

    Parallel versions

    l l ( d)

  • 8/14/2019 schach5-chap05-14[1]

    39/42

    Slide 5.39

    The McGraw-Hill Companies, 2002

    Version Control Tool (contd)

    q Possible notation printerDriver (laser) / 13 printerDriver (inkJet) / 25

    q Problem of multiple variations Deltas

    q Version control is not enoughmaintenance issue

    C fi i C l d M i

  • 8/14/2019 schach5-chap05-14[1]

    40/42

    Slide 5.40

    The McGraw-Hill Companies, 2002

    Configuration Control and Maintenance

    q Two programmers working on the same module mDual / 16 mDual / 17

    q Baselines Private workspaces Freezing

    q Configuration control during development Informal testing

    SQA

    B ild T l

  • 8/14/2019 schach5-chap05-14[1]

    41/42

    Slide 5.41

    The McGraw-Hill Companies, 2002

    Build Tools

    q Example UNIX make

    q Compares the date and time stamp on Source code, object code

    Object code, executable load imageq Can check dependencies

    Ensures that correct versions/variations arecompiled and linked

    P d i i G i i h CASE T l

  • 8/14/2019 schach5-chap05-14[1]

    42/42

    Slide 5.42Productivity Gains with CASE Tools

    q Survey of 45 companies in 10 industries[Myers, 1992] Half information systems Quarter scientific Quarter real-time aerospace

    q Results About 10% annual productivity gains $125,000 per seat

    q Justifications for CASE Faster development Fewer faults Easier maintenance Improved morale