Tuesday, February 10, 2009

ICS499: Collecting Raw Hackystat Data

Introduction
In order for Devcathlon to be an entertaining game actions of a player and/or team needs to have a score kept. In order to have an accumulation or loss of points Devcathlon needs to receive data from Hackystat. The Hackystat system has a series of Java APIs that helps with the retrieval of raw Hackystat data.

Devcathlon and Hackystat Data
A key component to Devcathlon and probably the whole point to the game is the collection of Hackystat sensor data. Hackystat data is the key mechanism for the automated events in Devcathlon. Through the Hackystat system, software engineering elements such as development time, committing clean build, and keeping coverage high will be tracked for scoring purposes. The Devcathlon development team will build an interface to retrieve sensor data and use the info to tracks scores of Devcathlon Events.

To assist the team Hackystat has a series of APIs to help build the interface. The Hackystat-sensorbase contains numerous classes that when implemented will collect sensor data. As an assignment I need to collect data from a specific date and display the number of times sensor data was sent for each day. I found everything I needed for the assignment in the Sensorbase and Sensor Utilities APIs. I found the APIs flexible where I could get a on handle dates, type of sensor data, and just about anything else within the Hackystat System.

As of this writing I am still working on the code and have only snippets to show. Also, the code is not very exciting its just a main method with a bunch of invocations to collect data.
  SensorBaseClient sensorClient = new SensorBaseClient(host, userId, userPassword);
  sensorClient.authenticate();
  
  String myProject = "Default";
  
  String firstDate = "30-Nov-2008";
  
  XMLGregorianCalendar endTime = Tstamp.makeTimestamp(Day.getInstance(firstDate));
  XMLGregorianCalendar startTime = Tstamp.incrementDays(endTime, -2);

  SensorDataIndex sensorIndex = 
      sensorClient.getProjectSensorData(userId, myProject, startTime, endTime);
The above code logs into the Hackystat system and calls on a date and project.

My only gripe with the Hackystat APIs is sorting through all of the classes. I was a little impatient with having to track down what I needed to know. For example, while researching the Tstamp class I wanted to know if I could pass in a Date instance as an argument. Instead I found another a class called Day which required more research. Of course I found what I needed and was able to retrive the date from Hackystat. I guess its part of the learning process of working with a new API and/or system.

Development Time
Feb 10 Feb 11 Feb 12 Feb 13 Feb 14 Feb 15 Feb 16
Research Time 0.5 1.0 1.5 1.5 1.0 1.0 0.0
Code Time n/a 0.5 1.0 0.0 1.0 3.0 2.0
Blog Time 0.5 0.5 1.0 0.5 0.5 2.5 1.0

Conclusion
Learning a new API takes time to do the research and experiment with the code. I remember an instructor telling me that the actual writing of code is only 10% of the development process. The latest assignment is a good example of research time outweighing coding time.