Saturday, August 29, 2009

Redesign Your Home For Free*

* virtually.
  • Overview

    In this blog, I'll be doing a review of Sweet Home 3D to see whether it satisfies the Prime Directives of Open Source Software Engineering. The project's main website describes Sweet Home 3D as "a free interior design application that helps you place your furniture on a house 2D plan with a 3D preview". They also want users to be able to design their interior quickly, whether it's placing new furniture or rearranging existing furniture. It is available in a myriad of languages, including French, Russian, and Chinese.

  • Prime Directive 1

    Prime directive 1 says that "The system must accomplish a useful task". Remodeling a home requires a lot of planning. There tends to be a lot of money involved, so one wants to be sure to get things right. Also, people will probably have to live with their design decisions for a long time. Because of this, many people use interior design programs to get a better idea of how their room will look before making any lasting decisions. While one can go to their local software store and purchase one, having one that's free and open source is a great alternative. Thus, I would say that prime directive 1 is satisfied.

  • Prime Directive 2

    Prime directive 2 states that an external user can successfully install and use the system. Installing Sweet Home 3D is remarkably easy. On OSX, the download from Sourceforge is a dmg file that many Mac users are familiar with. Once the file is opened, the user drags into their application folder, just like many other Mac applications. One might not even think that this application is written in Java at all since it integrates so well with OSX.

    The application itself is fairly straightforward as well. When the application is opened, the list of home items and the floor plan grid are visible in the window. To create a room, you can use the room tool at the top to designate the corners of your room. Here's a sample bathroom that I made in 5 minutes.

    If you need more help, there is a great users guide that describes how to use the various tools to redesign your home. These three things (easy installation, an intuitive interface, and a detailed user guide) help this application satisfy prime directive 2.

  • Prime Directive 3

    Prime directive 3 says that an external developer can successfully understand and enhance the system. To do this, you need to find the source code for the application. The source code for Sweet Home 3D is located on their download page near the bottom. Note that they also provide a Javadoc download for developers who want to understand how the application works. In the source code folder, the README file contains instructions on how to add the Sweet Home 3D project to Eclipse and how to build the project using Ant.
    Below is a screenshot of the imported Sweet Home 3D project. I was also able to run their unit tests in Eclipse.

    Sweet Home 3D also supports plugins to extend functionality of the program. I went through their tutorial and created my own plugin for Sweet Home 3D.
    Being able to both build the app from the source code and develop your own plugins means that the developer can easily enhance the system. Thus, prime directive 3 is satisfied.

Programmers Who Can't Program

It's ridiculous to even think that programmers who apply for jobs nowadays can't even program. Yet, according to this article at Coding Horror, many applicants are unable to create a simple program. FizzBuzz is a simple enough program with no tricks, yet most computer science graduates can't do it and some experienced programmers take 10-15 minutes. In ICS 613, we spent part of the first day writing (or in some cases, attempting) a solution on paper.
Of course, the two groups might have a few excuses. A CS grad might say that there's a lot of pressure when you're applying for your first job. However, solving a problem as simple as FizzBuzz during your interview is probably trivial compared to some of the problems you'll be dealing with on the job. If you can't handle this, how can you handle last minute fixes on a deadline?
An experienced programmer should not have any trouble approaching a solution. The only reason they'd take an extended amount of time would be if they over-thought the solution. Admittedly, I've been guilty of over-thinking problems, but 10-15 minutes is far too long. Seeing as how I'm not really an experienced programmer, I can't really say what takes them so long. Perhaps they need to gather requirements and use cases first.
When we wrote the solution in class, I certainly felt some pressure to do it quickly. As it was written, it was close to a solution, but it wouldn't have worked. After going over it and redoing it in Eclipse, it was really simple to do. The auto-compilation and error checking tools provided by Eclipse makes it really easy to program. Unit tests also make it easy to see if we get the desired output.
From that experience in class, I see that the class isn't about the programming. We can all program (I think), but can we apply that to the many potential problems and issues we may encounter while working on a large project? As a person who took the undergrad version of this class before, I know that we'll be introduced to many tools that'll help make our jobs easier. Learning how to apply these tools will be a major focus of the class.
Here's my solution as written in Eclipse. It probably took 2-3 minutes or so to implement and probably about the same to write my first incorrect solution on paper.

public class FizzBuzz {
public static void main(String[] args) {
for(int i = 1; i <= 100; i++) {

static String getFizzBuzzNumber(int i) {
if((i % 3 == 0) &amp;&amp; (i % 5 == 0)) {
return "FizzBuzz";
if(i % 3 == 0) {
return "Fizz";
if(i % 5 == 0) {
return "Buzz";
return String.valueOf(i);

Monday, August 24, 2009

Test Post

This is just a test post while I figure out the proper width for my template. I could've cheated and used the same template as Philip. It's what I get for trying to be unique.

Here's some nasty Java code I wrote in the past year:

package edu.hawaii.schedulingsimulation

import java.util.Calendar;

import edu.hawaii.schedulingsimulation.generator.DAG;
import edu.hawaii.schedulingsimulation.generator.DAGGenerator;
import edu.hawaii.schedulingsimulation.simulator.scheduler.HLFETScheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.ISHScheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.MaxMinScheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.MinMinScheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.ModifiedCPScheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.NaiveCPScheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.NaiveMaxMinScheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.Scheduler;
import edu.hawaii.schedulingsimulation.simulator.scheduler.SufferageScheduler;

* Class that runs the simulation.
* @author George Lee
public class Main {
private static Calendar cal = Calendar.getInstance();

    * Runs the simulator.
    * @param args Command line arguments (trials?).
public static void main(string args[]) {
int numTrials = 100;
int numTasks = 50;
double edgeToTaskRatio = 0.1;
int procCost = 10;
double commCompRatio = 1.0;
int depth = 5;
int children = 5;
int parents = 5;
int procs = 5;
//Scheduler results.
DAGGenerator generator = new DAGGenerator();
DAG dag;
Scheduler scheduler;
double[] naiveMaxMinResult = new double[numTrials];
double[] maxMinResult = new double[numTrials];
double[] minMinResult = new double[numTrials];
double[] sufferageResult = new double[numTrials];
double[] naiveCPResult = new double[numTrials];
double[] hlfetResult = new double[numTrials];
double[] ishResult = new double[numTrials];
double[] modifiedCPResult = new double[numTrials];
double naiveMaxMinSpeedup = 0, maxMinSpeedup = 0, minMinSpeedup = 0, sufferageSpeedup = 0,
naiveCPSpeedup = 0, hlfetSpeedup = 0, ishSpeedup = 0, modifiedCPSpeedup = 0;
if(args.length > 0) {
= Integer.valueOf(args[0]);
if(args.length > 1) {
= double.valueOf(args[1]);
if(args.length > 2) {
= double.valueOf(args[2]);
if(args.length > 3) {
= Integer.valueOf(args[0]);

("**Number of tasks " + numTasks + "**");
System.out.println("**Edges to tasks ratio " + edgeToTaskRatio + "**");
System.out.println("**Communication to computation ratio " + commCompRatio + "**");
System.out.println("**Number of processors " + procs + "**");
int edges = (int)(edgeToTaskRatio*numTasks);
int commCost = (int)(commCompRatio*procCost);

//Some code that I omitted because I don't want to deal with converting the less than symbol