Ben Bartlett 10/5/00 V. 2 Original Changes: ================= The change I made to WebDB was to add a table which displays the times of the classes a student is registering for. It appears in the registration card window. It consists of a representation of half an hour time blocks for each day of the school week. If a class which the student has added to his or her card meets during that half an hour, it colors the time block black. If more than one class meets during that half an hour, it colors the block red. That way, it is easy for students who are registering for classes to see when the classes they have signed up for conflict with one another. In order to implement this table, I had to make changes in two modules, DATA_ACCESS.pm and reg_card.cgi. I was hoping that it would be possible to reuse a function in DATA_ACCESS.pm, thinking that perhaps there was a specific function which did nothing but displayed the table, but sadly, this was not the case. Instead, there was a very specific function, current_schedule, which looked in the database for a person's current schedule and displayed both the table and specific information about the person's current classes. I thought this was a rather large oversight in design, as it would've been better to have one function look up the current schedule in the database, and then send that information to two other functions, one which would display the class times table, and one which would display the specific information on the classes. However, as this was not the case, I simply copied current_schedule into a function called registration_schedule, then altered it so that it would get the information for the courses on the student's registration card. I also altered the function so that it would only print out the table of class times, and so that it would color conflicting class times red. For reg_card.cgi, all I had to do was populate the parameters to send to the registration_schedule function (I copied much of this from person.cgi, which calls current_schedule), and then called registration_schedule. Thus, the vast majority of the work was actually done in the DATA_ACCESS.pm module, rather than in the reg_card.cgi module. This project took a great deal longer than the estimation for it suggested. It took me at least 5 hours to design my solution. Much of this was spent just trying to understand the data model for WebDB. Then it took me another 5 hours to code and debug my solution. I think this is due to the fact that the learning curve was high; not only was I unfamiliar with WebDB, but I also know very little about HTML, and nothing at all about JavaScript or CGI. It did help that I was familiar with Perl, however. I think if I had the time to sit down and do this right, however, I'd go back into DATA_ACCESS.pm and split up those functions the way I think they ought to be split up. It would improve their reusability remarkably. I hate having two functions which do virtually the same thing. But, as it is, I have a workable solution, and I've managed to do it within the time required (albeit the adjusted time required), and so I will have to live with it. Summary: ======== Modules Modified: - DATA_ACCESS.pm - reg_card.cgi Time: Design: 5 hours Code: 3 hours Debug: 2 hours The Changes: ============ Last time, I noticed that the functions were not very well modularized. I set about fixing that. I split current_schedule into 3 functions: get_current_schedule, which gets the data from the database, print_blocks, which prints a chart of class times, and print_schedule, which prints the schedule description. I then altered my original function, registration_schedule so that it would return ths same type of information as get_current_schedule, only for whatever classes were on the person's registration card, instead of what classes that person is currently taking. These four functions are located in DATA_ACCESS.pm. In addition, I altered person.cgi and reg_card.cgi to use these new functions in place of the old ones. It is now possible to reuse both the data access functions, and the data display functions. I am much happier with this solution, as it will make any future changes of this sort much simpler. Summary: ======== Modules Modified: - DATA_ACCESS.pm - person.cgi - reg_card.cgi Time: Design: 15 minutes Coding: 1 hour Debugging: 30 minutes