Wednesday, November 30, 2011

Issue-based Project Management

So once again, I found myself working in a group. This time we were developing using issue-based project management under continuous integration. In other words, we tried to split the project into smaller issues that could be completed in a couple of days.  The point of this is to allow everyone to always be working on something without being bottle necked waiting for others.  Also, because issues are small, it's probably easier to not get discouraged looking at the size of the project.  Finally, by splitting everything in to manageable little pieces, we were able to clearly think about how to best split things and keep everything separate and testable.  Because we needed to make sure that everyone always had something to work on, we had to make sure that what we were doing was very modular. Then, because we were doing everything concurrently,we used a project host and continuous integration to make sure that everything kept working and we didn't bump each others' work out.  The hardest part of this for me was keeping up daily with working on issues.  I tend to like to sit down and work all day and then relax afterwards, but dividing things up requires a little work per day over a longer period which is something I still need to work on getting used to.

Getting to the actual project, we were working on a command line interface for use with energy data collected from the Hale Aloha residence halls at the University of Hawaii's Manoa campus.  It can be found here. The project involved creating a simple shell and then making various commands to interact with the energy data given.  We were able to successfully make commands for ranking towers, finding the energy since a certain time, finding daily energy and the current power. However, we had to hard code each command in to a list.  So any additional commands have to be added to that in order to work.  So it wasn't the most elegant solution, but it got the job done and did it in a modular fashion.  New commands are pretty easy to create, and the processor and main interface probably don't have to be touched.  As far as documentation goes, I think we did alright, although because I was working on the project and had a pretty in depth understanding of what we were doing, some things that I thought were sufficiently explained may not have been.  This is where I see the importance of testers who aren't directly involved with the project.

Overall, it was a good experience, and something that I think I need more practice in.  Working with people can be troubling but makes things so much better if you're good at it. <- main lesson for the day

Tuesday, November 8, 2011

WattDepot

Continuing on with the electricity and energy rant from the previous blog post, I started doing some katas on something called WattDepot.  It's a program that centralizes a lot of different monitors and sources to easily look at data and keep track of things.  Because the main program doesn't really care about what the actual monitors use, someone like me is able to connect to the servers and start working with data even though I don't even know how they're getting the information, which makes it really convenient for a lot of reasons.  Not being stuck to one standard that a company decides on is good and lets developers focus on other aspects. Like katas :P

They actually took longer than I thought they would.  There were about five and it took me at least five hours.  But the time spent on each one wasn't equal, and I took breaks. 

The first kata asked to merely print a list of sources that the server is getting information and give a description of them, which is also conveniently provided.  Not only that, there was a sample program with the distribution of WattDepot which showed the basics, basically, I didn't have to do anything for the first one. 

The next one asked for some data manipulation to determine latency based on the given timestamp which was a little more complicated but not too much.  I tried to make a helper class implementing comparable, which seemed to work ok but i'm not sure if there's a better way to do it easily. One thing interesting here though, is that this is basically my first time working with a server that doesn't always transfer in the blink of an eye.  So the way I had it set up first, with a bunch of nested loops, took forever to do and really made me think about how to structure my code to get things working as smoothly as possible, I'm sure i didn't do as well as i could have, but my end results were certainly better than what i started with.  You don't really notice these things when it's the difference between a fourth of a second and a fifth, but because the server was bottle necking things, it helped me out.

The third and fourth were just more complicated forms of the second problem, involving using time and averaging or looking at a bunch of data points.  Again, they took a long time to finish, so instead of just leaving things blank until the output spewed out, I put little messages telling you where the program was, which is something I haven't really had to do before.

The fifth gave me some problems because it involved knowing when the last monday was, given only the current date! Turns out it's a pretty simple problem of using java's implementation of a calendar.  The only tricky thing is that the months seem to go from 0 to 11, so for the longest time, the calendar was giving me the wrong day and i didn't know why.  The day of the month (8th) and the month itself (11th) looked ok, but only when i made it print the actual name did i see that 11 was equivalent to December.  After I figured that part out, the rest was pretty simple, though I saw some areas where i could make my code more efficient.

Overall, these katas were a good learning experience for more real world tasks where things don't just finish super fast.  I haven't really had much practice with optimization and structure so it was especially helpful.  Also, being able to so easily pull up data on the energy and power usage of an actual set of buildings was pretty cool, and probably also helped keep me more interested in katas.  They're pretty fun, and if you want to look at the program, here it is.

Of course, looking at the API for the thing, I see that there are a lot more of advanced features that I didn't even touch, but from a beginner's point of view, even just this is pretty good. That's all for today.

Energy

It's kind of strange, but until this point, I didn't really know much about energy or conservation or anything.  Of course I knew the basic stuff like "it's good to recycle" and "turn off the lights when you go out" but that was about the extent of my interaction with energy conservation and usage.  Of course, when gas prices go up, I silently complain to myself, but just feel resigned to the fact that that's the way things are.  But as it turns out, that's not exactly true.

Due to Hawaii's geography, it turns out we have some challenges and benefits that most other places in the world don't share.  For example, we're severely lacking on space so it's impractical to create huge power grids, but we have almost all types of natural energy things like wind, waves, lava, etc.  Also, we spend a ton on gas and use way more than a lot of other places on the mainland USA.  So it makes sense that Hawaii would take the initiative in trying to find clean, reusable energies.

But another interesting thing is that in the pursuit of reusable energy, there can be some harm to the environment as well! So you can't just say "hey guys, let's put up windmills wherever possible and solar panels everywhere else.  Windmills mess people up with the noise and sight and have a bad habit of killing birds.  Solar panels have very little maintenance but aren't nearly as effective as other means, which means that we'd have to use a ton to get the same effect, covering a lot of land we may want to use for other things.  With just those two examples, I began to see that the problem really isn't too simple. But the thing that most excited me was the fact that data and knowledge was such a big deal to people.

Personally, i know that computers drain their fair share of electricity and that leaving things on, or building a power hungry system can really have an effect on how much you pay every year.  And I know there are tools out there to monitor how much you're using, but I never got around to buying one so I just went on living my happy, ignorant life.  But it turns out people are interested in knowing these things, for one, by looking at how much you're using, you have a concrete reference with which to improve.  Also, when power companies look at this sort of data, they can spread the load and make sure that there is enough electricity at peak times and maybe a little less when there is less need for it instead of just supplying the same amount all the time.

To that end, there are a lot of people trying out pilot programs and other things to get the community more involved in conserving electricity and moving away from fossil fuels.  I think it would be really cool if Hawaii could be totally independent, at least in energy if not in food or other commodities.  But there's certainly a lot to be done to get even a little closer to that point, and I think one of the main things is public awareness.  Most people don't know, and don't care.  If they don't see how something effects them directly, they aren't really interested in it, which is why things that get them involved somehow will probably work better (like giving me free monitors :P)