Saturday, December 28, 2024
Google search engine
HomeGuest BlogsBlog | Programming Guidelines

Blog | Programming Guidelines

Computer programming is a process of writing an executable computer program for accomplishing a specific computer task. Although writing the programs is an art, however, there should be some minimum guidelines that should be followed while writing programs. 

  1. Name: 
    Define the variable names as per programming language rules. Use proper names for variables i.e, they must indicate their rule in the program. In other words, they should be closely related to the entity they represent and modules name should reflect their activity.
  2. GOTO: 
    Minimize the use of GOTO statements. GOTO should be used sparingly and in a disciplined manner. Only when the alternative of using GOTOs is more complex; then only think of using GOTO statement.
  3. Program Layout: 
    Document the program properly. Avoid meaningless comments. in order to make the program easy to read, use spaces, blank lines, indentation properly. If available, use automated tools like pretty-printers to improve the layout of the program.
  4. Information Hiding: 
    Try to achieve minimum coupling between the modules using the concept of information hiding. This means that the module must behave as blank boxes to each other. It also means that a procedure is defined in terms of its purpose but not how it achieves that purpose.
  5. Cohesive Procedures: 
    The programmer must aim for highly cohesive modules i.e, each procedure of function in the program must perform only a single task. If a procedure handles to many tasks then its logic can be hard to comprehend and bugs can easily occur.
  6. Minimise Coupling: 
    Parameter passing good programming practice, but with too many parameters the code becomes difficult to manage. Procedures with many parameters are highly coupled; they have lots of links to other procedures, where every possible try to minimize these links. However, global variables should nor=t be used instead.
  7. I/O behaviour: 
    All I/O should use a proper format: 
    • All real number output should be format in decimal form unless scientific notation is appropriate.
    • All input from the keyboard should be preceded by a prompt telling the user what format is accepted.
    • Label all input values.
  8. Robustness: 
    Robustness is the ability of a program to recover itself from any error during the runtime. It describes the reliability of the program under extreme conditions.

 

Last Updated :
27 Jan, 2023
Like Article
Save Article


Previous

<!–

8 Min Read | Java

–>


Next


<!–

8 Min Read | Java

–>

Share your thoughts in the comments

RELATED ARTICLES

Most Popular

Recent Comments