Cory Foy

Friday, September 29, 2006

Moved in and heading to Seattle

It's been a long week, but we are finally moved into the house. The movers came yesterday and dropped all of our stuff off. We've worked like mad today to get everything unpacked - so far we've gotten the kitchen and living room, and the basics in the office and bedrooms unpacked. I wish I had another week!

But I don't - I head out Sunday for bootcamp at the Microsoft campus in Redmond for three weeks. It looks like I'll have lunches and evenings free, and would love to get together with anyone in the area. Drop me a line if your free!

Wednesday, September 20, 2006

Good bye Columbia (and off-line to head home)

It's been a fun ride here in Columbia, MO. It's a great town, with great people, good weather (except for tornadoes), and a great company. But tomorrow morning the packers are coming to move us back to Tampa for my new job with Microsoft, so it's good bye to Columbia, and internet connection for a few days.

I'll leave you with the XP story posted on Slashdot yesterday, in which I posted a comment rebuffing some claims, and a link to the latest articles I wrote on TDD. What happens when you have a 5 rated comment and Slashdot comes calling?



Which is just a great sign that lots of people got some exposure to Test-Driven Development yesterday. Which makes me a happy camper!

See you in Florida!

Saturday, September 16, 2006

Fitnesse Selenium Wrapper

Two powerful tools for communicating requirements from your customers, and testing those requirements, are Fitnesse and Selenium. Fitnesse, a wiki encapsulating the Framework for Integration Tests (aka FIT), enables customers to write sentence-like tests which can be mapped to the underlying system. Selenium drives a browser without all of the fragile mouse coordinate testing you get from a lot of testing tools (ala WinRunner).

While there's been a lot of good posts on Fitnesse and Selenium, none of them seemed to fit in to exactly what we need, which was a way for our customers to harness the power of Selenium in the acceptance tests they are writing. So, using the DoFixture and the Selenium Remote Control Java API, we were able to hack together a custom Fitnesse fixture which reads surprisingly well.

First, you'll need to set up Selenium. I'm going to be writing a tutorial on it soon, but basically just download the Selenium Remote Control, unzip it, and start up the server. With the server running, you can write Java code which will make calls to the server and interact with the browser.

Now, onto our tests. We wanted to give our customers the ability to write tests like:

|The user navigates to the URL|http://www.google.com|

|The page has the title|Google|

|The page has an element named|q|

|The page has an element named|btnG|

|The user Types|Cory Foy|in the field named|q|

|The user clicks on the button named|btnG|

|The user closes the browser|


This is the wiki-syntax from Fitnesse, and something our customers are familiar with writing. One of the nice things about the DoFixture in Fitnesse is that it knows how to convert these to java method calls. For example, this:

|The user navigates to the URL|http://www.google.com|

gets mapped to:

public boolean TheUserNavigatesToTheUrl(String url) {}

I've put the Fitnesse fixture up for download. You'll need to compile it and put it on the classpath, along with the Selenium java client jar. To use it, you'll have to make sure that the SeleniumRunner is the first table in your test, and then initialize it using the Selenium properties. Ideally, you could just move this up to a SetUp method, so your user wouldn't see it.

|!-com.cornetdesign.fitnesse.SeleniumRunner-!|

|Set server to|localhost|and port to|4444|and browser to|*firefox|and domain to|http://www.google.com|


The above puts the Fitnesse test into Flow mode, and then initializes the Selenium runner to point at localhost:4444 using the firefox browser, and having the URLs go against the domain google.com.

I'm going to be doing some more work with this, so feedback is welcome. I hope to get a good Selenium tutorial up soon.

Thursday, September 14, 2006

Mapping a Hibernate object using joined tables

My pair and I searched around and around today for this problem. We have an object whose definition comes from one table, but has one or two fields that need to come from a joined table. Something like:

TableSecurity ( int userId, varchar username, varchar password, bit isActive )
TableUser ( int userId, bit isPreferred )


public class User {

  private int userId;
  private String userName;
  private boolean active;
  private boolean preferred;

  //...getters and setters

}


We'd normally have a Hibernate mapping like:

<class name="com.cornetdesign.User"
    table="TableSecurity" mutable="false">
  <id name="id" column="userId"/>
  <property name="userName" column="username"/>
  <property name="preferred" column="isPreferred"/>
  <property name="active" column="isActive"/>
</class>


But because we need to get those values from the TableUser table, we need to join them. It's as simple as:

<class name="com.cornetdesign.User" mutable="false">
  <subselect>
    SELECT sec.userId, sec.username, sec.isActive, user.isPreferred
    FROM TableSecurity sec
    LEFT JOIN TableUser user
      ON user.userId = sec.userId
  </subselect>
  <id name="id" column="userId"/>
  <property name="userName" column="username"/>
  <property name="preferred" column="isPreferred"/>
  <property name="active" column="isActive"/>
</class>

Wednesday, September 13, 2006

Agile Carolinas meeting tomorrow (Thursday) in Charlotte

At tomorrow's (September 14th, 2006) Agile Carolinas meeting, Arlen Bankston will lead a discussion on Lean, Six Sigma and Agile, focusing on how they can complement and enhance one another. Arlen has done work in these areas at a number of large clients in Virginia and elsewhere, so he can share his eal-world experiences. Arlen works for CC Pace.

The meeting will start at 6:30pm with free pizza and networking. At 7pm Arlen will start his talk/discussion and we will go until 8:30pm or so. Location in Charlotte:

Lash Group
Corporate Center 5
3735 Glen Lake Drive
Charlotte, NC 28208
Here is the mapquest

Please RSVP to jhlittle at kittyhawkconsulting.com if you will be attending.

If you are interested in finding out more about Agile Carolinas, head over to their web site or discussion group.

Tuesday, September 12, 2006

Why Sun's hiring of the JRuby developers isn't good for Ruby

(Edit: Alternative Title: Why Sun's hiring of the JRuby developers isn't just good for Ruby (Thanks Pat!) (Amazing the difference one word can make))

The latest news over the past few days has been all about Sun's hiring of the JRuby developers. Many people have touted it as good news for JRuby, good news for Ruby, signs Ruby is coming of age, etc, etc.

Sun's hiring of the JRuby developers isn't good news for Ruby. It's good news for Java.

In Bruce Tate's Beyond Java he talks about how Java is at where C++ was at when Java came out. Now, granted, Ruby has been around 10+ years, but the point stands. People are getting frustrated at Java, but put up with it because they have a heavy investment in it. After all, those BEA servers aren't going to get away with just serving up some Wiki pages ala JWiki.

But now, developers have some interesting alternatives to Java on the JVM. Want to rapidly prototype something? Or just build an application you can have fun programming with again? Or maybe you want to add support for something to your Java apps. Now you have an alternative which leverages your existing investments. That, my friends, is good news for Java.

And yes, I know of Groovy. But Ruby is doing something special right now - you've got plugins for Eclipse AND VisualStudio.NET. That's not something you find every day.

So kudos to the Sun team for recognizing and opportunity to keep the JVM providing value.

Saturday, September 09, 2006

Lars Ulrich as the perfect model of a developer

This evening, I was sitting rocking our new daughter, listening to the relaxing, soothing sounds of Metallica. Actually, I was listening to the radio, and a Metallica song came on, but nonetheless it hit me. If I were hiring a developer, who would I want them to emulate better than Lars Ulrich?

So, I guess I should explain. First, like any good developer I'd want to hire, Lars is one of the best. He's been at his art for a long time (getting his first drum set around 1977). He knows his way around all of the tools (instruments) of his craft. And he can play the heck out of a drum set.

But, despite all this, he knows that there is more to band stuff then just showing up and hitting some drums. Lars is the spokesperson for Metallica, showing he knows the business side too. And even though he can smack a gong and master a djembe, he understands that one doesn't need to show off all of those skills in every application. In fact, in most of the Metallica songs, Lars is simply setting a very solid backbeat. Nothing fancy, but getting the job done. And when he needs to pull out the stops (16th notes on the bass for One anyone?), he does it with flair, style, and class.

So, someone who is a master at their craft, understands both the business and how to talk to the public, and knows that you don't always have to pull out all the stops everytime to get the job done. I definately think that's my ideal of a developer. Now, if I can just convince my wife to let me buy another drum set...

Friday, September 08, 2006

The discipline of XP

Phlip made an interesting post about the discipline of XP, in response to a question about it on the XP list:

XP is the discipline to only write code when you have achieved this checklist:

  • a user story, with a priority
  • a failing storytest for that story
  • a failing unit test for a feature in that story
  • a pair
  • a continuous integration system
  • a daily deployment system
  • a fresh attitude


Which I think is an excellent way of thinking about it, as long as one, as Naresh Jain puts it, understands the why's of the above checklist. If we as developers see that a feature doesn't have a failing storytest, and we just write one without involving the customer, we've missed the boat.

Thursday, September 07, 2006

Taking the blue pill...

I can finally announce today that I've accepted a position with Microsoft! I'm going to be working with the PSS team based out of Tampa, FL, and I'll be starting October 2nd by spending 3 weeks in Redmond. So if you are up that way, shoot me a line - I'd love to get together!

This is very exciting for us from several fronts. First, my wife and I are both from just north of Tampa, and with the new baby, have been longing to get back near family. Second, the position itself seems very interesting, and also seems like a good chance to get to know a lot of the enterprise companies in and around Florida. I'm also hoping it's a chance to spread agile techniques where appropriate in training sessions.

The downside is that I'm leaving a great team at CARFAX here in Columbia, MO. It's been a fun ride, and it was a tough decision. Ultimately we were ready to get back closer to the family.

As far as my current projects - I've gotten approval from my manager to continue work on NUnit, I'm just waiting on approval from MS Legal. I won't be able to contribute to Mono, but I wasn't doing much of that anyway, and I think reporting bugs will still be allowed. ;) Finally, I'll still be doing tutorials on various Agile tools and techniques, there just may be more in C#.

Monday, September 04, 2006

Steve Irwin (The Crocodile Hunter) died!

On CNN this morning they are reporting that Steve Irwin, the crocodile hunter, died after a stingray he was swimming over shot his barbed tail through his chest. This is definately a sad day, as I always enjoyed watching him and I think he brought a lot of people's awareness up of various animals.

R.I.P. Steve Irwin!

Sunday, September 03, 2006

TDD and the TOTE model

Test-Driven Development (TDD) is one of the core practices of XP. Generally when I introduce people to the concept, I either get a look that says I'm crazy, or they comment on how they used to do that "back in the day", which generally leads to discussions about walking uphill 20 miles in the snow to pick up some punch cards, etc, etc.

Lately I've been reviewing my wife's materials from her I/O Psychology classes. One of the books that has really caught my interest is Understanding Motivation and Emotion by Johnmarshall Reeve. I've been reading a section on cognitive approaches to motivation, when I stumbled across the TOTE model.

Turns out that in 1960, a group of pyschologists (Miller, Galanter & Pribram) theorized that people have in their minds what is ideal in the current situation, and when they find a mismatch between the ideal state and the current one, they adopt a plan of action to correct it. They called it the Test-Operate-Test-Exit (TOTE) model, and it looks like this:

  1. Test - Compare present state with ideal state

  2. Operate - Act on environment to realize ideal state

  3. Test - Compare present state with ideal state. If congruous, goto 4, else goto 2

  4. Exit - Present state in congruity with ideal state


Which, oddly enough, looks very similar to the TDD model:

  1. Write a failing test which describes the ideal state you want the system to be in

  2. Modify the system to make the test pass

  3. Rerun the test to see if the modifications made the test pass. If yes, goto 4, else goto 2

  4. Refactor


So, the interesting thing is that TDD feels so natural to so many people because it is how they would normally act in a given situation.

Further reading:

Saturday, September 02, 2006

Yes, Reflector does work on Mono

In the last post about Mono 1.1.17, I posted that about running Lutz Roeder's Reflector in Mono. Yes, Reflector does run in Mono, on Linux. I've seen some quirks with it, but here's a screen shot of it:



I started it by running mono Reflector.exe /compat after downloading and unzipping it. Cool stuff!

Friday, September 01, 2006

Mono 1.1.17, NUnit and Reflector

It looks like the Mono project has released version 1.1.17. It's great news for two reasons. First, we now have the NUnit GUI building out of the box (with our 2.4 Release Candidate code) on Mono/Linux:



Secondly, according to Matt Hargett, Reflector now runs on Mono (if you use the /compat switch)

Big kudos to the Mono team for all of their hard work!