Software Design Spring 2007 For today, you should have: 1) read Chapter 4 of How to Think 2) read Chapter 2 of the Olinux manual For next time, you should: 1) read Chapter 5 of How to think 2) read Chapter 3 of the Olinux manual 3) work on Homework 2 Early project program --------------------- If you already know some Python, you might want to start on a project early. Starting early will be mostly grade-neutral; it will neither help nor hurt. But it is an opportunity 1) to take on a more substantial project, 2) to make good use of available time at the beginning of the semester, 3) to address some material in software engineering that the rest of the class might not get to. Required elements ----------------- Your project must involve: 1) substantial software design, probably including object-oriented design and possibly including data structure and algorithm design. (rule of thumb, if you have no classes, no inheritance and no recognizable data structures, that's a big red flag) 1') at least one signficant design or implementation decision that you can justify. 2) substantial interface design, involving at least two clearly- identified levels. 3) the development of a program meta-language; a vocabulary for talking about your program. 4) teamwork; you must work in groups of 2-4. I will help coordinate the mating dance, but if you are the odd person out, you might have to wait until the next phase. Many projects will involve: 1) a graphical user interface (because event-driven programming is an important concept) 2) a distributed application (either using one or implementing one) You can build on top of existing libraries, but you should try to stick with common, well-supported ones. Also, you should be building on top of existing libraries, not making substantial changes to them or contributing to an existing project. A successful project might be useful to a wider audience, so you might want to package it and make it available... LATER. Preparing software for distribution and maintaining it is time-consuming and not the focus of this class (roughly 50/50 design and implementation). Examples of past projects ------------------------- 1) synthesis of RSS feeds and graphical display of related threads 2) turtles that paint like Jackson Pollack 3) graphical display of audio signal 4) IM interface to a web proxy 5) networked card game Assume that you will have tkinter and either Pyro or Twisted at your disposal (although we won't get to them for a while, so you might have to read ahead.) Project proposal ---------------- Proposals due next Friday 9 February (or sooner if you want feedback) One page per group, with the following information: a) who's in the group? b) what's the project? 1-3 paragraphs c) what's the minimum/maximum deliverable? d) what's the biggest problem you foresee or question you need to answer to get started? for loops --------- What do the following statements do? for c in 'allen': print c, for i in range(4): print i for statement is an example of a compound statement 1) header ending in : 2) indented body By convention, indentation is 4 spaces. End of body marked by an outdented line. bob = Turtle(world) for color in ['red', 'yellow', 'blue']: print color #inside the loop bob.set_color(color) #inside the loop bob.fd(100) #outside the loop Warmup 2 -------- Most common source of confusion was stray quotation marks. Anything in quotes is a string value. Variable names never have quotes (although we will see exceptions later). So s = 'abcdef' is just fine, but 's' = 'abcdef' isn't. The left side of an assignment is always a variable name. That example is probably no surprise, but it was confusing on the warmup because I gave an example of a function call: cat_all('JKLMNOPQ', 'ack') where the arguments are strings. And then you wrote the function definition: def cat_all('letters', 'suffix'): % BADNESS So I can see why that was tempting. The key things to remember are: 1) when you define a function, you name the parameters, but you don't know their values yet. 2) parameters are variables (not values). 3) when you call the function, you provide arguments, which are the values assigned to the parameters.