Get premium membership and access questions with answers, video lessons as well as revision papers.

Explain the characteristics of a good C++ program.

      

Explain the characteristics of a good C++ program.

  

Answers


Kavungya
1. The computer program should solve the target problem.
2. The implementation of the computer program should be free of errors; hence it must work for all valid inputs and must produce the required response.
3. The program should be well documented in order to assist in the understanding or use of a program. This can be of great value not only to those charged with maintaining or modifying a program, but also to the programmers themselves.
4. The program should be maintainable because programs require a continuing process of maintenance and modification in order to keep pace with the changing requirements and implementation technologies. A program is made maintainable by:
i) Dividing the program into modules
ii) Making sure that the program is well-documented
iii) Using symbolic constants: Many programming languages permit the declaration of a named constant, which equates a user-chosen identifier, say, CLASS_SIZE, with a literal constant. Thus, #define CLASS_SIZE 48 will occur, in only one place, namely, the constant declaration. This requires only one alteration to change the value class size throughout the program.
5. The Program must be Robust. This refers to the ability of a program being able to survive various unexpected events, such as incorrect or invalid input data. The following are some guidelines to ensure robustness:
- The input data should always be validated, hence no assumption that the data is always correct.
- Always initialize relevant variables.
- Avoid syntactic constructs that could lead to undesirable interpretation.
6. The white spaces should be used effectively. Most programming languages allow the use of blank lines and spaces embedded within the program code to improve its readability.
Example: Statements such as x = x+1 would be better written as x = x + 1.
7. The choice of identifiers for the names of modules, subprograms, types, variables, and other elements is crucial in producing a readable program. The goal is to use meaningful identifiers which help the reader remember the purpose of an identifier without constantly referring to the declarations or to a variable list external to the program.
Kavungya answered the question on May 15, 2019 at 14:58


Next: Describe the structure of a C++ program.
Previous: Describe the basics of C++

View More Computer Programming Questions and Answers | Return to Questions Index


Learn High School English on YouTube

Related Questions