unit_4.1
unit_4.1
Unit-4
- Abhilash Chakraborty
CODING STANDARDS.
1. Rules for limiting the use of global:
These rules list what types of data can be declared global and what cannot.
2. Contents of the headers preceding codes for different modules:
Information contained in the headers of different modules should be standard for an organization.
3. Naming conventions for global variables, local variables, and constant identifiers:
A possible naming convention can be that global variable names always start with a capital letter,
local variable names are made of small letters, and constant names are always capital letters.
4. Error return conventions and exception handling mechanisms:
The way error conditions are reported by different functions in a program
Unit-4 are handled should be
standard within an organization. For example, different functions while encountering an error
condition should either return a 0 or 1 consistently.
- Abhilash Chakraborty
CODING GUIDELINES.
1. Do not use a coding style that is too clever or too difficult to understand:
Code should be easy to understand. Clever coding can obscure meaning of the code and hamper
understanding. It also makes maintenance difficult.
2. Avoid obscure side effects:
The side effects of a function call include modification of parameters passed by reference, modification
of global variables, and I/O operations.
3. Do not use an identifier for multiple purposes:
Programmers often use the same identifier to denote several temporary entities. For example, some
programmers use a temporary loop variable for computing and a storing the final result.
4. The code should be well-documented:
As a rule of thumb, there must be at least one comment line on the average for every three-source line.
5. The length of any function should not exceed 10 source lines: Unit-4
A function that is very lengthy is usually very difficult to understand as it probably carries out many
different functions and are likely to have disproportionately larger number of bugs.
6. Do not use goto statements: - Abhilash Chakraborty
Use of goto statements makes a program unstructured and makes it very difficult to understand.
CODE REVIEW
Code review for a model is carried out after the module is successfully compiled and the all the syntax
errors have been eliminated.
Code reviews are extremely cost-effective strategies for reduction in coding errors and to produce
high quality code.
There are basically types of code review techniques:
➢ Code Walk Throughs
➢ Code Inspection
Unit-4
- Abhilash Chakraborty
CODE WALK THROUGHS
Code walk through is an informal code analysis technique. In this technique, after a module
has been coded, successfully compiled and all syntax errors eliminated.
NOTE: These are not standard guidelines, they are just given as an example.
CODE INSPECTION
The main objective of code inspection is to check for the presence of common types of error that
usually arise in code due to programmer oversight or improper programming.
Following is a list of some classical programming errors which can be checked during code inspection:
•• Use of uninitialized variables.
•• Jumps into loops.
•• Nonterminating loops.
•• Incompatible assignments. Unit-4
In the black-box testing approach, test cases are designed using only the functional specification of the
software, i.e. without any knowledge of the internal structure of the software. For this reason, black-
box testing is known as functional testing.
On the other hand, in the white-box testing approach, designing test cases requires thorough
knowledge about the internal structure of software, and therefore the white-box testing is called
structural testing.
Unit-4
- Abhilash Chakraborty