Thursday, October 28, 2010

Decathlon User Stories

The U.S. Department of Energy Solar Decathlon is a biannual competition that challenges 20 collegiate teams to design, build, and operate solar-powered houses that are cost-effective, energy-efficient, and attractive. The winner of the competition is the team that best blends affordability, consumer appeal, and design excellence with optimal energy production and maximum efficiency.


The University of Hawaii, dubbed as TeamHawaii, was selected to be a competitor for the 2011 Solar Decathlon.  TeamHawaii's mission is to create a sustainable and affordable housing solution that is adaptable to varied cultures and climates with an emphasis on Hawaii and tropical climates.

     

As a software designer and developer for the solar decathlon house, my first task was to define the requirements for the home management software system.  I did this by creating user stories that encompassed the most essential management functions in the solar decathlon house.  User stories define the role of the person interacting with the system, the goal(s) of the interaction, and the benefits that would accrue from the interaction.  I created 10 user stories below:

Energy

As a home occupant, I would like to know the current levels of energy generation, expenditure, and storage.  Based on these metrics, the system will approximate the available energy budget and energy usage for the day.  If energy consumption is estimated to be greater than the budget, the system will alert me and offer suggestions to reduce power usage.  Thus, I will be able to achieve a net energy consumption of as close to zero for the day.

Water Heating

As a home occupant, I would like to know how long it would take to heat a given volume of water to 110°F, and how much hot water has been used for the day.  The water heating system will alert me if hot water usage is substantially higher than what I normally use, which may indicate a running faucet or leak.  Thus, I will be aware of my daily hot water usage and its impact on total energy expenditure.

Lighting

As a home occupant, I would like to have a lighting system that will respond to voice commands or a touchscreen interface.
  There will be multiple voice commands, one being able to turn on lights in the immediate vicinity around each occupant.  Thus, voice-activated lights will provide convenience and save energy by turning off unneeded lighting.

Air Conditioning

As a home occupant, I would like to know and be able to control the current temperature and humidity in each room.  If I do not specify a temperature and humidity, the air conditioning system will default to a temperature within 71°F to 76°F and a relative humidity below 60% when there is an occupant in the home.  Thus, the AC system will maintain a comfortable environment to live in.

Security

As a home occupant, I would like to have a security system that will allow entry to the home through face, fingerprint, or voice recognition.  A database will maintain a modifiable list of people who may enter the home at certain times of the day.  For example, immediate family members will be allowed entry 24 hours a day, while friends will be allowed entry only during a time that I have specified.  Thus, I will never be locked out of my home and expected visitors will not be inconvenienced.

As a home occupant, I would like to have a surveillance system that activates only when someone enters the surrounding premises of the house.  If an unidentified person loiters around the home for more than 20 seconds, the security system will alert me on my phone or computer and offer a live video feed.  Thus, I will be able to respond remotely to security situations and secure my home from intruders.

Aquaponics

As a home occupant, I would like to know the current levels of oxygen and carbon dioxide in the aquaponics ecosystem.  The system will alert me if gas levels become unbalanced, and will offer suggestions to correct the problem.  Thus, I will be able to address any issues before they get out of hand.>

Appliances

As a home occupant, I would like to know the current refrigerator, freezer, and dishwasher temperature.  In addition, I would like to know how long it would take to wash a given load of laundry.  The refrigerator will maintain a temperature within 34°F to 40°F.  The freezer will maintain a temperature within -20°F to 5°F.  The dishwasher will reach a temperature of at least 120°F during a wash cycle.  If any of these conditions fail, the system will alert me and indicate which has failed.  Thus, I will be able to ensure the safety of my food and assess the condition of my home appliances.

Home Entertainment

As a home occupant, I would like to control my home entertainment systems through an interface on a single device.  I will be able to adjust various settings for the lights, television, speakers, and computer(s).  Thus, I will be able to enjoy the convenience of entertaining myself and my guests without having to get up.

General User and Repair

As a home occupant and repairman, I would like to have access to all metrics and status information for each system in the house.  In addition, any problems that arise will generate an error report containing the date, time, location, and a snapshot of current conditions.  These will be viewable through an interface on a single device.  Thus, I will be able to quickly troubleshoot and repair any hardware problems.

Tuesday, October 26, 2010

Website Usability Review

What is effective web design and usability?

The field of web design has become more important than ever in this world that has embraced the internet as a source of business and entertainment.  Whether a business is online-based or a brick and mortar, nearly all have online websites that advertise the company and their products or services.  Thus, knowing what constitutes good web design and usability can be immensely helpful in gaining a greater presence online.

The most important points in effective web design and usability are:
  1. Ease of navigation.
  2. Giving users the information instead of making them fish for it.
  3. Simplicity.
  4. White space.
  5. Organization.
  6. Minimal number of ads, and anything that looks like an ad.
  7. High quality content.
Good web designs

Newegg.com is an example of a website that has achieved good usability.  The navigation bar at the top, and the guided search on the left make it easy for users to find exactly what they need.  The product page displays the relevant info such as price, hardware specs, and user reviews.  Despite packing lots of information onto the webpage, it still feels uncluttered because it is organized into 4 distinct modules:  navigation bar (top), guided search bar (left), product reviews (right), and products (center).


DailyTech.com also achieves good usability.  Like Newegg.com, it has a navigation bar at the top, organizes content into sensible categories, and makes liberal use of white space.  The webpage feels simple, organized, and offers high quality content.


Bad web designs

StarAdvertiser.com is an example of a website that has not achieved good usability.  It violates the points of simplicity, white space, organization, and minimal ads.  The rightmost column could be mistaken for ads.  A visit to the site and a bit of scrolling down will reveal how cluttered and claustrophobic the webpage feels.  There is simply too much information jammed into a single webpage.


news.cnet.com also fails to achieve good usability.  Like StarAdvertiser.com, the rightmost column could be mistaken for ads.  Although the webpage is more usable than StarAdvertiser's, word density is still high and the webpage is littered with miscellaneous buttons everywhere.


Note: The websites above were viewed using the Chrome web browser and an extension called AdBlock Plus.

Thursday, October 14, 2010

Subversion and Google Project Hosting

This week, I was introduced to Subversion (SVN) and Google Project Hosting.  SVN is a tool for developers to maintain current and historical versions of files such as source code, web pages, and documentation.  Google Project supports the open source community by providing scalable, reliable, and fast collaborative development environment for open source software, docs, and standards that promotes best practices in open source software engineering.

For my Windows development environment, I used TortoiseSVN which provides a Windows shell extension for Subversion.  The program is very easy to use.  One simply needs to obtain the SVN checkout URL and select the target files to upload.


In addition to being able to upload files for other users and developers to see, SVN and Google Project lets many developers work simultaneously on the same project.  I was able to gain some first-hand experience with the robocode-pmj-dacruzer project.  I improved the source code and successfully committed it to the repository.

I then proceeded to create my own robocode-dwl-robotfighter project.  I created a Google discussion group, added several of my colleagues, uploaded my robocode robot system, edited the project home page, and created a UserGuide and DeveloperGuide wiki page.  I successfully accomplished all tasks required for this particular assignment.

The most difficult part of the assignment was using WikiSyntax to create my wiki pages.  Although the creators of wiki-style markup may have thought it was a great idea, I disagree.  It is nonintuitive and made my life more difficult.  They could have at least created a simple GUI with buttons.

Prior to this experience, I did not understand how large-scale software development worked.  I did not understand how companies could assign hundreds of developers on the same project.  After learning that tools like SVN and Google Project Hosting exist, I am very eager to get my hands dirty in collaborative open source software development.

Thursday, October 7, 2010

JUnit and Jacoco

This past week, I had the pleasure of using JUnit and Jacoco for the first time in my career.  JUnit is a tool that helps developers to quickly perform white-box and black-box testing.  Jacoco is another tool that builds upon JUnit by providing code coverage reports.  In other words, Jacoco checks which lines of source code have or have not been executed during runtime or tested by JUnit.

In this post, I will share my experiences in creating tests for RobotFighter (version 1.0).  I created 2 acceptance tests, 2 unit tests, and 2 behaviorial tests.

Acceptance Tests:

  • RobotFighter vs. SittingDuck
    • Tested whether RobotFighter could beat SittingDuck every round.  This ensures that my robot is able to perform the basic functionalities of aiming and firing.
  • RobotFighter vs. SpinBot
    • Tested whether RobotFighter lost against SpinBot most of the time.  From my previous post, RobotFighter lost 79% of the time against SpinBot.  This confirms that improvements need to be made in the next version of RobotFighter.
Unit Tests:
  • Bullet Power
    • Tested if the function for determining bullet power was consistently above 0.25.  Anything below 0.25 could be deemed as "not worth it" because a robot is vulnerable for the period when it stays still to fire.
  • Random Generator
    • Tested whether the random number generator did indeed generate unique numbers most of the time.  This generator is used to determine how far RobotFighter will move.  By maintaining random travel distances, RobotFighter has a greater chance of beating robots that use predictive firing.
Behaviorial Tests:
  • Movement
    • Tested if RobotFighter moved at least once every 15 turns.  This is important in dodging bullets.
  • Firing
    • Tested if RobotFighter fired at least once every 50 turns.  A robot that does not fire often has a lower ability to beat other robots.

The acceptance and unit tests were by far the easiest to implement.  Behavioral tests were difficult to implement because it required a good understanding of the specifications and the background processes of Robocode itself.  

Originally, I wanted to test whether RobotFighter successfully exhibited the behavior of rushing towards the enemy when the distance was >= 150 pixels and moving away when the distance was <150.  However, this was extremely painful as I spent hours trying to figure out how to extract robot information during the middle of a turn.  I relied mostly on the onRoundStarted, onTurnEnded, and onBattleCompleted methods to implement the JUnit tests.  For this reason, I did not feel that my test cases adequately ensured the quality of my robot.


Jacoco indicated that my project had an overall code coverage of 95%.  Upon further inspection, Jacoco revealed a major flaw in the movement system of RobotFighter.  For example, RobotFighter is supposed to turn left when randomGenerator() % 2 == 0.  Based on the current formula for generating a random number (Math.random() + 0.27 * 100), this condition is never true, and thus, the line of code is never executed and RobotFighter never turns left.  Jacoco also revealed that the original structure of RobotFighter.java was unsuitable for testing.  In the future, I will separate different functions into different modules instead of lumping everything into the onScannedRobot method.  This will facilitate the ease of testing.

My project is available
here.