- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Chapter 9 Building Bigger Programs.ppt
Chapter 9: Building Bigger Programs How to Design Larger Programs Building something larger requires good software engineering. Top-down: Start from requirements, then identify the pieces to write, then write the pices. Bottom-up: Start building pieces you know, test them, combine them, and keep going until you have your program Debugging: Programming is “the art of debugging a blank sheet of paper.” Testing: Because nothing complicated and man-made is flawless. Maintenance: By far, the most expensive part of any program. Top-Down Design Start from a problem statement.What are you trying to do? Refine the problem statement.Use hierarchical decomposition to define subparts. Refine until you know how to write the programs. Use procedural abstraction so that higher-level functions are written in terms of lower-level. What’s an Adventure Game? Text-based, interactive fiction. Dates back to 1970’s: /wiki/Colossal_Cave_Adventure See Zork at /watch?v=1q9Q2gwqw7Ufeature=related Play Zork at http://pot.home.xs4all.nl/infocom/zork1.html There are new and updated tools for making interactive fiction like Inform, Example Top-Down Design:An Adventure Game Top-level function: Tell the user how to play the game. Describe the room. Get the player’s command. Figure out the next room. Return to Step 2, until the user Quits. Two new functions printNow(): Takes a string as input, and prints it on the Command Area immediately. Print waits until the program is done. requestString(): Takes a prompt string as input, accepts a string from the user in a dialog window, then returns the user’s input. An important new loop How do we keep going, indefinitely, until the user says “quit”? A while loop repeats a block until a test becomes false. Writing the top level function def playGame (): location = Porch showIntroduction () while not (location == Exit) : showRoom(location) direction = requestString(Which direction?) location = pickRoom(direction , location) Working directly fro
您可能关注的文档
- 9. OOP & ADTs Introduction to Inheritance.ppt
- 9. SYSTEM INTEGRATION.ppt
- 9. TCPIP.ppt
- 9. Transformações de fases em metais e microestruturas.ppt
- 9.1 正弦波振荡电路的振荡条件.ppt
- 9.2 单项式与多项式相乘.ppt
- 9.3 数据流分析的基础.ppt
- 9.雷锋叔叔和我们在一起.ppt
- 90后毕业生拒订盒饭.ppt
- 96学年度日间部四技英语能力测验.ppt
- Chapter 9 Cinema in an International Frame.ppt
- Chapter 9 Congress.ppt
- Chapter 9 continued Evolution and the Human Life Cycle.ppt
- Chapter 9 Global Inequalities and Poverty.ppt
- Chapter 9 Inheritance and Polymorphism.ppt
- Chapter 9 Inventories – Additional Valuation Issues.ppt
- Chapter 9 Morphological Image Processing.ppt
- CHAPTER 9 OUTLINE.ppt
- Chapter 9 Pipeline and Vector Processing.ppt
- Chapter 9 Questions.ppt
文档评论(0)