designing & testing software development notes software design & development: design...
TRANSCRIPT
Designing & Testing Software Development Notes
Software Design & Development:Design Notations, Development Methodologies & Testing and Documenting Solutions
ContentsThe Software Development Proce
ss Questions
Development Methodologies Questions
Design Notations Questions
Errors and Bugs Questions
Testing Techniques Questions
Software Development Process
The software development process is a seven step process that programmers usually follow when creating software.
Some development methodologies don’t follow all of these steps though.
The process is sometimes referred to as the waterfall model – as once you have completed one step, you move onto the next
The steps are Analysis Design Implementation Testing Documentation Evaluation Maintenance
IterationThe basic waterfall model is simplistic. In practice, iteration is used to improve the quality of the created software
In iterative software development, earlier phases of the development process can be redone based on what has been learned later.
In other words, you can go back up the waterfall!Analysis
Design
Implementation
Testing
Documentation
Evaluation
Maintenance
AnalysisThe Analysis stage is where you identify what the program is going to do.
The analysis stage usually requires the participation of two parties – the systems analyst and the client
The client is a person or group who the software is being made for. The client usually has a good idea of what they want the software to do, but may not be able to express it well
The systems analyst is a person or group whose job it is to identify what the clients requirements are.
Systems analysts require both a strong understanding of computing and interpersonal skills to elicit information from the client
Methods used by the systems analyst might include: Interviews – with both managers and workers for the client Observations of existing working practice Questionnaires
Software SpecificationAt the end of the analysis stage, the systems analyst and the client will have agreed upon a software specification document
The software specification is a legally binding document. It is a contract which states what the software is going to do, and how much the software developers will be paid for creating it for the client.
DesignIn the design stage, the software specification is used to plan out how to create the software, and how it will do the tasks required of it.
Different design notations will be used to create different parts of the design:
The user interface can be designed using wireframing Individual subprograms can be designed using pseudocode
Depending on the development methodology used, a design document may be produced at this stage.
While the software specification states what the software has to do, the design documentation will state how it does it
Implementation In the implementation stage, the software is created
The project manager in charge of creating the software has to manage the implementation stage. They have to lead a team or teams of programmers to create the software.
Many factors have to be considered when implementing software:
What programming language will be used Who is going to program which part of the program Do additional programmers need to be hired? Will currently hired
programmers require additional training? What is the timescale for producing the software, and is the
programming team keeping to the timescale What is the budget for creating the software, and is it being kept to
TestingIn the testing stage, the software is tested to make sure it is working correctly. Software needs to be reliable, robust and fit for purpose
Reliable software processes data correctly.
Robust software is can cope with errors when it runs – it does not crash unexpectedly
Fit for purpose software fulfils the requirements set out in the software specification
Testing will be examined in more detail in a later section
DocumentationOnce software is “complete”, it can be documented. A number of different documents might be created
The user guide or manual tells the user how to complete certain tasks with the software.
The user guide is written for typical users and does not require significant computer expertise to understand
Technical documentation covers technical information about the software, such as configuration, system requirements and application programming interface (API) documents for the software
Technical documents are written for expert users and other programmers so they can modify the software
EvaluationIn the evaluation stage, the software is judged in terms of how good it is.
The most important consideration is whether or not the software is fit for purpose – does it do what it is supposed to, as set out in the software specification
There are a number of factors that should be considered as well
Reliability – does the software process data correctly? Robustness – can the software handle errors without crashing? Efficiency – can the program process data without using to much
memory / processing time? Portability – can the software be used on different computers? Maintainability – can the software be changed easily Readability – is the program code easy to read, using meaningful
variable and subprogram names, and internal commentary
MaintenanceThe maintenance stage happens after the software has been released or passed to the client. It covers changes made to the software during its lifetime.
Corrective maintenance fixes bugs and other errors discovered in the software after release
Perfective maintenance adds new features to software
Adaptive maintenance changes software to allow it continue working despite changes to its environment – such as running on a updated operating system for example
Questions – The software Development ProcessAnswer questions in full sentences!1. List and briefly describe the seven steps of the software
development process2. Explain how making the development process iterative can
improve the quality of software produced3. Explain why a systems analyst needs both expert computer
knowledge and interpersonal skills4. What is a software specification and why is it important to
agree on one before creating software5. What is meant by the term “fit for purpose” when testing and
evaluating software. Why is this the most important consideration when evaluating software?
6. List and describe other factors to consider when evaluating software
7. Describe two types of documentation that can be produced during the documentation stage
8. List and describe three types of maintenance
Development MethodologiesA development methodology is the way in which software is created
The waterfall model is an example of a top-down development methodology.
Top-down development methodologies set out to complete the entire specification of an item of software in one go. The project is split into progressively smaller parts, with each part representing an easier subsection of the task.
Once a task is split into sufficiently easy chunks, individual programmers can complete each part of it
This top-down approach represents the traditional method of developing software. It holds a number of advantages:
Thorough, careful and considered – clear goals at each phase of development
Clearly defined roles and specialisations – each individual knows what they are responsible for
Easy to manage, easy to keep track of where things do go wrong
There are also disadvantages with this approach: Unwieldy and prescriptive – flaws in the design are difficult
to correct and may require an extensive redesign and throwing away completed code to accommodate design changes
Inefficient – can result in a lot of extra work, especially documentation, which in turn can result in software being over budget
Client sees little progress until the software is complete
Rapid Application DevelopmentRapid Application Development (RAD) is an alternative development methodology intended to overcome the weaknesses of the waterfall model.
In RAD, the specification and planning are less important. Prototyping is used to produce and demonstrate incrementally better versions of the software. Feedback from the clients is used to alter the requirements and improve the software
User Design and Construction are iterative stages – each new
software build informs the design of the next build
Using RAD as a development methodology has a number of advantages over the waterfall model:
The client gets to see the software very early on and has input into its progress
Client feedback results in a very good user interface Risk factors can be identified and solved without requiring
complete redesigns of the software – this makes it more likely that the software will be produced on time and on budget
But reducing the importance of planning has consequences that are disadvantageous for RAD
Client has to give up more resources in terms of time and man-hours to provide the feedback
Feedback tends to focus on UI – back end code can end up poorly designed and less efficient as a result
Less control over the process – in particular since the requirements change over time, it becomes more difficult to judge if the developers have fulfilled their contract with the client
Agile MethodologiesAgile methodologies are software development methodologies that favour adaptability and flexibility over planning and following processes.
Rapid Application Development could be considered an agile methodology. There are a number of different agile methodologies such as Extreme Programming and Scrumm. They follow a number of principles:
Individuals and interactions over Processes and tools Working software over Comprehensive documentation Customer collaboration over Contract negotiation Responding to change over Following a plan
Pair Programming is an example of an agile
technique
Top-Down vs AgileTop-down and agile methodologies have different strengths and weaknesses. This makes them suitable for different types of projects.
Smaller to medium scale projects work well with agile methodologies. Agile techniques that rely on close collaboration amongst the development team can help make better quality software.
Larger projects require more people to complete. Top down models allow much better control over larger teams because of the clearly defined roles and structures
Questions – Development MethodologiesAnswer questions in full sentences!1. Explain what is meant by top-down software development2. Describe the advantages of top-down development
methodologies3. Describe the disadvantages of top down development
methodologies4. What is Rapid Application Development?5. Explain how RAD improves the quality of developed
software6. Explain how RAD can reduce the risk of cost and time
overruns7. Why might it be a problem that agile methodologies result
in less control over a project than top down methodologies?8. Why would an agile methodology be less suitable for
creating an large information system for a multinational bank with offices in several countries?
Design NotationsA design notation is a way of describing the design of a program, or part of a program
There are many different design notations. Different design notations are more useful for different parts of the software
The user interface can be designed using wireframing Individual subprograms can be designed using
pseudocode
It is important to select the right design notation when designing software
PseudocodePseudocode is a design notation that sets out what an algorithm will do. It uses the structure of a programming language, but uses English words instead of program code
This pseudocode example shows the algorithm for iterating through an array:
1) FOR EACH name FROM names2) RECEIVE names[i] FROM KEYBOARD3) END FOR EACH
It uses the for loop programming construct, but because the words used are closer to English, it is easier for people to understand.
Pseudocode is easy to translate into a programming language – each line of pseudocode should be equivalent to a line of code in the programming language
The equivalent python code
Stepwise RefinementIn stepwise refinement, complicated pseudocode steps that would take more than one line of code are refined into further pseudocode
Stepwise refinement allows bigger programs to be designed with pseudocode. It helps developers to create modular software. Refined steps are often made into subprograms
This example shows how steps can be refined:
1) Set up variables2) Get input3) Calculate answer4) Display answer
2.1) RECEIVE width FROM KEYBOARD2.2) RECEIVE length FROM KEYBOARD2.3) RECEIVE height FROM KEYBOARD
The refinement as a subprogram
WireframingWireframing is a design notation for creating user interfaces. A wireframe is sketch that shows the placement of elements on the UI.
The advantage of wireframing is it can be used to show to and gain feedback from the client and users very easily. It does not design the underlying program code though
A wireframe and corresponding Visual Basic interface
Structure DiagramA structure diagram shows the relationship between a program and the subprograms that make it up, as well as the data flow between them.
Structure diagrams are useful for showing the shape of a program to people who are not computer experts. The bigger a program gets, the more difficult it is to draw the diagram
Volume of a cuboid
Get InputsCalculate Volume
Display answer
width, length, height
width, length, height
volumevolume
FlowchartsA flowchart is a graphical representation of the steps taken by a program
Flow charts are useful for showing the flow of information in a program to non-experts, but they become increasingly difficult to draw as the program gets bigger
Input width
Is widt
h >0
Display error
messageN
Y
This partial flowchart shows input validation
Note the use of the diamondshape for decisions
UMLUniversal Modelling Language is a design notations that shows objects – classes, subprograms and database tables – as well as their attributes and relationships to each other.
UML is particularly useful when designing software that includes databases, or when using object orientated programming languages
Questions – Design NotationsAnswer questions in full sentences!
1. What is pseudocode and stepwise refinement?
2. Why is stepwise refinement a useful design notation to use when using a top-down development methodology?
3. Describe an advantage of pseudocode
4. What is meant by wireframing?
5. Give one advantage and one disadvantage of wireframing
6. Explain why structure diagrams are inappropriate for designing larger programs
7. Why is a flow chart better for explaining how input validation works to a non-expert than the corresponding pseudocode
8. When might you use UML as a design notation? Why?
9. Write the pseudocode for a program that calculates the perimeter of a rectangle. Use stepwise refinement to break the pseudocode into subprograms
Errors and bugsDuring the implementation stage of creating software, it is common for the programmers to make mistakes and errors known as bugs.
You are required to be able to identify such bugs where they occur, the nature of the error and correct it
Bugs can be identified by testing. Software must be tested comprehensively in order to find and correct as many bugs as possible before release
Syntax ErrorsA syntax error is when the programmer has made an error in their use of the programming language. Syntax errors happen when the computer cannot understand what a line of code means.
Programs will not compile or run at all if they include a syntax error. This makes it easy to know if your program has a syntax error, though it can still be difficult to find and fix
Most programming environments will highlight where they have encountered the error. This might not be where you have to fix a mistake though
Typical causes of syntax errors include Spelling errors – programming keywords and
variable names misspelt Missing symbols – “, &, : or other symbols
have been missed out, meaning the computer can’t understand what the program says
Closure error – blocks of code haven’t been closed off properly with brackets or end statements where appropriate
The missing : from the for line will cause a syntax error
Many compilers will highlight the next line as being the source of the error though!
Execution ErrorsExecution Errors are bugs that will not be highlighted when the program is compiled, but will cause the program to crash whilst running
Some execution errors only happen when using specific sets of input data, which can make them very hard to track down.
Most programming environments will report at which line an execution error occurred
Typical causes of execution errors include Spelling and naming errors – trying to access a
variable or object using the wrong name may cause the program to crash.
Calculation errors – trying to perform calculations that are impossible such as dividing by 0 will cause the program to crash.
The misspelt variable poeple above is assigned the value 0 instead of what the user entered. This causes a divide by 0 error which crashed the program
Logic ErrorLogic errors cause a program to process information incorrectly and give the wrong answer. Logic errors do not cause a program to crash or fail to run.
Logic errors can only be spotted by testing, and may only occur with specific inputs. This makes them very hard to detect and fix.
Logic errors are usually caused by bad design and lack of knowledge
This logic error is caused by the programmer not understanding operator precedence
Questions – ErrorsAnswer questions in full sentences!1. Describe in detail the three types of errors in a program?2. Why is it important to thoroughly test a program in order to
catch execution and logic errors?3. Execution and logic errors are sometimes also known as
runtime errors. Why? 4. A program has been written to count the number of A grade
passes in a test. It is shown below
a) What is the output of the program?b) What type of error has occurred?c) Identify the line with the error in it and correct it
5. A program has been written to calculate tax codes. It is shown below
a) What type of error does this program include?b) Identify the lines with the error in it and correct them
Testing TechniquesIn the testing stage, software is checked to make sure that it works correctly.
In order to test software, the testers must create and follow a test plan.
Test data is a specific input or inputs for the program. If the program fails to process a single item of test data correctly, there is a bug that needs fixed.
Once a program is able to correctly process all the test data from the test plan, it can be said to be reliable
Component TestingTo simplify the process of testing software, individual components of the software can be tested.
If a component works correctly it can integrated with the rest of the program
To test an individual component of a program, the testers have to identify suitable sets of test data to use with it. A test table should be created and completed:Mark Expected result Actual result
-5 rejected
0 accepted
4 accepted
10 accepted
12 rejected
A test table for checking the input validation of a mark between 0 and 10. Note the normal, extreme and exceptional values
Comprehensive testingTest plans should be comprehensive – they should test each appropriate component with a range of appropriate values. They should also check that the software as a whole produces correct results
To make a comprehensive test plan: Identify each component to be tested Identify test data to use with each component –
normal, extreme and exceptional values Create a set of test data to check that the program as a
whole gives correct results Work out what the expected result for each bit of test
data should be
To follow the plan Record the actual results for each bit of test data Compare the expected and actual results
Testing should be iterative – if the expected and actual results do not match, the program has a bug. The developers should go back to the implementation phase, fix the bug and then re-test the program
In practice, component testing is carried out continuously during implementation. Programmers usually check that each module of code is working as they create it
Dry RunsIn dry run testing, a programmer reads through pseudocode or program code, keeping track of the value or state of a variable or other object
Dry run testing is useful as it can be carried out before programming has even begun. It can be used to check if an algorithm design is correct.
Dry run testing is not very scalable – most people find it hard to keep track of several different values in their head at once!
Trace TablesA trace table is a dry run where the changes in the values of variables are recorded in a table.
This makes it easier to track the progress of multiple variables
1) SET total TO 02) FOR counter FROM 1 TO 103) SET total TO total + 104) END FOR
Note how the line numbers repeat as the loop
progresses
Line
Total Counter
1 0
2 0 1
3 10 1
2 10 2
3 20 2
2 20 3
3 30 3
2 30 4
3 40 4
BreakpointsA breakpoint is an intentional stopping point placed in a program in order to help debug the program.
When run, the program will pause when it reaches the breakpoint. This allows the programmer to study the program’s environment – including information such as the values stored in variables. This lets the programmer check if the program has run correctly up to the breakpoint
Once the programmer is satisfied, the program can then be continued.
Some software development environments include the ability to place breakpoints in programs
A breakpoint in Visual Basic
Questions – TestingAnswer questions in full sentences!1. What is meant by component testing?2. Describe in detail how each individual
component in a program should be tested3. What is meant by comprehensive testing? Why
is it important to test a program comprehensively?
4. The testing process is usually iterative. Why is it a good idea to carry out testing iteratively?
5. Explain what is meant by dry run testing6. Give one advantage and one disadvantage to
dry run testing7. What is meant by a breakpoint?
8. Copy and complete the trace table for the following program
Line List Minimum Counter
1
2
3
5