0% found this document useful (0 votes)
25 views9 pages

Lesson 2

This document discusses key aspects of software design and documentation. It covers program structure and representation, stylistic guidelines, testing and debugging, documentation modules, and types of documentation including user documentation, programmer documentation, and external documentation. The goal of documentation is to make software more understandable, readable, and modifiable. Good documentation includes things like comments, indentation, and descriptive identifiers to aid program comprehension.

Uploaded by

Kim Austin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views9 pages

Lesson 2

This document discusses key aspects of software design and documentation. It covers program structure and representation, stylistic guidelines, testing and debugging, documentation modules, and types of documentation including user documentation, programmer documentation, and external documentation. The goal of documentation is to make software more understandable, readable, and modifiable. Good documentation includes things like comments, indentation, and descriptive identifiers to aid program comprehension.

Uploaded by

Kim Austin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

CHAPTER TWO INTRODUCTION

Documentation, drawing flowchart to The Software designing involves mainly


represent solution
two things
1. Program Structure.
2. Program Representation.

PROGRAM
PROGRAM STRUCTURE
REPRESENTATION
• The program structure is decided using top- The program representation refers to its
down structure or any other popular approach. presentation style so that the program
• The main task is divided in to clear logical sub becomes readable and presentable.
tasks there by deciding about the sub routine
A program which is easily understood can be
and global variables information hiding etc.
checked for errors if any, and easily modified.
It is learnt that normally 60-75% of time and
90% cost of the program is spent on testing,
debugging and modifying it.

1
STYLISTIC GUIDELINES STYLISTIC GUIDELINES

• Developing good program is skill and writing • Developing good program is skill and writing
good program is a quality habit. good program is a quality habit.

Meaningful Names for Identifiers Ensure clarity of Expressions

Assign Meaningful names for identifiers  Expressions carry out the specified action (s). Thus the
must be clearly understood by the users. Clarity of
viz. variables, constants, functions etc… expressions should not be compromised.
Do not use similar looking names like  Avoid programming tricks whose intent
viz. manager, manage  Will not be obvious to reader.
 Never sacrifice Clarity of expressions
Always assign names to scalar even if changed expressions may get
constants when it helps in clarity and minor gain in machine time.
readability.

2
Use Comments and
Indentation Insert Blank Lines and
Spaces
 Comments play a very important role as  The insertion of blank lines and spaces enhances the
they provide internal documentation of a program. program readability. they are to separate
declaration blocks and comments.
 Always insert prologues that comment in the
beginning of a program.  Inserted before label, const. variable declarations.

Characteristics Of Good
Pretty printing
Program
 When program formatting is done to make program more  Efficient and effective
readable, it is called pretty printing.  User friendly
 Self –documenting Code
 Reliable
 Portable

3
Stages Of Program
Robustness
Development

 The ability of a program, to recover following an error


 Crack the problem and to continue operating within its environment is
 Code the algorithm called robustness.
 Compile the program
 Execute the program

Guard code Types of Error

1.Compile-Time Error
 The code which can handle exceptional data
errors and operational errors is called guard  Syntax error
code. Occurs when rules of programming are misused i.e
when grammatical rule of c++
are violated.
 Syntax refers to formal rules governing the construction
of valid statements in a language.
 Semantics errors occur when statements are not
meaningful.

4
Run-time Errors Logical Errors

 Error that occur during the execution of a  Sometimes even if you don’t encounter
program are run time errors. These are harder any error during your compile time and run
to detect errors. Some run time errors stop the time , your program does not provide the
execution of the program which is then called
correct result. This is because of
program “crashed” or “abnormally” terminated. programmer’s mistaken in analysis of program
she or he is trying to solve. such errors are
called logical errors.

Problem solving methodology and Testing and Debugging


techniques

 Understanding the problem well.


 Testing is the process of finding errors in a program,
 Analyse the problem. and debugging is the process of correcting errors
 Design the problem by found during testing process.
 Deciding the step by step solution.
 Breaking down solution into
smaller steps.
 Code the program.
 Test and debug your program.
 Complete your documentation.

5
Modules of Documentation
Documentation  Modules makes information more easily
accessible to the specific user for which they
 Documentation refers to written descriptions
were prepared , and reduce the cost of
specification ,design ,code and comment , internal production and maintenance.
and external to a program more understandable ,  The documentation modules are generally
readable and more easily modifiable.
referred to as manuals .
In detail it depends upon
1.Complexity of system
2.Technical sophistication of user
3.People involved in development and use

List of Manuals User documentation info


 General descriptions
 Run flow and description
 Logic flow
 User manual
 Program testing's
 Input Preparation Manual  File description
 Operation Manual  Record layout
 Equipment Manual  Output specification
 File disposal
 Programmer Manual  Error messages
 System Manual  Security concerns
 Standards Manual  Restart and recovery

6
Programmer’s documentation What is external
documentation?
 The programmer’s Manual provides the technical part The external documentation of a program consists of
of documentation. This manual is essential because it the written information that is outside the body of the
is the basis of maintenance. source code.
It may contain specifications of the history of the
It is of two types,
program’s development and subsequent modification.

1.External documentation.
2.Internal documentation.

What is internal What is self documenting


documentation? code?
The internal documentation includes
comments , self documenting code and  It is a code that uses meaningful names for constants,
program’s formatting . The goal of this features variables & subprogram
to make program readable,
understandable , and easily modifiable.  Identifiers to clarify their meaning in the program.

7
Program maintenance
Program maintenance
 Program maintenance refers to the modification of a
program , after it has been completed . There are four kind  Adaptive maintenance
of maintenance. To accommodate changing needs , time to
 Corrective maintenance time , maintenance is done and is called
adaptive maintenance.
Some errors might show up because of some unexpected
situations , untested areas these errors are called Corrective For example new government may need to
maintenance. process new reports or market conditions etc.

How to develop information that


Program maintenance are easy to maintain?

 Preventive maintenance 1.The systems should be planned with an eye on the future.
If possible errors could be anticipated , before they 2.User specification should be correct.
actually occur, the maintenance could be done to
avoid them and the system down time( time for 3.The system should be modular
which system remains out of order) can be saved. 4.Documentation should be complete.
This type of maintenance aims at preventing errors is
5.Standereds should be followed.
called program maintenance.
6.Testing should be through.

8
How to develop
drawing flowchart to
information that are easy
to maintain?
represent solution
7.Adeqate time should be allowed for development cycle. i. Area of a circle
8.Attetionshould be paid to end-users , health and human ii. Draw a flowchart that would do the following
factors should be considered. Input employees name and basic salary
9.The development team should be fully aware at the -Calculate and display employees tax at 20% if basic
relationship of system design and system maintenance. salay is more than Kshs. 100,000, and at 15% if basic salary
is less than Kshs. 100,000.
-Calculate and display net salary of the employee

EXERCISE 1 EXERCISE 2
a) Write a C program to implement the above flowchart (4 marks) a) Define the following terms citing example in each case.
b)Justify the need for programming methodology in computer science? i) Programming (2 mark)
(2 mark) ii) Algorithm (2 mark)
iii) Variable (2 mark)
c) Differentiate between the following iv) Sequence (2 mark)
i) flowchart vs pseudocode (2 marks) v) Repetition (2 mark)
ii) source code vs object code (2 marks)
iii) selection vs repetition (2 marks) b) Briefly discuss the principle of structured programming.

d) Explain the programming process that one would adopt in order to c) Explain various kinds of documentation in programming
develop a suitable program (8 marks)
c) Using an example, explain how you could cause syntax error.

You might also like