Sunday, April 26, 2009

ICS 499: Milestone 6.1 and Work Improvements

Introduction
The team was given a reprieve for Milestone 5 and was given an extension for Milestone 6 which I am calling 6.1. The Scoreboard has progressed quite nicely and is ready for display. Got into a jam with the sorting of a Map. Quite a productive week for the Devcathlon project.

Scoreboard
The Scoreboard is fully functional and takes live data via the Initialization class.
  • All active matches
  • All users in a match
  • Match scores, events, and comments
There are some cosmetic issues that need to be address with the headers in the events panel and scores next to names. I think the Scoreboard is about 90 percent complete.

Sorting a Map
The last major hurdle of the scoreboard was to implement a top performers panel. The panel displays the top point getters of a match. To associate scores to users I employed a map to store the points. Now it makes no sense to display points arbitrarily the tallies should be in descending order. But sorting values from a Map is not a simple task. A magical method to sort a Map does not exist in the API. I had employ a TreeSet to sort the values and then used points as a keys to associate a user to a score.
    List userScores = new ArrayList(userScoreMap.values());
    TreeSet sortedSet = new TreeSet(userScores);

    Object[] scoreArray = sortedSet.toArray();
    
    List scores = new ArrayList();
    
    int size = sortedSet.size();
    
    for (int i = size - 1; i >= 0; i--) {
      scores.add((Integer) scoreArray[i]);
    }
The code is not pretty and it maybe prone to buginess. I will be working on improving the Map sorting algorithm in the next Milestone to conjure something more elegant.

Group Improvement
Up until last Monday April 20th the group was limping along in fact there were issues with presenting Milestone 5. After going through group therapy with Professor Johnson which, I felt was beneficial for everyone. I saw improvements in all facets of development: communication, coding, and team morale. I feel like that I am part of a team and Devcathlon will be completed by the end of the semester.