
Layout and Style Chapter 31
Outline • Laying Out Control Structures • Laying Out Individual Statements • Laying Out Comments • Laying Out Routines • Laying Out Classes
Which style is better? if ( expression ) one-statement; if ( expression ) { one-statement; } Format single-statement blocks consistently
Which style is better? ReadEmployeeData(maxEmps,empData,inputFile,empCount,inputError); ReadEmployeeData(maxEmps, empData, inputFile, empCount, inputError);
Good or bad? // comment zero CodeStatementZero; CodeStatementOne; // comment one CodeStatementTwo; CodeStatementThree; // comment zero CodeStatementZero; CodeStatementOne; // comment one CodeStatementTwo; CodeStatementThree;