&扇 What is Design? 102 21 "After reviewing the software development life cycle as I understood it,I concluded that the only software documentation that actually seems to satisfy the criteria of an engineering design is the source code listings." -Jack Reeves Institute of Computer Software 2022-2-27 Nanjing University
2022-2-27 Institute of Computer Software Nanjing University 21 What is Design? “After reviewing the software development life cycle as I understood it, I concluded that the only software documentation that actually seems to satisfy the criteria of an engineering design is the source code listings.” -- Jack Reeves
&扇 Design Smells 102 22 口Rigidity僵化性→难于修改 口Fragility脆弱性→一改便乱 Immobility牢固性→难于重用 Viscosity粘滞性→做好事难 口Needless Complexity不必要的复杂性 口Needless Repetition不必要的重复 口Opacity晦涩性 Institute of Computer Software 2022-2-27 Nanjing University
2022-2-27 Institute of Computer Software Nanjing University 22 Design Smells Rigidity 僵化性 难于修改 Fragility 脆弱性 一改便乱 Immobility 牢固性 难于重用 Viscosity 粘滞性 做好事难 Needless Complexity 不必要的复杂性 Needless Repetition 不必要的重复 Opacity 晦涩性
&雪扇 The“Copy'Program Initial Design Copy void copy(){ int c; while((c=RdKbd())!=EOF) char char WrtPrt(c); Read Keyboard Write Printer 2022-2-27 Institute of Computer Software Nanjing University
2022-2-27 Institute of Computer Software Nanjing University 23 The “Copy” Program Initial Design void copy(){ int c; while ((c=RdKbd())!= EOF) WrtPrt(c); }
&雪扇 Requirement changes Copy bool ptFlag false; //remember to reset this flag char char char void Copy(){ int c; Read Keyboard Write Printer while ((c=(ptFlag?RdPt(): Read Paper Tape RdKbd())!=EOF) WrtPrt(c); } 2022-2-27 Institute of Computer Software Nanjing University
2022-2-27 Institute of Computer Software Nanjing University 24 Requirement changes bool ptFlag = false; //remember to reset this flag void Copy(){ int c; while ((c=(ptFlag?RdPt(): RdKbd())!=EOF) WrtPrt(c); }
&雪扇 Requirement changes again! 102 25 Copy bool ptFlag false; bool punchFlag false //remember to reset these flags char char char char void Copy(){ int c; Read Keyboard Write Printer while ((c=(ptFlag?RdPt(): RdKbd())!=EOF) Read Paper Tape Paper tape punch punchFlag WrtPunch(c): WrtPrt(c); Institute of Computer Software 2022-2-27 Nanjing University
2022-2-27 Institute of Computer Software Nanjing University 25 Requirement changes again! bool ptFlag = false; bool punchFlag = false //remember to reset these flags void Copy(){ int c; while ((c=(ptFlag?RdPt(): RdKbd())!=EOF) punchFlag ? WrtPunch(c) : WrtPrt(c); }