ISBN : 978-81-963532-2-3 (E-Book) which is difficult to infer from the function’s name and header information, it becomes difficult for anybody trying to understand the code. 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. The rationale that is usually given by these programmers for such multiple uses of variables is memory efficiency, e.g. three variables use up three memory locations, whereas the same variable used in three different ways uses just one memory location. However, there are several things wrong with this approach and hence should be avoided. Some of the problems caused by use of variables for multiple purposes as follows: • Each variable should be given a descriptive name indicating its purpose. This is not possible if an identifier is used for multiple purposes. Use of a variable for multiple purposes can lead to confusion and make it difficult for somebody trying to read and understand the code. • Use of variables for multiple purposes usually makes future enhancements more difficult. 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: A function that is very lengthy is usually very difficult to understand as it probably carries out many different functions. For the same reason, lengthy functions are likely to have disproportionately larger number of bugs. 6. Do not use goto statements: Use of goto statements makes a program unstructured and 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 83 Software Engineering Keerthana P, Manasa KN, Ganga D Bengal
89 Publizr Home