Wednesday, April 4, 2012

Chapter 7: Modifing RMH Homebase Database

The reading for this chapter is a great precursor to the homework that is due on Friday.  Both the chapter and the exercises deal with cleaning up and modifying the database for RMH Homebase.  And, for me anyway, a lot of the stuff in this chapter is review.  Last semester I took an extremely useful course called Database Concepts (which I recommend every CS student take) that covered all of the things mentioned here.  For the sake of review, which is always a good thing, I'll go over a few key concepts.

The particular DBMS talked about in the chapter is MySQL, which is a relational database.  The authors start out with a little terminology, then dig right into how the database fits into the software stack for the project as the persistence layer.  The software stack that I'm using for the homework is a LAMP stack because I'm running a Linux box.  Then they go through connecting a project to a database, keys, info about tables, and some naming conventions for tables.  Then comes the cool stuff.

Two of the things that makes database design interesting are the aspects of security and integrity.  Straight from the book, here are what a secure database accomplishes:
  • It prevents unauthorized or accidental disclosure, alteration, or destruction of data.
  • It prevents unauthorized or accidental access to data considered confidential to the organization or individual who owns the data.
  • It ensures data integrity, so that the data stored in the database are always valid and accurate.
These conventions can be enforced by granting different types of access rights to specific users.  These rights can include read/write access to database tables and privileges to separate parts of the database itself.

Finally, the last part of the chapter offers some insight on how to ensure that any changes made to the database do not have a detrimental effect, and all functionality remains the same.  As in previous chapters, this involves modification of the unit tests to include those changes and then refactoring.  If a part of the database has been changed or streamlined, then perhaps something in the class that uses that part of the database can also be streamlined or removed.  Coming up...chapter 7 exercises.

Sunday Team Meeting: Prepping for Poster Session

Our team decided that the best use of our time for this week's meeting would be beginning to get ready for the poster session that is coming up this month.  We are all individually on track for our respective parts of the documentation for the project, so this was not an issue that was discussed.

For the poster session, we have to submit an abstract of 150 words or less by April 13th.  This abstract gives a general overview of our project and how we, as a team, contributed and worked on it.  We finished the abstract without too many problems...but then difficulty in respect to the physical poster manifested itself.

Our first idea was to create a google doc that we all had access to, so we could edit simultaneously as ideas popped into our brains.  This turned out to be an unfortunate idea.  What ended up happening was that we created an incoherent mess that didn't flow or make any sense, and looked like what five different people thought it should look like.  What we were experiencing was actually pretty interesting when you think about it.  It is called combinatorial explosion.

Combinatorial explosion refers to the increasing lines of communication as you add individual nodes to a network.  If you have four people, then you will have six channels:

File:4x2.svg

Adding another person, which is the size of our group, increases the communication channels to 10.  So the channels, represented by c, look something like this: c = (n(n-1))/2 for n people.  This is what was happening when we just jumped into all creating the poster at the same time with no central person in charge.

Me and James both had previous experience from creating our poster from last semester.  James did more of the work on last semester's poster, so he was made the de-facto designer of the poster portion of this project.  So now all ideas will go through him while he is creating the template for the poster, and this will reduce the lines of communication from 10 to 4.  Now that this is worked out, hopefully this will be a smoother process!

Friday, March 30, 2012

POSSCON Was Incredible

I would like to reflect today about what a good time I had at the conference on Wednesday.  And not just because of all the free stuff, although the stuff was pretty cool.  Hacker playing cards? Check.  Ubuntu stickers?  Of course.  And a myriad of other neat things.  But the real value in the conference was all of the speakers that came and spoke passionately about open source software.

The first speaker that I went to see was my professor, Dr. Bowring.  He used some of our blog posts to illustrate his approach to teaching a Software Engineering course.  In the first semester, this approach begins with having teams within the classroom pick an open source project they find interesting and testing various components of that project.  For the second semester, which is called the Practicum, the teams up the ante by becoming part of a project's community and contributing something meaningful like patches to the project's code base, plug-ins , and/or documentation.  What this does is make the entire year a capstone project that ties together everything that the student has learned in Computer Science thus far.  I'm really lucky to have been a part of the experience, and encourage other professors to consider using this approach.  It beats just regurgitating passages from a textbook.

The next session that I went to see was by Don Taylor, the CTO from Benifitfocus, who talked about their software stack and how it works.  They have developed a system that allows 3rd party developers to easily customize web pages that they provide as a service.  In fact, that is the essential concept, software as a service.  It is a really interesting concept and is right out there on the cutting edge of what is being done in web applications today.  Also there was a drawing for an ipad...I did not have the winning ticket.

Next up was lunch.  They provided some tasty box lunches as well as a salad bar, and the idea was to take in a BOF (birds of a feather) session while eating your lunch.  So I grabbed a box and headed over to see Jon "Maddog" hall, who was going to talk about Linux.  Jon has been working in the world of professional computing since 1969 and had a thing or two to say about open source operating systems.  And he knows Linus Torvald...on a personal level.  He began by talking about how awesome Linux is, and how quickly it caught on in the early years.  One of the main reasons that it caught on in the first place was the portability to multiple architectures that was built into the kernel early on.  Another reason that it was adopted early on, especially by government agencies, was that because of Linux's relatively small footprint it was easy to parallel multiple machines for the purpose of supercomputing.  Apparently this filled a vacuum left by Cray supercomputers, who went bankrupt in the mid-90's.  Maddog wrapped up by taking questions, one of which was from a 14 year old in the audience.  The question was, why open source and not Apple OS or Windows?  Maddog's response: control.  Open source give you control over the source code that enables a user to customize and fix whatever is needed.  Well said, sir.

The last session that I attended was the presentation by Dr. Steven Brodsky from IBM.  He gave a really cool speech about Big Data and the methods that IBM uses to sort meaning from the 1.8 zettabytes of information that is out there.  One of the techniques that he talked about was called "map reducing" of data.  What happens is that vertical and horizontal slices of large data sets are taken, and then frequency counts are done on those slices.  It is a very quick and efficient way of dealing with these sets.  He also talked about Watson, the supercomputer that beat the two best contestants in Jeopardy history.  Watson uses a process called Deep QA for cluster processing all of the data that was needed to compete on the show.  I actually worked up the nerve to go up and talk to Dr. Brodsky after his presentation, and ask him a little bit about future applications for Watson.  I specifically asked if he thought Watson could ever be used as a diagnostic tool in a medical setting.  While he did not speculate on that possibility, he said that research is being done right now to investigate if Watson could be used as a sort of call-in reference for prescription drug interactions.  And that was it!  My pulse then returned to normal. 

Altogether I mark this off as a great experience that was totally worth waking up at 5am for.  I look forward to attending next year as a software professional instead of a student, and can't wait to see how things change and improve over the next year.

Monday, March 26, 2012

POSSCON 2012

POSSCON, an open source software conference in Columbia, SC, is coming up on the 28th and 29th this week and it's time to do a little planning.  The only day that I have available to attend will be on Wednesday the 28th, so I'll be riding up there in the van bright and early with some of my fellow CS students that day.  As far as planning goes, I have whittled the speakers down to six that I'd like to see.  Realistically speaking, I may only see four if there are other things to see or do.  I'll list them here in order of time-slot...mainly to organize myself for the day:

Jim Bowring 10:00 am - 10:45 am

Dr. Bowring is the professor who is teaching the class that I write this blog for.  His presentation is actually on the class, an upper-level software engineering practicum course, and the benefits of using open source projects as a tool for teaching the material.  As a student in the course, I can probably help with his presentation by providing experienced-based feedback to the audience.

Steven A. Brodsky 1:00 pm - 1:45 pm

Dr. Brodsky is the keynote speaker for the day, and holds the title of Distinguished Engineer at IBM.  Just could not miss this one.  He will be speaking about the Hadoop open source framework, big data, and open source in general.  It will be a real treat to hear what he has to say, and then corner him and speak to him in person!

Jim Jagielski OR Carol Smith 2:00 pm - 2:45 pm

Having a real hard time deciding which one of these I want to check out.  Mr. Jagielski is a SR. Consulting Software Engineer for Red Hat and will be speaking about open source licensing.  Carol Smith is a Program Manager for Google and will be presenting on the Google Summer of Code.  This is going to be a tough one.

Dave Abrahams 3:00 pm - 3:45 pm

Mr. Abraham is a founding member of Boost.org, a site that provides C++ libraries.  His topic will be on...C++!  I'm a big fan of C and C++, and look forward to talking to him.

Chris Hinkley 4:00 pm - 4:45 pm

Mr. Hinkley is a Senior Security Engineer at Firehost, a company that provides secure cloud hosting.  I picked this presentation because I have an interest in web hosting, and it will be cool to see how security figures into everything.

And that's my plan!  I still need to sit down and come up with some talking points for each speaker, but other than that I think I'm ready.  Should prove to be a fun day.

Sunday, March 25, 2012

RMH Homebase Exercises: Editing the "Person" Class

The following exercises are from the SD book They involve editing and refactoring the "Person" class of the RMH Homebase open source project.

Ex. 6.1
This exercise involved adding in some setters and getters for some new instance variables that were added to provide new functionality.  The new variables were $status, $employer, $contact_person, and $contact_phone.
All of the setters look like this:

function set_employer ($value) {
   $this->employer = $value;
}

And all of the getters have this simple structure:

function get_employer () {
   return $this->employer;

Ex. 6.2
Here we are instructed to add our new parameters to the constructor for the "Person" class.  I went in and modified the constructor to include the following variables : $status, $employer, $contact, and $contact_phone.  I then initialized them like this: $this->status = $status; , etc...

Ex. 6.3
This problem presents us with a question of how to handle invalid input.  In the set_status function, there is currently no check in place to determine whether the $value is either 'active' or 'inactive'.  A good way to check this would be with an 'if' statement that would make sure that $value was either 'active' or 'inactive' before setting it to anything.  And if $value was an invalid string, then the best thing to do would be go ahead and set $status to inactive in the 'else' clause.  This way no one is accidentally set as ready to work a shift.

Ex. 6.4
Now that the code has been modified, it is time to refactor and check things out.  This exercise asks to go through all of the setters in the "Person" class that we have been working with, and check and see if they are called from anywhere in the code base.  It then says to remove any that are not used.  Not wanting to physically read through all the php files to do this, I opened up the files on the workbench in Eclipse.  I then went through each setter, highlighting them one by one, and checking the call hierarchy (ctrl-alt-h) to see if they were called from anywhere.  Surprisingly, I could not find a single one being used!  I didn't delete them yet, as I want to make sure I'm doing this right before proceeding. 

Friday, March 23, 2012

SD Chapter 6: Developing the Domian Classes

The author's use chapter 6 of the SD book not only to define what domain classes are, but to also use the example of domain classes to teach a few key lessons about general code improvement.  Those lessons include getting to know a new code base, class design principles, and refactoring.

For getting familiar with a new code base, the chapter begins by going over how to read a design document.  This includes identifying classes, basically looking for 'nouns' (if the code is written effectively), finding the instance variables, and figuring out where the methods and functions are.  After getting this basic feel for the code, they then go into how to actually read the code.  For this, the book lays out three key goals:

   1.  To understand the overall architecture and functionality of the existing software.

   2.  To learn the vocabulary established by the domain classes.

   3.  To identify the extent to which to which the code must be refactored before it can be modified
        to support the functions of the new system.

After a lengthy section on modifying the domain classes, there is this tiny section, section 6.3, which neatly sums up how to design an effective class:

   1.  Is there a need?  In other words, is this functionality already elsewhere in the code base. 

   2. Information hiding...private on those instance variables!

   3. Object integrity.  Basically initializing all instance variables with a constructor.

   4.  Cohesion.  The class should be responsible for only one job.

   5.  Coupling.  Kept to a minimum.

   6.  Accessors.  Or getters.

   7.  Mutators.  Or setters.

And lastly, the book goes over the importance of refactoring.  In this section it talks about removing useless functions in the code base.  Are the setters and getters ever even used?  Is the function either redundant or useless?  If so, get it out if there.  All together this chapter provided a good review of material that every developer should be familiar with and have tattooed on their forearm.

Wednesday, March 21, 2012

Changing Focus

We had a really good team meeting on Sunday regarding our project.  Here are the highlights:

1) Matthew and James received a good response on the bug that they were able to replicate.  Apparently, the bug was a forgotten and dead issue until they got involved.  By posting their success at replicating the bug, they were able to get the developers involved to help solve the issue.

2) I was finally able to get a bug to replicate, on one which involved menu options.  The only problem was that as soon as I got involved in the patch process, one of the developers fixed the problem before i was able to submit the diff.

3) David made some headway with his Wiimote bug.  He was able to use a Bluetooth usb device to connect the Wiimote and test out the user's problem.  Unfortunately, he was unable to replicate this one.

And that ended up being what caused us to initiate a change of focus in relation to our project.  The nature of xbmc causes the complexity of the bugs to range from extremely hard to replicate, like something involving a specific file format or driver, to relatively easy, like the one I had with menu options.  The ones which fit into our scope, easy enough to be tackled in a few days or weeks, are usually solved by developers before we have a chance to.

So in order for us to contribute meaningfully to the project before the semester is out, we decided to go in and clean up the wiki.  The first paragraph of the first page of the wiki is a desperate plea from the developers for assistance.  They need help getting the pages up to date with respect to the newest Eden release.  In addition, there are many pages out there from earlier releases that still need to be updated.  Some of them still point to the old subversion repository, and now the repository is hosted using GIT.  We will be meeting up again on Thursday to figure out who is going to do what.