Tuesday, November 24, 2009

Remember Which Goals are Important

John Nunemaker made an excellent comment which reminds us of the value of setting goals.
In the "crazy" world of software development, we are often pushed to make software the best, the biggest, or the option with the most features.
When Boeing prepared to launch the design of the 727 passenger plain in the 1960s, its managers set a goal that was deliberately concrete: The 727 must seat 181 passengers, fly nonstop from Miami to New York City, and land on Runway 4-22 at La Guardia. (The 4-22 runway was chosen for its length--less than a mile, which was much to short for any of the existing passenger jets.) With a goal this concrete, Boeing effectively coordinated the actions of thousands of experts in various aspects of engineering or manufacturing. Imagine how much harder it would have been to build a 727 whose goal was to be "the best passenger plane in the world."
Setting those few important goals helped make the 727 a successful and versatile aircraft. This same concept can be applied to anything we do, even on a much less grand scale.
This is a great reminder to not lose focus on what is important to your project.
Now, back to creating the best software I can :)

Tuesday, November 10, 2009

Factory.create(:factory_girl, :fixtures => false)

Rails fixtures are a great starting point, but you can't live with them on a large project.
While working on a feature recently I kept breaking other unit tests while working with working in the associated fixtures. The relationship graph between all these objects is quite large, and I quickly decided this wasn't a game I wanted to play anymore.
FactoryGirl isn't new, and I've actually played around with FactoryGirl in the past. It didn't take much effort to add a test/factories.rb, specify a few Factory objects and then bask in the win.
Tests written. New feature added. Existing tests continue to work. Everybody is happy.
Over the last few weeks we have almost entirely replaced fixtures as we've encountered them. At this point in time it is quicker to replace the fixtures than it is to continue repairing fixtures.
Yay, our tests aren't as brittle anymore :)
For everything but the most trivial project, I'll be dropping fixtures at the start of the project.