1 software development topic 1 the software development process

63
1 Software Software Development Development Topic 1 Topic 1 The Software Development The Software Development Process Process

Upload: mervin-nathaniel-robbins

Post on 03-Jan-2016

226 views

Category:

Documents


0 download

TRANSCRIPT

11

Software Software DevelopmentDevelopment

Topic 1Topic 1

The Software Development The Software Development ProcessProcess

2

The Software Development The Software Development ProcessProcess

►AnalysisAnalysis►DesignDesign► ImplementationImplementation►TestingTesting►DocumentationDocumentation►EvaluationEvaluation►MaintenanceMaintenance

Analysis StageAnalysis Stage

4

An Iterative processAn Iterative process

It is important to realise that the It is important to realise that the software development process is software development process is iterativeiterative in nature. This means that in nature. This means that the problem will be revisited a number the problem will be revisited a number of times getting closer and closer to the of times getting closer and closer to the required solution on each time round.required solution on each time round.

5

Fact FindingFact Finding

Analysis is a fact-finding process, and Analysis is a fact-finding process, and there are five key questions that need to there are five key questions that need to be asked, often repeatedly. be asked, often repeatedly.

These key questions are:These key questions are: WHO?WHO? WHAT?WHAT? WHERE?WHERE? WHEN?WHEN? WHY?WHY?

6

People involved at the very People involved at the very beginning…beginning…

►Clients - the people who require the Clients - the people who require the new system. They are the ones who new system. They are the ones who need the new software developed. need the new software developed.

►Project ManagerProject Manager - the leader of the - the leader of the software house. This person is software house. This person is responsible for the whole project and responsible for the whole project and must supervise all steps and stages must supervise all steps and stages required.required.

7

Systems AnalystSystems Analyst

What is a systems analyst?What is a systems analyst? A systems analyst A systems analyst observesobserves, , clarifiesclarifies

andand models models an existing system to assess an existing system to assess its suitability for computerisation. In the its suitability for computerisation. In the process, the analyst could also find ways process, the analyst could also find ways of improving the system.of improving the system.

The systems analyst must have a sound The systems analyst must have a sound technical background. They may once technical background. They may once have been programmers.have been programmers.

8

Skills and techniques of the Skills and techniques of the Systems AnalystSystems Analyst

The systems analyst must The systems analyst must extract the clients needsextract the clients needs document these needs in a formal waydocument these needs in a formal way communicate these to the designerscommunicate these to the designers

9

Extracting the Clients NeedsExtracting the Clients Needs

Extracting the clients needs is known as Extracting the clients needs is known as requirementsrequirements elicitationelicitation..

This is done by:This is done by: interviewing the client’s management interviewing the client’s management

personnelpersonnel making observation notes of the client’s making observation notes of the client’s

businessbusiness The analyst will also inspect information The analyst will also inspect information

sources used by the client to keep track of sources used by the client to keep track of their business.their business.

10

DocumentationDocumentation

The systems analyst must document the The systems analyst must document the clients needs by drafting a formal clients needs by drafting a formal report:report:

system specificationsystem specification

11

The System SpecificationThe System Specification

► is the end result of the requirements elicitationis the end result of the requirements elicitation► is a written statement of exactly what the is a written statement of exactly what the

design team must go on to makedesign team must go on to make► It is often a legally binding contractIt is often a legally binding contract

It is extremely important to get this document right. Mistakes made later can be very costly.

Summary of the Analysis Summary of the Analysis StageStage

►Key TaskKey Task: To define the extent of the : To define the extent of the software task to be carried out.software task to be carried out.►PersonnelPersonnel: Client and Systems : Client and Systems AnalystAnalyst►DocumentationDocumentation: The legally binding : The legally binding Software SpecificationSoftware Specification

Design StageDesign Stage

14

Design RepresentationsDesign Representations

There are a number of commonly used There are a number of commonly used forms of design representation in common forms of design representation in common use. These are called algorithmns. use. These are called algorithmns.

Examples include:Examples include: Graphical representationsGraphical representations

►structure diagramsstructure diagrams►Flow ChartsFlow Charts

Textual representationTextual representation►pseudocodepseudocode

An algorithm is a sequence of actions that, when performed in the correct order, will solve a problem or task in a finite number of steps.

Example

Here is a simple algorithm to convert a Fahrenheit temperature to Celsius:

1 Subtract 32 from Fahrenheit temperature2 Multiply by 5/9ths to get Celsius temperature

So,

98.6°F - 32 = 66.666.6 * 5/9ths = 37°C

What happens if you swap steps 1 and 2 - do you get the same answer?

Design- What are Algorithms?Design- What are Algorithms?

Pseudocode is not specific to any programming language. It is a design notation that can be implemented by programmers in any programming language

Here is the Fahrenheit conversion algorithm represented as pseudocode to be implemented as program code:

1.1 Get temp(°F)

1.2 Set temp(°F) = temp(°F)-32

1.3 Set temp(°C) = temp(°F)*0.556

1.4 Display temp(°C)

1.1 Get temp(°F)

1.2 Set temp(°F) = temp(°F)-32

1.3 Set temp(°C) = temp(°F)*0.556

1.4 Display temp(°C)

Design- Using PseudocodeDesign- Using Pseudocode

17

Pseudocode – Another Pseudocode – Another ExampleExample

1.1. Display informationDisplay information

2.2. Get detailsGet details

3.3. Do calculationDo calculation

4.4. Display answerDisplay answer

Refine step 2Refine step 2

2.12.1 display promptdisplay prompt

2.22.2 get valueget value

2.32.3 while value out of rangewhile value out of range

2.42.4 display error display error messagemessage

2.52.5 get valueget value

2.62.6 looploop

Top level design

Notice the numbering system

Simple English

words in a familiar

program form

A Structure Diagram is another design notation that represents algorithms in a chart or graphical form

Here is the Fahrenheit conversion algorithm represented as a structure diagram to be implemented as program code:

Convert °F to °C

Get temp(°F)Set temp(°C) = temp(°F)*0.556

Display temp(°C)Set temp(°F) = temp(°F)-32

Design- Using Structure Design- Using Structure DiagramsDiagrams

Design -Common Structure Diagram Design -Common Structure Diagram SymbolsSymbols

A procedure

A loop

A decision A single task

Design- Another Example Structure Design- Another Example Structure DiagramDiagram

This example is for a simple tax payment This example is for a simple tax payment procedure that decides what rate of tax a user procedure that decides what rate of tax a user must pay.must pay.

Tax payment

Get details IF earns > 30000

High rate payable

Low rate payable

Display amount to be paid

YESNO

Top-down design is where a task or problem is broken down into stages that can be solved as individual parts.

This structure diagram illustrates a top-down approach to identifying the stages of the problem solution.

Is the process of breaking a big problem down in to smaller sub-problems.

Design- Top-down DesignDesign- Top-down Design

Stepwise-refinement is the process of refining stages down into steps until each step can be easily turned into code in a programming language.

Design- Stepwise RefinementDesign- Stepwise Refinement

Key Task: To design a method of solving the stated problem.Personnel: Systems Analyst and Project managerDocumentation: A description of how the problem will be solved. This algorithm may be text based (pseudocode) or graphical (structured diagram)

Summary of the Design Summary of the Design StageStage

Implementation Implementation StageStage

25

ImplementationImplementation

The next stage The next stage involves turning the involves turning the carefully structured carefully structured design into a working design into a working solution.solution.

26

Choosing an EnvironmentChoosing an Environment

Before we can implement a solution we Before we can implement a solution we must decide on the programming must decide on the programming environment which is most suitable.environment which is most suitable.

Languages are generally designed for a Languages are generally designed for a specific purpose.specific purpose.

27

Programming LanguagesProgramming Languages

Language Purpose Algol Science Cobol Business Comal Education BASIC Education Fortran Science and Maths Java multimedia

Pascal Education Prolog Artificial Intelligence

‘Program Code

tempF = txtTempF.Text

tempF = tempF-32

tempC = tempF*0.556

lblTempC.Caption = tempC

‘Program Code

tempF = txtTempF.Text

tempF = tempF-32

tempC = tempF*0.556

lblTempC.Caption = tempC

Pseudocode

1.1 Get temp(°F)

1.2 Set temp(°F) = temp(°F)-32

1.3 Set temp(°C) = temp(°F)*0.556

1.4 Display temp(°C)

Pseudocode

1.1 Get temp(°F)

1.2 Set temp(°F) = temp(°F)-32

1.3 Set temp(°C) = temp(°F)*0.556

1.4 Display temp(°C)

A formatted printout of the program code is known as a structured listing. It includes indentation, white space, internal commentary and colour coded keywords.

Implementation- Structured Implementation- Structured ListingsListings

Implementation- Creating Maintainable Implementation- Creating Maintainable CodeCode

Code is easier to maintain when it is also very easy Code is easier to maintain when it is also very easy to read and understand. To achieve this you need.to read and understand. To achieve this you need.

short main programswise use of procedures and functions, creating variables close to where they’re used (modularity)

meaningful variable, constant, procedure and function names

appropriate internal documentation using comments

good program layout, including indentation, single statement lines, and spacing between sub-routines

Implementation- Example of Good Implementation- Example of Good

MaintainabilityMaintainability ' PROGRAM NAME : Final Circle Program' AUTHOR : The teacher' PROGRAM DESCRIPTION' This program will ask the user to enter the radius of a circle' which must be between 0 and 100. The program will then calculate ‘ and display the area and the circumference of the circle.

' Must declare all variablesOption Explicit

Private Sub Form_Load() 'Declare variables Dim radius As Single Dim area As Single Dim circumference As Single 'Get the radius Call get_radius(radius) 'Calculate the area of the circle Call calculate_area(radius, area) 'Calculate the circumference of the circle Call calculate_circumference(radius, circumference) 'Display the results of the calculation Call display_circle_details(area, circumference)End Sub

Implementation- Example of Good Implementation- Example of Good MaintainabilityMaintainability

Private Sub get_radius(radius) ' User enters the radius radius = InputBox("Please enter the radius", "Enter radius", _ "0", 1000, 3000) Call number_in_range(radius, 0, 100) ' Display radius lblRadius.Visible = True lblRadius.Caption = "Radius = " & radiusEnd Sub

Private Sub calculate_area_(ByVal radius As Single, ByRef area As Single) 'Create a constant to represent pi Const pi = 3.14 'Calculate area area = pi * radius ^ 2End Sub

Implementation- Example of Good Implementation- Example of Good MaintainabilityMaintainability

Private Sub number_in_range _(ByRef number As Single, ByVal min As Single, ByVal max As Single)'This is a Library Subroutine to check that a number is within a'specific range'The user is asked to renter when an invalid number is entered.'Parameter number holds the value entered by the user'Parameter min holds the minimum possible value that can be entered'Parameter max holds the maximum possible value that can be entered

Do If number < min Or number > max Then number = InputBox("Number is out of range._

Please re-enter a number between " & min & " and " & max, _ "Wrong entry", 0, 1000, 1000)

End IfLoop Until number >= min And number <= maxEnd Sub

Implementation- Example of Poor Implementation- Example of Poor

MaintainabilityMaintainability

Private Sub Form_Load()

x = inputbox(“Enter the radius”) y = x * x * 3.14z = (2 * x) * 3.14lblMadonna = "Area = " & y lblEltonJohn = "Circumference = " & z End Sub

Key Task: Write code in a chosen programming language based on the design.

Personnel: Programmer and Project manager

Documentation: A structured listing of the programming code showing formatting features such as colour coded commands, indentation, comments.

Summary of Implementation Summary of Implementation StageStage

Testing StageTesting Stage

Testing- Features of High Quality Testing- Features of High Quality TestingTesting

►Creating a set of test data that tests every Creating a set of test data that tests every possible combination of inputs is extremely possible combination of inputs is extremely difficult and unrealistic. difficult and unrealistic.

►Testing should therefore strive to be both Testing should therefore strive to be both systematic and comprehensivesystematic and comprehensive

►Testing can only show errors but can’t Testing can only show errors but can’t guarantee that a program is 100% error free.guarantee that a program is 100% error free.

Testing- “Bug Type 1” Syntax Testing- “Bug Type 1” Syntax Errors Errors

►Syntax errorsSyntax errors- - breaking the rules for breaking the rules for creating valid instructions in a creating valid instructions in a particular programming language.particular programming language.

►Common sources includeCommon sources include Missing out some keywordsMissing out some keywords Using keywords in the wrong orderUsing keywords in the wrong order Spelling mistakes in keywords, function or Spelling mistakes in keywords, function or

procedure, variable and object namesprocedure, variable and object names

Testing- “Bug Type 2” Logic Testing- “Bug Type 2” Logic Errors Errors

►Logic errors- carrying out valid Logic errors- carrying out valid instructions that don’t solve the instructions that don’t solve the problem the program is designed to problem the program is designed to solve.solve.

►Common sources includeCommon sources include Carrying out the wrong type of calculationCarrying out the wrong type of calculation Performing the wrong type of comparisonPerforming the wrong type of comparison Creating loops that do not execute the Creating loops that do not execute the

correct number of timescorrect number of times

Testing- “Bug Type 3” Run Time Testing- “Bug Type 3” Run Time Errors Errors

►Run time errors- errors that only occur Run time errors- errors that only occur when the program is executed.when the program is executed.

►Common sources includeCommon sources include Referring to an object or control that doesn’t Referring to an object or control that doesn’t

existexist Trying to access an array value that doesn’t Trying to access an array value that doesn’t

exist because it’s outside the index range of exist because it’s outside the index range of the arraythe array

Opening a file or other operating system Opening a file or other operating system object that isn’t there.object that isn’t there.

The program tester should set up a The program tester should set up a test logtest logInput Reason Expected

Output

Actual

Output

15 Normal Test Mark

You have passed

You have failed

Faults that become evident are known as bugs The test logs will be sent back to the programmers who

then go through the process of debugging

Comprehensive Comprehensive TestingTestingTest Data TablesTest Data Tables

The three types of testing are normal, extreme and exceptional.

Comprehensive TestingComprehensive TestingTypes of Test DataTypes of Test Data

3. Exceptional data - the data is not suitable for the program e.g.

(i) values outside agreed ranges(ii) letters instead of numbers.

2. Extreme data - the data is at the extreme limits allowed and rejected data. e.g. if an age is to be between 0 and 120 then these two values are tested

1. Normal data - typical data that would be expected.

ExampleProgram should only accept whole values in the range 0 to 100:

ExampleProgram should only accept whole values in the range 0 to 100:

Comprehensive TestingComprehensive TestingExample Test DataExample Test Data

Test Data

Normal data: 2, 34, 66 etc.

Extreme data: 0, 100

Exceptional: -1, 1000000, abc, 2.9

Testing is itself a structured process starting with individual lines of code and building up to a test of the entire system.

2. Component or procedural testing – Check that every individual procedure and function work correctly

1. Structured Walkthrough - Each line of logic in the code is stepped through by the programmer using a printed listing.

Systematic TestingSystematic Testing

3. Module testing – Check that all the individual procedures and functions link together correctly as a module.

4. System (Alpha) testing - Finally, the overall system made up of tested sub systems is tested.

Systematic TestingSystematic Testing

6. Acceptance (Beta) testing - is when independent test groups and/or the client try out the software and report back any bugs to the development team prior to final release.

If the program has been developed for a specific client it will be installed and tested by the clients

If the program has been developed for general sale it will be installed on potential clients’ systems

Testing - Stages of TestingTesting - Stages of Testing

TaskTask

46

A procedure has been written which inputs the prices of components. The cheapest is a 5p, the dearest £99.99. Devise a set of test data for this procedure.

Test Type Test Data Expected Result Actual Result

Normal 3.50, 45, 89.32 Input accepted

Extreme 0.05, 99.99 Input accepted

Exceptional 0.00, -1, 100.00, abc, <nothing>

Input rejected – suitable message displayed.

Key Task: To test that the program meets the specification and that it is reliable and robust

Personnel: Independent Test Group (ITG)

Documentation: Sets of test data and test reports. The test data will have predicted (before running) and actual (after running) output.

Summary of the Testing Summary of the Testing StageStage

Documentation StageDocumentation Stage

Documentation- User GuideDocumentation- User GuideUser Guide can include the User Guide can include the followingfollowing

1. how to install the software

2. how to start and use the software

3. a list of commands and how to use them

4. it may also contain pictures of forms, menus and icons

Audience: everyone who will use the new software

Documentation- Technical Documentation- Technical GuideGuideTechnical Guide can include

the following1. the hardware requirements

2. the software requirements

3. how to customise the software

4. how to troubleshoot any problems

5. any problems when installing and running software across a network

Audience: anyone installing and setting up the software

51

DocumentationDocumentation

NOTE: Each stage of the SDP produces NOTE: Each stage of the SDP produces documentation:documentation:

► A – Software specificationA – Software specification►D – AlgorithmD – Algorithm► I – Structured listing - I – Structured listing - Program code (internal commentary)Program code (internal commentary)

► T – Test reportT – Test report►D – User guide and technical guideD – User guide and technical guide► E – Evaluation reportE – Evaluation report►M – Maintenance reportM – Maintenance report

Key Task: To produce documentation to be distributed with the software.

Personnel: Client, Programmer, Project Manager

Documentation: User Guide and Technical Guide

Summary of the Documentation Summary of the Documentation StageStage

Evaluation StageEvaluation Stage

Evaluation- Key Areas in the Evaluation- Key Areas in the Evaluation ReportEvaluation Report

Evaluation- What do robustness and Evaluation- What do robustness and reliability mean?reliability mean?

►RobustnessRobustness A program is robust if it does not crash when A program is robust if it does not crash when

invalid data is input or unexpected results are invalid data is input or unexpected results are generated.generated.

►ReliabilityReliability A program is reliable if for all normal and extreme A program is reliable if for all normal and extreme

inputs the output from the program matches the inputs the output from the program matches the expected output. This happens when the program expected output. This happens when the program is free from errors.is free from errors.

Evaluation- What do portability and Evaluation- What do portability and efficiency mean?efficiency mean?

►PortabilityPortability A program is portable if it can run on a range of A program is portable if it can run on a range of

different computer hardware and operating systems different computer hardware and operating systems software with little or no changes needed to the software with little or no changes needed to the program codeprogram code

►EfficiencyEfficiency A program is efficient if it runs as fast as possible and A program is efficient if it runs as fast as possible and

does not use up more system resources than necessary. does not use up more system resources than necessary. System resources include things like processor time, System resources include things like processor time, main memory and backing storage requirementsmain memory and backing storage requirements

Evaluation- What do maintainability Evaluation- What do maintainability and fitness for purpose mean?and fitness for purpose mean?

►MaintainabilityMaintainability A program is maintainable if it can easily be A program is maintainable if it can easily be

modified and updated to fix errors, add new features modified and updated to fix errors, add new features or work with new hardware and software.or work with new hardware and software.

►Fitness for PurposeFitness for Purpose A program is fit for purpose if it fulfils the criteria A program is fit for purpose if it fulfils the criteria

set out in the software specification.set out in the software specification.

Key Task: To report upon the quality of the software according to given criteria.

Personnel: Systems Analyst and Project manager

Documentation: A evaluation report accompanying the software to the client. It compares the software to the original specification and also comments on the quality of the software.

Summary of the Evaluation Summary of the Evaluation Stage Stage

Maintenance StageMaintenance Stage

Begins once the software has been released and put into use. Involves the client who uses the software and the programmers to make any necessary changes.

There are 3 types of maintenance.

Corrective: Fixing any errors that were not detected during the testing phase.

Adaptive: To alter the software to work with a new operating system or new hardware.

Perfective: Add new functionality at the request of the client.

Corrective: Fixing any errors that were not detected during the testing phase.

Adaptive: To alter the software to work with a new operating system or new hardware.

Perfective: Add new functionality at the request of the client.

MaintenanceMaintenance

MaintenanceMaintenance►Types of maintenance carried out and Types of maintenance carried out and

typical values for each kind of maintenancetypical values for each kind of maintenance Corrective (17%)Corrective (17%) Adaptive (18%)Adaptive (18%) Perfective (65%)Perfective (65%)

17 18

65

0

10

20

30

40

50

60

70

%

Maintenance- Who pays for Maintenance- Who pays for it?it?

►Adaptative and perfective maintenance are Adaptative and perfective maintenance are paid for by the clientpaid for by the client

►Corrective maintenance is paid for by the Corrective maintenance is paid for by the developer because it’s due to errors that developer because it’s due to errors that should have been detected and corrected should have been detected and corrected during the Testing phase.during the Testing phase.

Key Task: To make changes to the software after it has been handed over to the client.

Personnel: Usually the project manager, programmer and client will be involved.

Documentation: A maintenance report will detail and confirm the maintenance carried out.

Summary of the Maintenance Summary of the Maintenance StageStage