Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

SOFTWARE QUALITY-PHY3111

By the end of this chapter you should be able to


• Document your code so that it is easy to maintain
• Distinguish between compile-time errors and run-time errors;
• Test a program using the strategies of unit testing and
integration;
• Generate test data using the strategies of black box testing,
white box testing and stress testing;
• Document your test results professionally using a test log;
• Explain the meaning of handling exceptions;
• Format your output to improve the usability of your
programs.

1
Desirable features of piece of software
• Maintainability;

• Reliability;

• Robustness;

• Usability

2
Maintainability
• Since the requirements of an applications often change over time.

• Maintainability is the ease with which a software system or


component can be modified to correct faults, improve performance
or other attributes, or adapt to a changed environment.

• Maintainable software allows you to quickly and easily:


– Fix a bug, without introducing a new bug as you do so
– Add new features, without introducing bugs as you do so
– Improve usability
– Increase performance
– Make a fix that prevents a bug from occurring in future
– Make changes to support new environments, operating systems or
tools
– Bring new developers on board your project

3
Why is maintainability desirable?
• Today, you have the skills and knowledge to understand and make changes to your
software, but what about next week, or six months from now?

• What if a developer leaves your team (or they fall ill), and you need to take over
their code? What if you need to get a new developer up to speed with your
software? What if you have to suspend your project whilst you get more funding,
and then need to recall all the information about the software a year later?

• In all these cases, you or your developers, will find yourselves wading through
code trying to figure out how it all fits together. This isn't fun, and it wastes
valuable time that could be better spent actually improving your
software! Maintainable software is software that is easy to understand. It is code
that can be understood by someone new - or someone that hasn't seen it in a
while - with a minimum of effort. As software guru Martin Fowler said
in Refactoring: Improving the Design of Existing Code, 1999, "Good programmers
write code that humans can understand."

4
How to develop maintainable
software
• Developing maintainable software is like picnicking. Once you're finished, leave
your spot as you would like to find it yourself, or leave it in a better state than you
found it! There are a number of principles, approaches and techniques that can
help you develop maintainable software. Many of these are generally applicable to
writing good software:
– Design for maintainability from the outset
– Iterative development and regular reviews help to improve quality - see the
section below
– Readable code is easy to understand ("write programs for people")
– Refactor code to improve its understandability
– Relevant documentation helps developers understand the software
– Automated build make the code easy to compile
– Automated tests make it easy to validate changes
– Continuous integration makes the code easier to build and test
– Version control helps keep code, tests and documentation up to date and
synchronised
– Change the way you work to make maintainability a key goal
• Documentation
– A complete software system consists of more than just the
final program.
– It should also have additional support materials such as
• user manual
• Software design
• Clear method definitions (parameter return types, pseudocode
when appropriate)
• When including in code documentation consider the
following
– Comments to make the meaning of your code clear;
– Meaningful data names;
– Constants in place of fixed literal numbers;
– Consistent and clear indentation.
• Indent, by one level, all code that belongs within these braces

6
Reliability
• A Software Reliability is the probability of failure-
free software operation for a specified period of time in a
specified environment

• A reliable program is one that does what it is supposed to


do.

• There are two kinds of errors which might occur when you
are building a program.

– Compile-time errors

– Run-time errors.

7
Compile-time errors:
• These are errors where by you can not
compile the program
• Missing end if
• Forgetting to close a do statement
• Being inconsistent with names and /or types;
• etc improper use of the syntax
Run Time Error:
• A runtime error is a program error that occurs
while the program is running e.g:
– logic error, which produces the wrong output,
– wrong use of arithmetic operator etc.
8
Testing
• If you have no compilation errors (syntax errors)
then you should think of running your program to
ensure that it does what it is supposed to do this
is termed as testing.

• Validation is a process of ensuring that your final


system meets the user’s requirements.

• Verification is a process of ensuring that the code


you develop meets your own understanding of
the users requirements.

9
Types of Testing
• Unit testing is a level of software testing where
individual units/ components of a software are tested.
The purpose is to validate that each unit of the
software performs as designed. A unit is the smallest
testable part of any software. It usually has one or a
few inputs and usually a single output

• Integration Testing is a level of software testing where


individual units are combined and tested as a group.
The purpose of this level of testing is to expose faults in
the interaction between integrated units.

10
• Black Box Testing: also known as Behavioral
Testing, is a software testing method in
which the internal
structure/design/implementation of the
item being tested is not known to the
tester.
– A group of inputs that all produce the
same output are regarded as equivalent
– 70<=x<=100
– 60<=x<70 etc
• White Box Testing is defined as the testing
of a software solution's internal structure,
design, and coding. In this type of testing,
the code is visible to the tester. It focuses
primarily on verifying the flow of inputs
and outputs through the application,
improving design and usability,
strengthening security is a method
of testing software that tests internal
structures or workings of an application

11
The test log
• Come up with a TEST LOG. This is a document
that records the testing that took place during
system development.

12
Robustness
• Robustness is the ability of a computer system to
cope with errors during execution and cope with
erroneous input

• A program is said to crash when it terminates


unexpectedly, robust programs are ones which
doesn’t crash even if they receive unexpected
values

• When a program crashes it should output a


message explaining the reason for the crash
13
Usability
• Usability is the degree to which a software can be
used by specified consumers to achieve quantified
objectives with effectiveness, efficiency, and
satisfaction in a quantified context of use

• A program which crashes all the time when receiving


unexpected inputs is far from usable, so one way of
ensuring that your program is usable is to make it
robust.

• Usability testing is a technique used in user-centered


interaction design to evaluate a product by testing it on
users

14

You might also like