Wednesday, November 4, 2009

Creating a WattDepot CLI

For my ICS 413 class, we are writing code for the WattDepot-Cli program. WattDepot is a new program that helps people regulate accurate power usage of power plants and homes throughout the island. More information can be found about the WattDepot program here.

In class, we were paired up with another person in our class to create a CLI(Command Line Interface) for the WattDepot program. I was paired up with Shaun Ramento. This assignment was very hard to start off. It took a long time just learning the API of the WattDepot. Just getting simple functions like client.getSource() was troublesome, since the Source class also had many other methods nested in it. After learning the basics of the API, we had to figure out how we were going to implement the CLI(Command Line Interface). We decided to create a new class, that would hold all of our methods in it, and also figure out what commands the user is inputting. The 10 commands that we needed to implement can be found here.

After getting the two simple commands, 'help' and 'quit' done, we started working on the next set of commands. We decided to split up the work on commands 2.3 and 2.4 so we would be able to help each other get used to the API. We then split up the work by the type of commands we will need to access. I took commands that dealt with sensordata and shaun took the commands that dealt with power. Finally, we split up the last two sections of the assignment where I took section 2.9 and Shaun took section 2.10.

After getting about half way through the assignment, our professor told the class that he did not like the way that a certain group was deigning their code. This group had all their methods setup in one java class file. Our professor told the class that these people need to rewrite their code by splitting up their methods and to use an interface. This was a problem, because my partner and I had decided early on to do the commands the same way that he lectured about, which meant that we also needed to change the design of our implementation of the project. Also, the group wrote their code using a lot of System.out.println() which we also did. Rewriting the code to not have these System.out.println() statements caused much time to be wasted since we had to rewrite a good portion of our code to fulfill the standards of the program.

We made a mistake by not writing junit tests while we writing our java code which caused a lot of time to be wasted since we would write code, run the program, then enter code to see if it works properly. This was a huge mistake. Too much time was wasted in this process. We ended up writing our junit tests late, which caused us to waste more time since we had to look over our code to remember what we had to test.

After finding out that we needed to change the design of our project, we decided to finish all of our methods then work on moving the methods around. Unfortunately, we were not able to setup our project in the way that our professor wanted us to, since we had problems finishing the rest of the methods by the Wednesday deadline. So we did not move the methods into their own separate classes and implement an interface. I wish I had more time to understand this interface and creating separate classes. I will most likely look at how other people have implemented this portion of the assignment, since it seems like it is very useful and essential to learn writing code in table-based dispatching form.

Here is the distribution to team eha file.

0 comments:

Post a Comment