Sunday, November 27, 2011

Hale-Aloha Pichu

WattDepot is an open source web service that will collect energy usage from the places where the meters are installed. Previously I implemented a total of six katas to get an initial understanding of how to retrieve data from the servers, and how some methods works; description of the katas can be found at this link Watt_Monitor. This time I am fortunate to have two great team members to assist in implementing a console base program to have people interact with retrieving information from the servers.

My team members and I initially had no clue of how the program should behave. We did not know how we can access a class based on the name of a command entered by the user. We even had no clue of what we were suppose to test. At that moment it felt like how are we suppose to accomplish this project, but I’m glad it is a group project because it made us realized that we were thinking too much at once. Therefore, we decided to first start off by getting the parts that we got assigned (parts were assigned by the group) to work. It ensures that at least we have something to focus on as a starting point.

My group’s program functionality is to start off by automatically connecting the user to the server at Hale Aloha. After connection has been established, the user can enter a command and the parameters to retrieve specific information from the server. For example, if the user wants to retrieve information about energy usage of a certain date he/she can type in the following: daily-energy Ilima 2011-11-23 where daily energy is the command, and both Ilima and the date are the parameters. If user is using the program for the first time, he/she is able to learn how to use it by typing the command “help” to display descriptions on what each available command does.

We also tried to research and implement the program by using Java Reflection to access the other classes in the program but from different packages. What is Java Reflection? It is just a feature in Java which examines and manipulates the properties within the program (Java_Reflection).

Through this project, which involved cooperating with partners, I learned that communication is a major criterion in getting the project done. By communicating among each other we were able to contribute ideas and create a program that actually was better than what I imagined initially. In my point of view my group did had communication problems due to each team members thinking differently of how some features should work. Also, one team member didn’t keep in contact with the other team members. Overall, it was a good experience because it taught me how to tackle the problem of communication problems for future projects that involves partners.

           
             

Monday, November 7, 2011

Watt Monitor


            I have been at University of Hawaii at Manoa for five years and I have seen many signs encouraging people to recycle or save gas by riding bikes or TheBus. Due to this project call WattDepot, I get to know that the school is doing much more than just posting signs. WattDepot is an open source web service that will collect energy usage from the places where the meters are installed.

            For this past week I had work on the following six katas:

·         1. List sources and the description
·         2. Latency of the sources
·         3. List sources and subsources in a hierarchy format
·         4. Get energy from the previous day
·         5. Get the highest power of each source
·         6. Get average energy used in the previous two Mondays

The first three katas was pretty straight forward of retrieving the latest data and displaying in nice aligned format. Once I got past the third kata problems started because of having to utilize the methods of WattDepot to get the information specified for the particular kata.

            In kata 3 the requirement was to retrieve energy data from “yesterday”, the initial problem was my understanding of the range of data to retrieve. I misunderstood “yesterday” as retrieving data from one point at the current day to the same point of yesterday. For example, if I were to access data from 11:00 p.m. today then the end point would be 11:00 p.m.  Of course I was incorrect because “yesterday” actually means to retrieve data from the yesterday’s 12 a.m. to 11:59 p.m. To accomplish this I learned how to use Calendar class in Java to set the range of time and perform calculation to get yesterday’s date. This kata allowed me to see how much energy are used in one day at the dorms where the sensors are placed.

            The other kata that I had problem is kata 6. Initially I had the problem of figuring how can I calculate or set the day to the previous two Mondays from the current day. To solve this problem I wrote a separate code to test how Calendar works. Turns out that Calendar.DAY_OF_WEEK will return an integer value indicating the day (e.g. 1 for Sunday, 2 for Monday and so forth). I check the day of the week and return value of how many days to subtract to get the first Monday. Then I double the value to get the second Monday.

            This project gave me an experience that none other projects ever gave me. It allowed me  to have a feeling of how it is to pick up a project and implement code with only some description on the site (WattDepot) of how to write certain code. The rest relies on my Java skills and research of how to use certain built in classes that I sometimes don’t get a chance to use. It also allowed me to see what the school is doing to help people understand the importance of moving away from our reliance on oil to produce electricity.