最病 A What is Design? a " After reviewing the software development life cycle as understood it, 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 2021/2/12 Nanjing University
2021/2/2 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
最病 A Design Smells 口Rⅰ gidity僵化性→难于修改 口 Fragility脆弱性≯一改便乱 口 Immobility牢固性→难于重用 口 Viscosity粘滞性→做好事难 口 Needless Comp|exy不必要的复杂性 口 Needless Repetition不必要的重复 口○ pacity晦涩性 Institute of Computer Software 2021/2/12 Nanjing University
2021/2/2 Institute of Computer Software Nanjing University 22 Design Smells Rigidity 僵化性 → 难于修改 Fragility 脆弱性 → 一改便乱 Immobility 牢固性 → 难于重用 Viscosity 粘滞性 → 做好事难 Needless Complexity 不必要的复杂性 Needless Repetition 不必要的重复 Opacity 晦涩性
最病 AThe"Copy"Program a Initial Design C void copy It c while((c=rdKbdo)= EoF) ch WrtPrt(c) Read Keyboard Write printer Institute of Computer Software 2021/2/2 Nanjing University
2021/2/2 Institute of Computer Software Nanjing University 23 The “Copy” Program Initial Design Copy Read Keyboard Write Printer char char void copy(){ int c; while ((c=RdKbd())!= EOF) WrtPrt(c); }
最病 A Requirement changes C bool ptFlag= false //remember to reset this flag void Copy(r int C Read Keyboard Write printer while((c=pflAg RdPi Read Paper Tape Rdkbd()=EOF) WrtPrt(c) Institute of Computer Software 2021/2/2 Nanjing University
2021/2/2 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); } Copy Read Keyboard Write Printer char char Read Paper Tape char
最病 A Requirement changes again bool ptFlag= false bool punch Flag= false / remember to reset these flags char void Copy o Read Keyboard Write Printer while((c=(ptFlag? RdPtO RdKbdo)!=EOF Read Paper tape Paper tape punch punch Flag? WrtPunch(c) WrtPrt(c) Institute of Computer Software 2021/2/12 Nanjing University
2021/2/2 Institute of Computer Software Nanjing University 25 Requirement changes again! Copy Read Keyboard Write Printer char char Read Paper Tape char Paper tape punch char 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); }