You are on page 1of 2

Additional Notes for Lectures 15 and 16 9.

9. Check that all parameters are used and that all input and
Choice of a Programming Language output is accounted for.
In a Software Engineering Project, the choice of a programming 10. Document within the source code and outside the code
language to use for the coding of an application depends on the (technical documentation)
following: 11. Adopt a ‘Defensive Programming’ approach i.e. if a
- The problem being addressed procedure is passed invalid data, it will not fail in an
- The available skills unexpected manner.
- The project budget
- The project time frame n.b. Good code is easy to debug, easy to maintain, and easy to
Software engineers should remember that a programming language is extend. Good code can be achieved through good structure and good
only a means to an end i.e. a tool to produce a working application documentation.
with minimum effort.
Different programming languages have different strengths e.g. C Guidelines for Documentation
works well for graphics while java works well for web applications.
FORTRAN is sill the best language for scientific programming. It is 1. Within the code, comment on :
possible to combine object oriented languages such as C++ and Java - Long/ nested loops
with FORTRAN libraries to take advantage of their different - Lines before a control statement
strengths - any assumptions made in the code e.g. assuming the an
amount entered is in TShs.
Guidelines for coding:
1. Agree on structure and naming conventions and document the 2. Outside of the code (technical manuals)
agreement especially when working as a team. Use coding - document as you code
standards developed by other organisation wherever possible - use concise statements
(Search for ‘Coding standards’ on Google to obtain links to - automated tools such as javadoc or twintext may be used
information on standards for different programming
languages) Useful tools in coding:
2. Wherever possible, review software that solves a similar - Source Control System: allows you to keep a clearly defined
problem audit trail of modifications that are made to the code. Source
3. Reuse existing code and libraries Control Systems allows programmers to keep track of
4. Avoid deep nesting versions especially when more than one programmer is
5. Use clear unambiguous names for procedures, functions, data involved in a project. As example of a source control system
structures etc. is Concurrent Version System (CVS).
6. Try to develop incrementally i.e. start with the smallest - Debuggers: A debugger helps to catch runtime errors i.e.
possible version that will run, test it for correctness and then bugs. Most programming languages come packaged with a
keep adding functionality until you complete the application. debugger, There are however some stand alone debuggers
7. Use global variable only when absolutely necessary such as TotalView for C and C++. Common software bugs
8. Use as few parameters as possible in functions. include:
o Segmentation violation e.g. trying to read beyond the
bound of an array or to write to an unassigned pointer
o Underflow: The result of an arithmetic operation
being so small that is rounded to zero
o Imprecise results: the rounded result of an operation if
different from the exact result
o Invalid operation: e.g. square-root of a negative
number
o Divide by zero
o Overflow: correctly rounded result would be larger in
magnitude than the largest finite number representable
o Indefinite loops

Software Inspections
Software inspections involve people examining the source code with
the aim of discovering anomalies and defects. Inspections may also
be applied to documents such as SRS documents and analysis/ design
models.
Software inspection does not require the execution of the code.
Software inspection, if carried out by experienced programmers is a
very effective technique for discovering errors. Many different
defects may be discovered in a single inspection. Inspections and
testing are complementary techniques. Inspections cannot check non-
functional characteristics e.g. performance and usability.

Procedure for carrying out a Software inspection


1. A precise specification of what the code should do is
presented to the inspection team.
2. Code and assoicated documents are distributed to the team in
advance. The team should include inspectors (programmers
who were not involved in the coding) and the programmers
who did the coding.
3. Inspection takes places and discovered errors are
documented. An inspection checklist comprising of common
errors/ bugs may be used
4. Modifications are made to correct the discovered errors
5. Re-inspection may be done.

You might also like