CS 150 - Prelab 7 - Design
Due: Friday 4/14 at the beginning of lab
(Note: this is not a paired lab — each student must work
individually, both on the prelab and the lab.)
We will be using matplotlib for the lab this Friday. If you
plan on working on your own computer, you'll need to make sure that
matplotlib is installed before lab. Simply type "import
matplotlib" at the python prompt. If nothing happens, you are all
set. If you get an error "No module named matplotlib", you don't have
it, and you'll need install our version of Python. Go to the Resources
section at the bottom of the course home page, and follow the link for
installing Python and Spyder.
If you have trouble getting matplotlib to work, please come
see Ruben or me.
After you are able to import matplotlib, try out some of the simple
examples from class to make sure it is installed properly. You can
also check out the Pyplot tutorial linked from the course page.
As demonstrated in class, it might work better to run your plotting
programs in the IPython console.
I've posted the lab for this Friday on the course web page. Read
through the lab and make sure you understand what the program is
supposed to be doing.
Once you have a good feeling for the program, your prelab for this
week is to write a high-level design for your program. Your design
must include the following information:
As you're putting together your design, think about the following:
- the list of all of the functions you plan on implementing. For
each function, you should include:
- the list of what parameters it will take
- what it will return
- one sentence describing what the function will do (eventually
something like this will end up in the docstring)
- in addition, include description of any other aspects of your
program (e.g., functionality not in functions)
You will be graded based on the detail that you provide in addition to
how well you've thought through the problem. The more time you spend
thinking about the organization of your code, the easier actually
generating the final code will be.
- What is the flow of the program and the flow of information?
What needs to happen first? Second?
- What information will each function generate and how will that
information be used by other functions?
- Keep functions as simple as possible and as general as possible.
- If the function does some computation, don't also have it print
out that information. Instead return it and print it out somewhere
else. This allows you to reuse that function in other situations
where printing isn't desired.
What to hand in
I will collect your design at the beginning of lab on Friday. Since
you will likely want to use your design when programming, you should
have a copy for your own use as well. (Your own copy can be an
electronic version, but must have a hardcopy ready for me to