Home O-Level Computer Science Ch7
Post
Cancel

O-Level Computer Science Ch7

7.1 The program development life cycle

  • Five stages: analysis, design, coding, testing and maintenance.

Analysis

  • requirements / program specification
  • how the program should be developed
  • use abstraction and decomposition tools to identify exactly what is required from the program.
    • abstraction: keeps the key elements required for the solution to the problem and discards any unnecessary details and information that is not required.
    • decomposition: breaks down a complex problem into smaller parts, which can then be subdivided into even smaller parts, that can be solved easily.

Design

  • the programmer should know what is to be done, i.e.
    • all the tasks that need to be completed
    • how each task is to be performed and how the tasks work together
  • can be formally documented by
    • structure charts
    • flowcharts
    • pseudocode

Coding and iterative testing

  • Each module of the program is written using a suitable programming language and then tested to see if it works.
  • iterative testing
    • modular tests are conducted
    • code amended
    • test repeated until the module performs as required

Testing

  • The completed program or set of programs is run many times with different sets of test data.
  • This ensures that all the tasks completed work together as specified in the program design.

7.2 Computer systems, sub-systems and decomposition

  • Computer system is made up of:
    • software
    • data
    • hardware
    • communications
    • people
  • sub-systems:
    • each computer system can be divided up into a set of sub-systems
    • each sub-system can be further divided into sub-systems and so on until each sub-system just performs a single action

The computer system and its sub-systems

  • to understand how a computer system is built up and how it works -> system is often divided up into sub-systems
  • each sub-system can be developed by a programmer as a sub-routine
  • how each sub-routine works can be shown by using flowcharts or pseudocode
  • top-down design
    • decomposition of a computer system into a set of sub-systems, then keep breaking until each sub-system just performs a single action
    • an effective way for designing a computer system to provide a solution to a problem
      • each part of the problem is broken down into smaller more manageable problems
      • this process is called stepwise refinement
    • work for the development of both large and small computer systems
      • for large computer systems:
        • several programmers can work independently to develop and test different sub-systems for the same system at the same time
        • This reduces the development and testing time

Decomposing a problem

  • Any problem that uses a computer system for its solution needs to be decomposed into its component parts.
  • The component parts of any computer system are:
    • inputs: the data used by the system that needs to be entered while the system is active
    • processes: the tasks that need to be performed using the input data and any other previously stored data
    • outputs: information that needs to be displayed or printed for the users of the system
    • storage: data that needs to be stored in files on an appropriate medium for use in the future

Methods used to design and construct a solution to a problem

  • three formal methods:
    • struture diagrams
    • flowcharts
    • pseudocode
  • structure diagrams
    • show top-down design in a diagrammatic form
    • how a computer system solution can be divided into sub-systems with each level giving a more detailed breakdown
  • flowcharts
    • show diagrammatically the steps required to complete a task and the order that they are to be performed
    • These steps, together with the order, are called an algorithm
    • an effective way to communicate how the algorithm that makes up a system or sub-system works
    • flowchats are drawn using standard flowchart symbols
      • Begin / End
      • Process
      • Input and output
      • Decision
      • Flow lines
  • pseudocode
    • a simple method of showing an algorithm
    • data items to be processed by the algorithm are given meaningful names in the same way that variables and constants are in a high-level programming language.
    • it does what its name says, it pretends to be programming code
    • the pseudocode for an assignment statements
    • the pseudocode for conditional statements
      • IF…THEN…ELSE…ENDIF
      • CASE OF…OTHERWISE…ENDCASE
    • the pseudocode for iteration
      • FOR…TO…NEXT
      • REPEAT…UNTIL
      • WHILE…DO…ENDWHILE
    • the pseudocode for input and output statements
      • INPUT
      • OUTPUT

7.6 Test data

  • to determine whether a solution is working as it should
  • usually before a whole system is tested each sub-system is tested separately

    How to suggest and apply suitable test data

  • algorithms written in pseudocode or as flowcharts can be tested by a person working through them using any data that is required and seeing what the result is.
  • computer programs can be tested by running them on a computer using any data that is required and seeing what result is output
  • to test a solution thoroughly it may need to be worked through several times with different sets of test data.
  • a set of test data is all the items of data required to work through a solution
  • normal test data: used to work through the solution to find the actual result(s) and see if they are the same as the expected result(s)
  • abnormal test data or erroneous test data: chosen that would be rejected by the solution as not suitable, if the solution is working properly
  • extreme data: are the largest and smallest values that normal data can take
  • boundary data: used to establish where the largest and smallest values occur
This post is licensed under CC BY 4.0 by the author.