Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
113 views

Chapter-14 Programming Methodology

The document discusses several topics related to programming methodology: 1. Stylistic guidelines like using a modular approach, meaningful names, clarity, comments and indentation help develop good programming habits. 2. Characteristics of a good program include being effective, efficient, user-friendly, self-documenting, reliable and portable. 3. The stages of program development are cracking the problem, coding the algorithm, compiling, and executing the program.

Uploaded by

OP RUDRA
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)
113 views

Chapter-14 Programming Methodology

The document discusses several topics related to programming methodology: 1. Stylistic guidelines like using a modular approach, meaningful names, clarity, comments and indentation help develop good programming habits. 2. Characteristics of a good program include being effective, efficient, user-friendly, self-documenting, reliable and portable. 3. The stages of program development are cracking the problem, coding the algorithm, compiling, and executing the program.

Uploaded by

OP RUDRA
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/ 5

14 Programming Methodology

INTRODUCTION
The program representation refers to its presentation style so that the program becomes more
readable and presentable. A program which is easily understood can easily be checked for
errors, if any , and easily modified.

Stylistic Guidelines
Developing good programs is a skill and writing good program is a quality
habit. This good habit can be developed by consciously following the guidelines.
1. Modular approach to programming
In modular approach always break a big program into
smaller program called modules and this is called modular approach to programming.
2. Meaningful Names for identifier
Identifiers identify different parts of a C++ program or script.
Therefore identifiers should have meaningful names.
3. Ensure clarity
Expression carries out the specified actions. Thus they must
be clearly understood by the users.
4. Use Comments and indentation
Comments play a very important role as they provide
internal documentation of a program. Indentation makes the statements clear and
readable. Though indentation is not mandatory in C++ but indentation makes clear
readability of the code.
5. Statement formatting style
C++ is one of those languages which provides use of free
formatting style i.e any number of statements can be written in one line using a
statement separator.
Characteristics of good program
A program written in good style is easily understandable to a reader then we can
say, that program is a good program. A good program not only efficiently solves the given
problem but also presents itself well. There are following characteristics of good program:
i. Effective and efficient
ii. User friendly
iii. Self documenting code
iv. Reliable
v. Portable
Stages of program development process
A program development process is step by step process where each stage
contributes to building of an effective and efficient program. There are four stages in a
program development process:
i. Crack the problem
ii. Code the algorithm
iii. Compile the program
iv. Execute the program
Role of compiler
The part of compiler’s job is to analyze the program code for correctness. If the
meaning of a program is incorrect then a compiler can certainly detect errors if a program
contains some illegal operations or some grammatical mistake.
There are following types of errors:-
i) Syntax error :- Syntax errors occur when rules of a programming language are misused
i.e. when a grammatical rule of a C++ is violated.

e.g.-
#include<iostream.h>
#include<conio.h //syntax error
Void main() //Syntax error
{
clrscr() //syntax error
cout<<”Welcome to URL INSTITUTE\n; //syntax error
getch();
}

ii) Semantic error :- Semantic errors occurs when a statement are not meaningful.
Semantics errors to the set of rules which gives the meaning of a statement.
e.g.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a=3,b=6,sum;
a+b=sum; //semantic error
getch();
}
iii) Type error :- Data in C++ has an associated data type. If a data is assigned in another
type of data type variable then this type of error is occurred by the compiler is called type
error.

e.g.

#include<iostream.h>
#include<conio.h>
Void main()
{
clrscr();
int a;
float b=3.14;
a=b; //type error
getch();
}
iv) Logical error :- A logical error is that error which causes a program to produce incorrect
or undesired output.

e.g.

#include<iostream.h>
#include<conio.h>
Void main()
{
clrscr();
int a =3,b=4,sum;
sum=a*b; //logical error
getch();
}
In the above program we want to addition of two numbers but we get
multiplication of two numbers. This type of error is called logical error.

v) Run time error :- A run time error occurs during the executions of a program. It is
caused of some illegal operation taking place.
e.g.
#include<iostream.h>
#include<conio.h>
Void main()
{
clrscr();
int a=3,b=4;
float d;
d=(a+b)/(3*b-4*a);
cout<<d;
getch();
}

Documentation
Documentation refers to written descriptions, specifications, design, code
and comment, internal and external to a program , which make a program more
understandable , readable and more easily modifiable.
Program Maintenance
Program maintenance refers to the modification of program, after
it has been completed, in order to meet changing requirements or to take care of errors that
show up. There are following maintenance:
i. Corrective Maintenance
When a program after completion some errors occurs
because some unexpected situations then such type of error fixed up and this type of
maintenance is called corrective maintenance.
ii. Adaptive Maintenance
To changing needs, time to time maintenance is done is called
adaptive maintenance.
iii. Preventive Maintenance
If possible errors could be solved before they actually occur,
because this type of maintenance aims at preventing errors is called preventive
maintenance.
iv. Perfective Maintenance
If the existing system is updated with new features , new
facilities, new capabilities then it is said to be perfective maintenance.

Algorithms
The finite number of steps to solve any particular problem is known as
algorithm.

Flowcharts

You might also like