Sunday, April 8, 2012

Exercises 7.1-7.3 and Team Meeting

Before I go into the exercises, there was apparently a bug (intentional?) in the 2.0 source code for Homebase.  After getting the unit tests up and running, I kept getting this error from the testMonth class whenever it tried to test the RMHdate class.  I little digging revealed that where testMonth imported RMHdate as a requirement, the 'd' in date was capitalized.  I fixed the bug and then all the tests passed.  Anyway, now on to the exercises!

7.1

This exercise is about going through the database tables and making sure they all satisfy normalization criteria.  More specifically criterion 5 and 6 from the book.  Here is an explanation of each criterion and an example that violates it from the project code:

  • Criterion 5 - Every entry in the table has exactly one value of the appropriate type.  dbSchedules easily violates this one by allowing multiple values into the table under the persons (notice the plural?) column.  When populated in sandbox mode, several entries have two people available for one slot.  
  • Criterion 6 - No attribute in the table is redundant with the primary key.  The dbPersons class violates this by using a person's first name and phone number as the primary key.  This is a redundancy as both these attributes exist elsewhere in the table.  A better primary key be the person's ssn# or a specifically assigned unique volunteer id.
7.2

This exercise is about developing further the dbShifts module by adding the following functions: get_shift_month, get_shift_day, get_shift_year, get_shift_start, and get_shift_end.  This exercise proved to be a really neat little mini-project to implement.  Basically what you are doing here is taking in the $id as a parameter, then slicing and dicing the $id to get the month, day, etc.  Php's built in 'explode' function (thanks for the hint Mario!) was a HUGE help in making this happen.  When you invoke the function, all you have to do is pass in a delimiter (a dash in this case) and it breaks up the string into the components that you need.  I also added some tests to the testdbShifts class to check everything still worked.  The other tests that were already present in the module served as a good starting point, and all that was required was to pass in a created id and assert that it was true that  a particular string was (month, day, etc.) was extracted.

7.3

Here the book is asking for the creation of a completely new module for the project.  The module that is to be made is called dbMonths (kinda like the dbWeeks class) and will be used to pull an entire month's worth of information from the database and then sent to the GUI for display.  A good starter for this is found in chapter 6, where the authors have already included the needed fields and constructor.  But, as stated earlier, the requirements for dbMonths are very similar to what is already available in the dbWeeks class, so I pretty much copy and pasted the dbWeeks module and then made the required changes.  I also created a new unit test for the module to test the constructor and functions.  After creating the new test and running it i kept getting some serious errors that baffled me for a while.  I finally figured it out.  What I forgot to do (even though the book explicitly says to do so) was add dbMonths to the dbInstall script, so that the new module can be created and added to the database.

Team Meeting

Today's meeting was really productive and we were able to pretty much complete our poster for the upcoming poster session.  Being Easter only me, James, and Matthew were able to attend the actual meeting, but a lot was accomplished despite of this.  The poster consists of sections containing an overview of the project, the lessons that we learned during the course of the semester, and how we specifically contributed to the project.  These sections are supplemented by screen shots of patches and wiki pages that we submitted, as well as a timeline of the xbmc release cycle that we found ourselves in the middle of when starting the project.

No comments:

Post a Comment