Classwork 13: Top-Down Design
Objectives
To complete the top-down design process by implementing the functions outlined in the annual calendar program designed in the previous class.
Assignment
The class will be divided into two teams — one led by Prof. Chang and one by lab assistant Josh Poole. We will use CVS to handle version control and organize the submissions.
Step 1: CVS DemoBefore proceeding, pay attention to the CVS demonstration.
Step 2: CheckoutTo begin using CVS, you must first "checkout" a module. Use one of the following commands, depending on whether you are on teamChang or teamJosh:
cvs -d /afs/umbc.edu/users/c/h/chang/pub/calendar/ checkout teamChang
cvs -d /afs/umbc.edu/users/c/h/chang/pub/calendar/ checkout teamJosh
This will create a sub-directory in your account named teamChang or teamJosh and will copy the initial files into the subdirectory. You will do all your work in that subdirectory, so:
cd teamChang
cd teamJosh
A listing in the directory should show the files:
calendar.c days_in_month.c leap_year.c calendar.h find_next_dow.c print_heading.c CVS jan1_dow.c print_month.c
The main function is in calendar.c:
You can compile the entire program using:
gcc -Wall *.c
However, the functions in the other files are just "stubs" and do not do what they are supposed to do (yet). For example, DaysInMonth() always returns 30 days:
Thus, when you run the program it does not do very much, but at least you have a program that compiles and runs:
linux2% ./a.out This program prints out an annual calendar. Enter year: 2012 xxxxx xxxx Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 xxxxx xxxx Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 xxxxx xxxx Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 xxxxx xxxx Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 xxxxx xxxx Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 xxxxx xxxx Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 xxxxx xxxx Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 xxxxx xxxx Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 xxxxx xxxx Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 xxxxx xxxx Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 xxxxx xxxx Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 xxxxx xxxx Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 linux2%
Discuss with the rest of your team and your team leader who will implement which part. Break up into sub-teams of 2 or 3 students. Each sub-team will work with one of the functions that has to be implemented.
You should only edit the file that you are assigned. You can test your function by compiling the entire program, but you should not edit the other files.
Step 4: Implement Your PartWith your sub-teammate(s) implement your assigned function. Thoroughly test your part before submitting. To submit a new version, you must type in the following CVS commands
cvs update cvs commit -m "student1 student2 student3"
Here you should replace student1 student2 student3 with the names of the students in the sub-team. These are just commments, but it helps us determine who submitted the update.
After you have submitted an update, holler and let the other people in your team know that a new version has been submitted.
Step 5: Getting UpdatesWhen other people in your team submit an update, you can update your own copy of the program from the CVS repository simply by typing:
cvs update
If you have finished implementing your part, continue updating your copy. Test the main program with the latest version of each part. Now you are concerned that your part might not work correctly with new versions of the parts implemented by other students. When this happens you have to discuss the problem with the other students and determine who has to change which part. So, you are not off the hook until the entire program works correctly.
Submitting
There is nothing to submit using the submit command since we worked with CVS. Make sure that you entered the names of your sub-teammates after the -m option of cvs commit. You can check this using:
cvs log filename
where filename is the name of the file you worked with. For example, if you worked with leap_year.c then you can check your submission with:
cvs log leap_year.c