3.6 Clarity

I l @ ve RuBoard

A program should read like a technical paper, organized into sections and paragraphs. Procedures form a natural section boundary. You should organize your code into paragraphs, beginning a paragraph with a topic sentence comment and separating it from other paragraphs with a blank line. For example:

 // poor programming practice temp = box_x1;  box_x1 = box_x2;  box_x2 = temp;  temp = box_y1;  box_y1 = box_y2;  box_y2 = temp; 

A better version would be:

 /*   * Swap the two corners    */  /* Swap X coordinate */  temp = box_x1;  box_x1 = box_x2;  box_x2 = temp;  /* Swap Y coordinate */  temp = box_y1;  box_y1 = box_y2;  box_y2 = temp; 
I l @ ve RuBoard


Practical C++ Programming
Practical C Programming, 3rd Edition
ISBN: 1565923065
EAN: 2147483647
Year: 2003
Pages: 364

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net