Friday, December 17, 2010

Solar Decathlon Design 3

For this third round of design for the Solar Decathlon's home management system, my team and I developed a web application using HTML, CSS, and Wicket.  We used our Balsamiq mockup designs from earlier on as the basis for the general look and feel of each page.  However, our actual implementation in HTML turned out to be dramatically worse than the look of our mockup design.  We decided to break off from our initial design and gave the interface a major facelift.

Balsamiq mockup design
First round of implementation
Second round of implementation

As seen above, we simply tried to mimic our mockup designs during the first round of implementation.  After a short presentation/demo, we incorporated some of the feedback we received into the second round of design.  A few changes included a sleeker navigation bar and tooltip alerts in the upper right hand corner.

In terms of fulfilling the three prime directives of software engineering, I feel that we were successful in 1) developing a system that accomplishes a useful task  2) developing a system such that an external user can install and use the system  3) developing a system that can be understood and enhanced by another developer.  Our Wiki pages help to satisfy these directives by providing user and developer documentation for our web application.

If we were given additional time to work on our web application, we would continue to improve the look and feel by adding more colors and images.  Functionality-wise, we would add a right-side column to each page that offered tips and educational content.  For example, the right-side column of the Aquaponics page would explain what pH is, why it is important, how it affects the fish in the tank, and recommendations for controlling the pH level.  Due to time constraints, we could not implement this feature before the deadline.

Prior to working on this project,  I had minimal experience with HTML and I knew nothing about CSS.  Now I can do basic web development using both technologies in conjunction with Wicket.  In addition, I gained an entirely new perspective on project management.  Each member of the team started out with varying degrees of experience in web development so we had to work with each other's strengths and weaknesses.  We also had to deal with time conflicts due to work and final exams, but we managed to squeeze in a very fruitful meeting with 3/4 members before the deadline.  All in all, we learned to deal with it and contributed what we could to the success of the project.

Download our web application here or visit our project site here.

Tuesday, November 30, 2010

Wicket Katas

A code kata is an exercise in programming which helps hone your skills in through practice and repetition.  I completed 11 different Wicket katas by making small changes to existing Wicket systems.  These katas are thoroughly defined at 31.WicketKatas.

Example 01:
Kata 1A:  The task was to display a timestamp one week in the future.  This took about 20 minutes to complete.  Instead of using a Date class, I used to a Calendar class because it supported the addition of days to the current time.

Kata 1B:  The task was to add a button that refreshed the timestamp when clicked.  This took about 20 minutes to complete.  I added a form that refreshed the page and consequently the time displayed.

Kata 1C:  The task was to have Wicket run in "Deployment" instead of "Production" mode.  This took about 2 minutes to complete.  I simply looked up the appropriate method and added its 3 lines of code into ExampleApplication class.

Kata 1A and 1B
Example 02:
Kata 2A:  The task was to add a link to a page that embedded a locally saved image.  This took about 1 hour to complete.  The difficulty was in figuring out the correct path to the image.

Kata 2B:  The task was to add a button that made all text bold, italic, or normal in a linear order.  This task was the most difficult and took about 5 hours to complete.  First, all text and links in the html file were made into components so that they could be modified by Wicket.  Then depending on the current state, the text was changed to reflect the appropriate behavior such as adding <b> and <\b> to make it bold.  Finally, the method setEscapeModelStrings was set to false so that Wicket did not escape '<' and '>' characters.

Kata 2B
Example 03:
Kata 3A:  The task was to add a link to a page that embedded a locally saved image.  This took about 10 minutes to complete.  It was very similar to 2A with the exception that I had to create a separate package for the image page.

Kata 3A
Example 04:
Kata 4A:  The task was to add a new cheese called "Velveeta" with a cost of $0.25/lb.  This took about 10 minutes to complete.  The most time-consuming part was finding the class file that contained the collection of cheeses.

Kata 4B:  The task was to add an additional "country" field to the checkout page.  This took about 15 minutes to complete.  The most difficult part was tracking down the changes had to be made in different class and html files.

Kata 4A
Example 06:
Kata 6A:  The task was to remove the blue columns on the website.  This took about 15 minutes to complete. I simply had to track down the showgrid option in the css file and delete it.

Kata 6B:  The task was to place the image underneath the form instead of to the right.  This took about 5 minutes to complete.  I did this by removing the <div> <\div> tags in the html file.

Kata 6C:  The task was to have the application run in deployment or production mode depending on the "deployment" status in a configuration file.  This took about 1.5 hours to complete.  The difficulty was in figuring out the correct path of the configuration file and testing to see that it worked.

Kata 6B
These Wicket katas were very useful in transitioning to a new framework.  I learned how to add forms, buttons, images, and much more by modifying existing systems.  These exercises also reinforced how Wicket components interact with hypertext markup language.

My modifications are available for download below:

Example 01
Example 02
Example 03
Example 04
Example 06

Thursday, November 18, 2010

Apache Wicket

Apache Wicket is a Java web application framework that bridges the mismatch between stateless HTTP and stateful server-side programming in Java.  Its goal is to be easy, reusable, non-intrusive, safe, and scalable.  Large companies like IBM, VeriSign, Amazon, and SAS have already joined the Wicket community for large, scalable front-end websites or internal projects with a high degree of UI complexity.

My involvement with Wicket is geared toward learning a framework that will enable me to build rich and interactive webpages for the 2011 Solar Decathlon competition.  My initial experience with Wicket was parallel to learning a completely new language.  I would be taking a giant leap into the unknown, but it would be a pivotal point in learning how to create useful real-world applications.  This leap was made much easier with the guidance of ics-wicket-examples.

An interactive web page made with HTML, Java, Wicket, CSS, and Google Visualizations.

My task was to develop a simple but interactive webpage that enabled users to modify the parameters of the  GoogleOMeter seen above.  First, Wicket is used to pull user input values from the webpage into Java.  Second, Java is used to process and edit the chart's parameters with the user's input values.  Finally, the chart is updated and displayed with its new URL.

The key to Wicket was knowing that components in HTML and Java are linked together by a common identifier.  Once this was understood, the next and most difficult step was interpreting user input and responding with appropriate output.  The difficulty was in part due to Wicket's new libraries and API.

From this experience, I learned that the career of a web application developer is not easy.  Jumping from framework to framework is time-consuming and frustrating, but there are tools like Wicket that ease the pain by helping developers create modular components that can be reused between projects.

My Wicket project is available here.

Solar Decathlon Design

Building on the the last three blog entries, my task for this week was to design a web-based interface for the solar house's home management system.  Balsamiq provided a free copy of their wireframing tool to aid me in this task.

The initial design process was extremely difficult because it was a first in designing a web-based user interface.  The first round of designs were a failure because I did not have a good grasp on what constituted a great web design.  After receiving feedback, some key elements were ironed out.  The most important element was to accompany each data visualization with an interpretation and offer a way for the user to respond.

A subsequent round of design brought an improvement to the user interface, but it still lacked the most important element described above.  For the third round of design, I was assigned to work in a team of four (Team 3) and to practice issue driven project management.

2nd round of design.
3rd round of design.

As seen above, the quality of the aquaponics page improved in each round of design.  Users are now able to see statistics easily, have the system recommend a course of action, and respond accordingly to the situation.  We took the best ideas from each team member's design and combined them to make a higher quality page.  Individual members' previous designs are available here.

With the bulk of our pages complete, the final steps were to create the homepage, iron out any glaring inconsistencies between our team members' work, and then link everything together in preparation for the presentation.

Thursday, November 11, 2010

Issue Driven Design Project Management

For the third round of the Solar Decathlon design, I was assigned to work in a team of four (Team 3) and to practice issue driven project management.  Issue driven project management describes a project management technique that is based on creating many small tasks (or issues) that require only a day or two to complete.  These tasks are divided equally among project members and the goal is to create a more comprehensive solution for the Solar Decathalon home management system.

In Google Project Hosting, issues are first created and then given both an owner and a status.
Generally, the progressions of issues are New > Accepted > Started > Done > Fixed.
Working in teams produced the best results because it allowed us to spend more time on each page since the workload for each individual person was lessened.  The first problem my team encountered was deciding on a standard template.  This issue blocked us for several days until we all agreed on the template.  From there, we incorporated all the feedback we were given into our third round of designs.  To ensure that requirements were met and consistency was maintained, I created a checklist that each page should adhere.

Although issue driven project management may have had a lot of overhead in the beginning (via meetings and time spent to standardize our designs), I think it was worth it because we were able to achieve a much higher level of quality in a shorter amount of time.  We always knew what we had to do and what other project members were doing, and thus, this made us more efficient in working together.

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:


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.


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.


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.


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.>


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 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). also achieves good usability.  Like, 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 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. also fails to achieve good usability.  Like, 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 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

Thursday, September 16, 2010

Competitive Robocode Robot

In this next segment of my experience with Robocode, I developed a competitive robot called RobotFighter that could reliably beat most non-advanced robots.  Secondary objectives were to improve my Java and Eclipse skills, and also to improve my ability to write code that adhered to standards.

The main feature of this bot is its random movement system.  First, RobotFighter calculates the distance between itself and the enemy bot.  If this distance is over 150 pixels, RobotFighter turns at a seemingly random angle and rushes toward the enemy bot.  If the distance is less than 150 pixels, RobotFighter turns at a random angle and retreats up to 450 pixels away from the enemy bot.  By introducing randomness into its movements, RobotFighter is able to evade enemy bot fire while closing in for short-distance attacks or retreating from ram-style attacks.

RobotFighter scans in a right-ward direction at 45 degrees per tick and with a wide arc.  Upon detection of an enemy bot, it fires a bullet and moves in a random direction.  Due to the limitations of Robot class, all actions are performed in serial, and thus, RobotFighter cannot maintain a perfect lock on the enemy bot.

Since RobotFighter uses a linear firing system, it only fires when it is within 500 pixels of an enemy bot.  It also varies the power behind its shots in proportion to the distance to the enemy bot.  The strength of its bullets are 0.9 at a distance of 500 pixels, and 3.0 (the maximum) at distances of less than 150 pixels.

RobotFighter was tested against 8 different sample robots in 100 rounds each.

Walls     Win: 64%     Loss: 36%

The movement system worked nicely in this match-up.  RobotFighter evaded most of Wall's bullets until it wore itself down to 0 energy.

RamFire     Win: 62%     Loss: 38%

The movement system overwhelmed RamFire's slow rotation rate.  RobotFighter backed away from RamFire in sharp angles, leaving it vulnerable to fire while it rotated.

SpinBot     Win: 21%     Loss: 79%

RobotFighter's linear firing system does not work well against bots that do not stop.  It is also inaccurate against circular movements.  If this robot were to be redesigned, it would have a pattern-finding system to predict the enemy's next movements.

Crazy     Win: 97%     Loss: 3%

Similar to the match-up against Walls, RobotFighter evaded most of Crazy's bullets until it wore itself down to 0 energy.

Fire     Win: 100%     Loss: 0%

RobotFighter is extremely effective against opponents that remain still for long periods of time.

Corners     Win: 82%     Loss: 18%

Like Fire, Corners remained still in a corner of the map, leaving it completely vulnerable to all bullets.

Tracker     Win: 76%     Loss: 24%

Tracker and RobotFighter used very similar movement systems.  The difference was that RobotFighter evaded more bullets by moving in non-right angles and it fired more powerful bullets up close.

SittingDuck     Win: 100%     Loss: 0%

SittingDuck literally did nothing but sit, so a 100% win percentage was expected.

Lessons Learned:
  1. From a documentation perspective, I learned that ALL methods need to be documented regardless of how trivial and straightforward they may seem.  To another developer, any missing documentation is far from trivial or straightforward.
  2. Eclipse provides a bunch of useful tools that make development times much quicker.  Some of these tools include automatic import statements, code formatting according to a standards template, refactoring, and built-in Javadocs.
  3. Every developer can learn to "listen" better.  In my previous experience with Robocode, I failed to "listen" when I did not notice the link to ICS 413 Robocode Standards.  This time around, I made sure to "listen" by double-checking that all requirements have been met.
A packaged version of RobotFighter is available here.

Tuesday, September 14, 2010


Robocode is an open source educational game designed to help people learn the Java programming language.  Much of the work is already done behind the scenes to provide the GUI and screen overlay.  One simply needs to refer to the API to begin coding their robot to move, use its radar, and shoot.

To learn basic movement, targeting, and firing behaviors, I programmed numerous robots to perform the following:

  • Position01: The minimal robot.  Does absolutely nothing at all. 
  • Position02: Move forward a total of 100 pixels per turn.  When you hit a wall, reverse direction.
  • Position03: Each turn, move forward a total of N pixels per turn, then turn right.  N is initialized to 15, and increases by 15 per turn.
  • Position04: Move to the center of the playing field, spin around in a circle,  and stop.
  • Position05: Move to the upper right corner.  Then move to the lower left corner.  Then move to the upper left corner. Then move to the lower right corner.
  • Position06: Move to the center, then move in a circle with a radius of approximately 100 pixels, ending up where you started.
  • Follow01: Pick one enemy and follow them.
  • Follow02: Pick one enemy and follow them, but stop if your robot gets within 50 pixels of them.
  • Follow03: Each turn, Find the closest enemy, and move in the opposite direction by 100 pixels, then stop.
  • Boom01: Sit still.  Rotate gun.  When it is pointing at an enemy, fire.
  • Boom02: Sit still.  Pick one enemy.  Only fire your gun when it is pointing at the chosen enemy.
  • Boom03:  Sit still. Rotate gun.  When it is pointing at an enemy, use bullet power proportional to the distance of the enemy from you. The farther away the enemy, the less power your bullet should use (since far targets increase the odds that the bullet will miss). 
  • Boom04: Sit still.  Pick one enemy and attempt to track it with your gun. In other words, try to have your gun always pointing at that enemy.  Don't fire (you don't want to kill it). 

I successfully coded all behaviors.  My implementations are available here.

At first, I was frustrated at the lack of a definitive guide that detailed specific robot behaviors and its code.  The wiki was not particularly helpful as the information was scattered throughout dozens of pages and mostly contained advanced behaviors.  The API became my golden guide from Position04 and onwards.

Position04 and Position05 presented the greatest challenge due to the necessity of trigonometric concepts and the awkward "compass" system that Robocode uses.  I completed Position04 by simply having the robot move in right angles until it reached the center.  In Position05, I used trigonometric functions such as arc tangent to have the robot move directly to its destination.  A problem I encountered was that the body of the robot is considered to be a square, not a single point.  Thus, my robot would occasionally run into a wall before hitting the corner of the map.

Other robots that exhibited interesting behaviors were Follow02 and Boom02.  I learned that by adjusting movement and radar rotation rates, I could affect how well the robots performed their tasks.  For example, I discovered that a radar rotation rate of 45 degrees per tick and 100 pixels per movement resulted in a potentially optimal robot that could quickly track down another robot.

Since positioning and predicting robot movements are the main strategies in Robocode, a competitive robot would strike a balance between radar rotation and movement rates.  In addition, techniques such as statistical analysis would be beneficial in predicting enemy movement patterns.

Tuesday, August 31, 2010

Open Source Software Experience

Sourceforge is an online repository for open source applications.  In this post, I will describe my experiences in downloading, installing, and using an open source software system.

The program that I downloaded is called JConvert, and can be found at  It is a unit conversion program that provides a simple and easy-to-use GUI.

Prime Directive #1 -
The system successfully accomplishes a useful task
JConvert satisfies Prime Directive #1.  It features a plethora of unit conversions that are useful in the fields of physics, chemistry, math, computer science, and engineering.

Prime Directive #2 - An external user can successfully install and use the system
JConvert satisfies Prime Directive #2.  The program is packaged as an executable jar file called "jconvert-1.0.9.jar" that only needs to be double-clicked to run.  As shown in the first image above, I was able to obtain an accurate conversion from 1 megabyte to 1024 kilobytes.

Prime Directive #3 - An external developer can successfully understand and enhance the system
JConvert partially satisfies Prime Directive #3.  The author provided another site and specific details on how to modify and add your own conversions to the program.  Javadoc files were also included.

However, the author did not make source code readily available as the executable was packaged as a .jar file.  I extracted the contents of the .jar file as shown below

Furthermore, the source files were all in .class format.  The only way to see the actual source code was to decompile the .class files.  I proceeded to download and use a nifty Java decompiler from

The major drawback is that in-line documentation and comments cannot be restored from decompiling a .class file.  Despite these difficulties, a developer would be able to understand and enhance the system by using a decompiler and the Javadoc files provided on the author's site (although with significant effort).

Monday, August 30, 2010

FizzBuzz Program

The FizzBuzz program is a simple test that is used often by employers to root out those who can actually program and those who can't.  On paper, I was able to implement FizzBuzz in about 3 minutes without proper documentation and comments.  Using Eclipse, it took me about 10 minutes as I fiddled around in my new IDE.

 * Prints out all numbers from 1 to 100, except "Fizz" is printed when it is a   
 * multiple of 3, "Buzz" is printed when it is a multiple of 5, and "FizzBuzz" 
 * when it is a multiple of both 3 and 5.
 * @author David Lin
 * @date August 30, 2010
public class FizzBuzz {
   * @param args ignored
  public static void main(String[] args) {
    for (int i = 1; i < 101; i++) {
      if (i % 15 == 0) {
      else if (i % 3 == 0) {
      else if (i % 5 == 0) {
      else {

The first problem I encountered was that Eclipse defaulted to tabs for indentation.  The standard for this Software Engineering class is 2 spaces.  I used the search function in Eclipse's help library, but it was fruitless, so I searched "Eclipse how to change indentation" on Google.  I found a posting on that indicated the location of this setting, which is Windows > Preferences > Java > Code Style > Formatter > Edit > Indentation.  I also learned of a quick way to have Eclipse automatically reformat my code with the new settings, which is Ctrl-Shift-F.

The second problem I encountered was formatting my FizzBuzz code to show up nicely in this blog.  A quick and easy way to retain coloring and formatting is to
  1. Copy the code from Eclipse
  2. Paste into Word
  3. Copy from Word and paste
This experience has taught me that standards (indentation), clarity (documentation, formatting), and resourcefulness (problem-solving) are important in software engineering and this class in general.