Layout and Style

12
Layout and Style Chapter 31

description

Layout and Style. Chapter 31. O utline. 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; } . - PowerPoint PPT Presentation

Transcript of Layout and Style

Page 1: Layout and Style

Layout and Style

Chapter 31

Page 2: Layout and Style

Outline Laying Out Control Structures Laying Out Individual Statements Laying Out Comments Laying Out Routines Laying Out Classes

Page 3: Layout and Style

Which style is better?if ( expression ) one-statement;

if ( expression ) { one-statement; }

Format single-statement blocks consistently

Page 4: Layout and Style

Which style is better?

Page 5: Layout and Style

Which style is better?

Page 6: Layout and Style

Which style is better?

ReadEmployeeData(maxEmps,empData,inputFile,empCount,inputError);

ReadEmployeeData(maxEmps, empData, inputFile, empCount, inputError);

Page 7: Layout and Style

Good or bad?

Page 8: Layout and Style

Good or bad?

Page 9: Layout and Style

Good or bad?

Page 10: Layout and Style

Good or bad?

Page 11: Layout and Style

Good or bad?

// comment zeroCodeStatementZero;CodeStatementOne;

// comment oneCodeStatementTwo;CodeStatementThree;

// comment zeroCodeStatementZero;CodeStatementOne;// comment oneCodeStatementTwo;CodeStatementThree;

Page 12: Layout and Style

Good or bad?