This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Module 1 Review and Preparations Where have we been? Where are we going? CS 116: Introduction to Computer Science 2 Daniel G. Brown/Troy Vasiga, University of Waterloo 1.1 1 Welcome Purpose of Module 1 • Reminder: What must you know from CS 115 in order to succeed in 116? • Where is the course coming from? • Where are we going to? • Readings: HtDP 1-20 CS 116 is a second course in programming. What didn’t we get to in the first course, CS 115, that you need in order to write useful short programs? 1.2 Major themes from CS 115 • Design: think about how to build good code before you start, and think through the process • Common patterns: rules and patterns that pop up over and over in small and large programs • Verification: test that we have written proper code that accomplishes the task it’s supposed to • Communication amongst 1 or more people, and between people and machines Most of these have nothing to do with Scheme: they’re basic principles about problem solving and computer programming in general. 1.3 Major themes for 116 • Design: as we build larger programs, we ensure that we are building a system we understand and that does what we want it to do. • Common patterns: as we develop several programs, we identify several patterns that are con- sistently useful in “everyday” programming. • Verification: as we develop more complex programs, we check that our programs do what we want them to do. • Algorithms: as we push into new areas, we create new ideas to solve computational problems 1.4 CS 116 is not a course about the languages we use • CS 115 was not a course about Scheme – You used Scheme, but you used it to do useful work: the ideas are fairly universal. • CS 116 is not a course about Python and Scheme 1 – You will use both of these languages to look at how to solve problems with computer programming. – You will also use Python as a quick prototyping and productivity tool, particularly for file input-output. – This can be immensely useful in day-to-day life. • That said, we hope you leave 116 being able to program in Python productively. 1.5 2 Review 2.1 Design recipe Review of what we saw in CS 115 One major theme from CS 115: The design recipe as a tool in problem solving • Data analysis and design: Design a collection of definitions to represent the data that will be used in the program • Function specification: – Identify which functions will be used to solve the problem. – Give a name and English description to each function – Write a contract relating its input and output • Examples: Give examples of the function’s value for certain values of its input. 1.6 Design recipe, continued • Template: Identify a natural pattern for the code that makes up the body of each function • Body: – Fill in the details, figuring out uncertain parts of the template....
View Full Document
- Spring '09
- Computer Science, foldr