Tuesday, April 15, 2014

Chapter 7

This week we were assigned exercises from Chapter 7 in our text, Software Development.

7.1 Not all the tables in RMH Homebase satisfy all six database normalization criteria. For example, dbDates doesn't satisfy either criterion 5 or criterion 6. Give another example of how a RMH Homebase table violations normalization criteria 5. Give another example of how a table violates criterion 6. Explain why either of these anomalies can cause a problem - create more programming work or introduce an error - when updating one of these tables.

What are the six database normalization criteria?

  1. The rows can be rearranged without changing the meaning of the table.
  2. The columns can be rearranged without changing the meaning of the table.
  3. No two rows of a table are identical.  This is often accomplished by defining one column whose values are mutually unique.  This column is known as the table's primary key.
  4. No row has any hidden components, such as an object id or a timestamp.
  5. Every entry in the table has exactly one value of the appropriate type.
  6. No attribute in the table is redundant with the primary key.

The persons field of dbSchedule violates criterion 5 by allowing multiple values to be inserted.  When you try to query an entry with multiple values, this creates more complexity than is needed and can have unwanted side effects.  It is better to keep things as straightforward, organized, and simple as possible.

The id field of dbPersons violates criterion 6.  This field combines the first_name and phone1 fields creating redundancy and causing the primary key to be non-unique.  If, for example, a father and son (John-senior and John-junior) who not only share the same first name, but also the same phone number, are entered into this database and a query is run- it would result in two records that would try and use the same id value- what a mess!

7.2 Develop and unit test the functions get_shift_month, get_shift_day, get_shift_year, get_shift_start, and get_shift_end for the dbShifts.php module that are called by the new get_shift_name_from_id function shown in Figure 7.14.

For this exercise, I consulted with my Team FOSSils.

The first step to this exercise was to modify the get_shift_name_from_id function to the following:

function get_shift_name_from_id($id) { 
     $shift_name=date("l, F jS, Y", 
         mktime(0,0,0,get_shift_month($id),get_shift_day($id),
         get_shift_year($id))); 
     $special_cases = array ( 
         "night" => " night shift", "chef" => " guest chef"); 
     if (array_key_exists(substr($id, 9), $special_cases)) 
         $shift_name = $shift_name . $special_cases[substr($id, 9)]; 
     else{ 
         if (strpos($id, "Fam") !== false) 
             $shift_name = $shift_name . " Family Room "; 
         $shift_name = $shift_name . " from "; 
         $st = get_shift_start($id); 
         $et = get_shift_end($id); 
         $st = $st <12 ? $st . "am" : $st - 12 . "pm"; 
         if ($st == "0pm") 
             $st = "12pm"; 
         $et = $et <12 ? $et . "am" : $et - 12 . "pm";
         if ($et == "0pm") $et = "12pm"; 
         $shift_name = $shift_name . $st . " to " . $et; 
     } 
     return $shift_name; 
}

To implement the rest of this exercise, I decided to create some simple getters for the functions to be tested such as:

function get_shift_month($id) {
    return substr($id, 0, 2);
}

We then made up some simple assertion unit tests like the following:

$this->assertTrue(get_shift_month() == "01");
$this->assertTrue(get_shift_day() == "01");
$this->assertTrue(get_shift_year() == "01");

Exercise 7.3 – Design, implement, and unit test the changes to the database modules required by the new feature Item 4: Calendar month views in the "wish list" described in Appendix B.

After having read this question multiple times, consulting Appendix B, AND attempting to modify dbWeeks implementation; I have come to the conclusion that this is an impossible exercise.  I am planning on consulting with my fellow students in class.



Tuesday, April 8, 2014

Chapter 6

This weeks blog revolves around Chapter 6 in our text Software Development.

1) For the Person class, define a new pair of functions to set and retrieve the value of the variables $employer, $contact_person, and $contact_phone in preparation for implementing new features 1 and 9d in RMH Homebase.

First add the variables to the person class:

private $employer;
private $contact_person;
private $contact_phone;

Then we create the getters: 

function get_employer(){
    return $this->employer;
}
function get_contact_person(){
    return $this->contact_person;
}
function get_contact_phone(){
    return $this->contact_phone;
}

Then we create the setters: 

function set_employer(emp){
    $this->employer=$emp;
}
function set_contact_person(cPerson){
    $this->contact_person = $cPerson;
}
function set_contact_phone(cPhone){
    $this->contact_phone = $cPhone;
}

2) Add four new parameters and corresponding assignments to the constructor for the Person class, so that the status, employer, contact person, and contact person's phone are properly initialized. Use the following prototype for your new constructor:

function __construct($f, $1, $a, $c, $s, $z, $p1, $p2, $e, $t, $status, $employer, $contact, $contact_phone, ...)

function __construct($f, $l, $a, $c, $s, $z, $p1, $p2, $e, $t, $stat, $emp, $cPerson, $cPhone, ....)

$this->status = stat;
$this->employer = emp;
$this->contact_person = cPerson;
$this->contact_phone = cPhone;

3) The set_status function defined in this chapter does not check that the $value passed is valid: either active or inactive. Thus whatever $value is passed becomes a Person's status. Suggest a modification of this function that would perform that check. What value should it assign to a Person's status when the $value passed is invalid? Discuss the unit testing implications of your design decision. 

function set_status($value){
   if (strcasecmp($value,"active") == 0){
      $this->status = $value;
   }
   elseif (strcasecmp($value,"inactive") == 0) {
      $this->status = $value;
   }
   else{
      $this->status = NULL;
   }
}

Test $value as the following:
  • empty value
  • "active"
  • "ACTIVE"
  • "inactive"
  • "INACTIVE"
4) Refactor the existing Person class by removing all the mutators that are not called from anywhere in the code base. Be sure to test your changes by rerunning the test suite. 

I attempted to complete this exercise by using CTRL-F to search for any setter methods.  Unfortunately,   I was unable to find any.   I am unsure how to proceed.

Tuesday, April 1, 2014

Meeting Charleston

Team FOSSil decided to attend Tech After 5 on Tuesday of last week along with Diana from the AM class.  Tech after 5 is an event that is held once a month on a Tuesday.  It is an event for tech professionals looking to network in Charleston, SC.  They also have these events in other major cities in the US.  To attend an event you have to Register online, which is completely free, and then simply show up!  Once you are there, you are to sign-in, grab your name tag, grab a drink (which is also FREE), and start networking.  I really liked that they provided extra stickers that let people know why you were there.  All of us FOSSils had stickers that said "Hire me!".  We spent the rest of the evening schmoozing and speaking with different people.  We talked to some people from Benefit Focus and Blackbaud.  Unfortunately, we saw a lot more "Hire me!" stickers and not more "I'm looking to hire" stickers.  There were so many students...even nursing students??  Not exactly sure why.

It was good experience for all of us to learn how to talk to people and how to engage them.  It can be quite nerve wracking to be in a situation like that, so it's definitely important to practice.  Overall, I think our group did great- we handed out some resumes, got some contact info, and bonded more with each other.  It was a good time and something I'll always remember.

Tuesday, March 25, 2014

Reflections on my progress and plans

On Friday Team FOSSils met to discuss the planning of the poster and looked at examples of what an abstract entails.  We discussed what layout and design we want for the poster.  As far as content goes, we are unsure what exactly we want to include on our poster and which bug fixes we wish to highlight.
We spent part of the meeting discussing what the Django colors are (a very productive use of time).  We want to use their color scheme for our poster.  The dispute was ended when Bobby used the eyedropper tool to tell us exactly what shade of orange and green were being used on their website.  I do want to mention that I was indeed on the winning side of this dispute.  #winning

We submitted yet another ticket fix: #22323, but it was not accepted and the ticket was closed by one of the core developers.  We have also been considering #22161, we are planning on speaking with one of the core developers regarding inconsistent return types.  We shall see.

Tomorrow is Tech After 5, my whole group has RSVP'd so we're ready to get in there and network.  My sister will also be joining us and Diana from the 8AM 462 class will also be there, so we should have a nice little group.

For future meetings, we need to lock down the content of our poster and start fine tuning what we wish to include.

This semester has literally flown by.  I will be on a plane destined for SE Asia in approximately 6 weeks.  SIX WEEKS.  What?!?!  I have only bought my ticket there and back, everything else...I'm just gonna wing it.  I'll be "winging it" for SEVEN adventure filled weeks.  I. Cannot. Wait.  And if I do feel like making some extra cash, I have been approved to "work remotely" for my internship.  Maybe this is what my future looks like?  Traveling to exotic places while working remotely?  One can only hope.


Thursday, March 20, 2014

Planning to Meet in Charleston

Team FOSSils has decided to attend Tech After Five on March 25th at Southend Brewery.  I have actually been to two of these before back in 2013 when my sister was networking for a job.  It's a great place to meet people in the tech community PLUS you get a free glass of wine or beer.  We are planning on meeting at Southend to schmooze and network.  Then we plan on having dinner together at the Blind Tiger which has excellent burger specials on Tuesdays...perfect.  I'm looking forward to it.

Tuesday, March 18, 2014

Release early and often

Release early.  Release often.  And listen to your customers.  We read the Cathedral and the Bazaar earlier in the semester and this happens to be one of the "lessons" Raymond learned from various software development experiences.

Releasing early and often gives great feedback between developers and users which means...

You get bug fixes and and new features in customers hands faster and see how customers react to them.  This is very valuable information for the developers who can work with this information to make a better product and ultimately a happier customer.  In turn, a happier customer makes a happier developer!

Releasing early and often is a way of using customers as co-developers (Free testers!).  And according to Linus's Law-``Given enough eyeballs, all bugs are shallow.''  More heads are better than one.

So if you want happier developers, happier customers, and a better product- releasing early and often is key!

Thursday, March 13, 2014

The Doc is in!

We were to read Chapter 8 in our online text which was entitled "Explaining the Code".  It basically stresses the importance of documentation.  My favorite section was 8.5 and it starts like this, and I quote "Documentation has a reputation as being an easy way to begin contributing to a project. This is more true where the new contributor is already experienced or an expert in the material. It is much less likely to be true where the project has not considered how to enable good and easy documentation, or the technical content is very high."  VINDICATION!  We aren't incompetent- it's just hard!  This whole semester Team FOSSils has been trying to contribute documentation fixes to our open source project Django, but to no avail.  And lets be honest- it's been depressing, but this quote somehow makes me sit up a little straighter and not feel like a complete failure.

We were also to read Chapter 6 in our text.  I'm currently taking CSCI-360 and this chapter goes over  all those concepts we are currently learning.

Exercise 8.1.1
We've been looking at a lot of documentation for Django.  They have a VERY detailed link explaining/instructing how to write documentation for them.  As frustrating as it has been trying to write documentation that is up to their standards- at least they are still allowing us to try and contribute and are always readily available when we have questions.

Exercise 8.4
I do not have enough time for this tonight- this will have to be done at a later date.