Here are guidelines for designing programs that are correct, user friendly and programmer friendly.

Correctness  :  works correctly

The program should produce correct results.

Run the program using required test cases. Thoroughly test by designing appropriate test cases. These should include typical test data and unusual or boundary cases. Use test data that executes all possible statements in the program. Compare the program’s results with manually calculated results.


User Friendliness : well designed to satisfy the needs of the user

The user interaction (“i/o” - keyboard input and screen output) must be exactly as specified. Pay attention to exact spelling of words, use of uppercase, lowercase, spacing and alignment of output. More generally, refers to being well designed to satisfy the needs of the user (eg: including handling invalid data)


Programmer Friendliness : well designed to satisfy the needs of the programmer

The program should be easy for you and others to understand and maintain (ie, change to fix bugs, or to add new features). Your program should:

- start with a program comment:


  File:    rectangle.c

  Purpose: Calculate perimeter and area of a rectangle 

  By:      Lew Baxter

  Date:    2010-09-02


- include comments to briefly describe all major processing steps

- use descriptive names for variables

- indent and align all statements inside: functions (eg: main), if/switch statements, and while/do/for statements. Use 3 or 4 spaces.

- use spaces (around operators, keywords, …) and blank lines to improve readability

- use simple, easy to understand logic: neither complex nor obscure.

- do not use "magic constants" (eg: GST_RATE is better than 0.05)

- initialize all appropriate variables

- be efficient: avoid unnecessary processing

         use if/else correctly

         avoid duplication of code by “factoring out” the common code

         avoid blocks of similar code by using functions with parameters