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.
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.
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.
- 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.
- Information Hiding:
Try to achieve minimum coupling between the modules using the concept of infom=ramtion 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.
- 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 than its logic can be hard to comprehend and bugs can easily occur.
- Minimise Coupling:
Parameter passing good programming practics, 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.
- I/O behaviour:
All I/O shoul duse a proper format:
- All real number output should be format in decimal form unless scientific notation is approprite.
- All input from the keyboard should be preceded by a prompt telling the user what format is accepted.
- Label all input values.
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.
- Coding Standards and Guidelines
- Blog | Program Vs Software
- Blog | Role of a System Analyst
- Blog | From Monolith to Micro-services
- Blog | Software Engineer Skills
- Blog | General facts about the GATE exams
- Blog | General facts about the Campus Placement Drive
- Introduction to SAS programming
- Why learning C Programming is a must?
- P : A Programming Language
- Socket Programming in C/C++
- Natural Language Programming
- Swift Programming Language
- Which Programming Language to Choose?
- Functional Programming Paradigm
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.