how to get started
The biggest problem students have in 126 is getting started on
programming assignments. Here are some recommendations. If you are a
beginning programmer, it's probably a good idea for you to stop by my
office to discuss the problem of 'getting started' so that you're
more comfortable with the assignments.
- Get the checklist for the assignment (found on the course web
page)
- Read both the checklist and the instructions in the course
packet before Friday precept, which is when I'll usually introduce
and explain the upcoming programming assignment.
- Write code on paper. It's a good idea to write pseudocode
first so that you have a 'rough draft' of your program before you
start typing anything. See writing
programs for more detailed information.
- Step 0 of the checklist usually has important preparation
steps. Don't forget to do this.
- Break the assignment into very small steps, much smaller than
any 'parts' indicated in the assignment. Carefully test and debug
each small step before going on to the next. For example, in the
first programming assignment, try to write a small piece of code
that reads in a number and prints that number of asterisks. When
you get that to work, then try to write plot.c, a program
which reads in a series of numbers and prints a corresponding
number of asterisks for each one.
- Write printf statements throughout your code that print
the values of critical variables. For example, you might want to
print the value of a variable that changes each time through a
loop to make sure the loop's doing what you want it to.
- Invent test data that will help you find special cases.
- Name your variables well: the names should describe the
purpose of the variable. If a variable is being used to count
something, call it 'count.' If it holds the result of a series of
additions, call it 'sum'.
- Most importantly, if you feel lost at the beginning of
the assignment, get help from me. When I explain the programs in
precept, it's usually very rushed. If you can, arrange to sit down
with me so that we can go through the steps in great detail. At
the very least, send me email with any questions you have.