Layout and Style
description
Transcript of Layout and Style
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?
Which style is better?
Which style is better?
ReadEmployeeData(maxEmps,empData,inputFile,empCount,inputError);
ReadEmployeeData(maxEmps, empData, inputFile, empCount, inputError);
Good or bad?
Good or bad?
Good or bad?
Good or bad?
Good or bad?
// comment zeroCodeStatementZero;CodeStatementOne;
// comment oneCodeStatementTwo;CodeStatementThree;
// comment zeroCodeStatementZero;CodeStatementOne;// comment oneCodeStatementTwo;CodeStatementThree;
Good or bad?