I’ve Been Ensared… by Facebook

July 24th, 2007 by James Carr

I never was one for social networking sites… I tried Orkut when it first came out and ran away from it fast when I got spammed non-stop by Brazillians and Indians speaking in their native tounges… and I still wouldn’t be caught dead on a site like myspace.

However, when I recently read about the Facebook Platform and a recent announcement on how to win cash for the best facebook app, I thought I’d create an account and see what it was like.

24 hours later, I’ve connected with about 20 to 30 contacts on the site, and I’ve been extremely pleased with the layout. It seems they have some very competent designers on hand, the interface is smooth and appealing, and the site quite possibly makes the best use of AJAX (yeah, I’ve given up on hating that word too) I’ve ever seen.

Anyway, Kevin Yank gives a good break down of the more geeky things Facebook has to offer that have appealed quite a bit to me.

Now… if only I could dream up the next killer app so I can win that $250,000 prize. ;)

JUnit 4.4

July 24th, 2007 by James Carr

InfoQ reports that JUnit 4.4 has been released. I have not had a chance to download it and try it out, but it looks like it has added a very good and useful feature, assertThat.

This is a very welcome addition. For a long time I have actually been using RMock in my TestCases solely for the assertThat method that it provides. For example, let’s say I want to assert that a string contains “foo” or “bar”, I can do this in RMock like this:


assertThat(result, is.containing("foobar").or( is.containing("bar") ));

Which is better than that assertTrue nonsense with a little bit of code jammed inside it to return true or false. JUnit4.4 now does something similar:


assertThat(result, either(containsString("foo")).or(containsString("bar")));

Cool stuff… I’ll have to start using this new version. :)

Punch Out

July 22nd, 2007 by James Carr

Found this on YouTube today. Funny stuff… brings back memories. ;)


Accidental DSL

July 18th, 2007 by James Carr

Something kind of funny happened on a project that I am currently wrapping up at work. We had been doing acceptance testing with fitnesse, and written many custom fixtures that were specific to the domain problem (DoFixture is great for this). Further, there were quite a few RowEntryFixtures, SubsetFixtures, and RowFixtures that provided quick and dirty access to the underlying DAOs for adds/updates/deletes that allowed for quick modification of data, and each of our tests tried to mimic a user story as much as possible with minimal technical details.

Anyhow, during our daily stand up meeting with our customer, they asked if we could put something together so they could quickly create scenarios for them to test manually, and interestingly enough this didn’t take much time as we were able to show them to use the existing fixtures to interact with the system to do whatever environment setup they needed for their tests.

I think this kind of earmarks a good acceptance testing harness… one that mimics a DSL so much that you can even use your test harness for other purposes to interact with the application. Even more important, when you have an acceptance test that reads like a DSL, it means it is more customer friendly and conveys information in a useful manner. When tests are clear, concise, and easily readable by domain experts, it is much more easier to tighten the feedback loop and make changes very very quickly.

The only drawback with a testing DSL is that the initial setup can sometimes be burdensome… it may not seem worthwhile, and it may even require a little devotion to get going in the beginning and require a little maintenance to be useful. One problem we have had with our new fangled group of fixtures and tests is that development was rather quick in the beginning, but then we reached a plateau where the tests became a bit fragile and required some extra hard work to maintain and improve. Another smell that arose was that our original DoFixture, which contained sentences and statements representative of the domain, soon grew to over 400 lines and felt like a God Object. :(

However, continuous maintenance and perfection improves quality, as with anything. Test DAOs solely used in the fixtures were refactored out and replaced with the real ones from the system, with a dash of “in memory” DAOs to inject when desired. The DoFixture was broken up a little bit to seperate fixtures represetnative of the different aspects of the domain being tested. And overall, to improve testability sometimes some redesign of the system was required to allow for better inspection of the system under test, which lead to a more solid API.

The final reasult? Although a little dedication was required up front and in the middle stages, writing new tests is a piece of cake. One of our customers called yesterday complaining about a missing feature that was part of a story we recently finished, but seemed not to work. How come? The tests are green. So I worked with him, and he mentioned the product code he was using was ZZZ, which was something slightly different… our test was using product code CCC, which to my knowledge represented the product needed for the story. “Oh… CCC is the product code for that product, but so is ZZZ. ZZZ is a subset of CCC, but in the context of [proprietary domain] they are essentially the same thing.” In only about 10 seconds I was able to add the product code and verify that the expected behavior didn’t take place, then my partner and I quickly fixed, ran tests, and released.

Writing new tests with a test DSL in place is so much faster, it felt like we were writing many tests quickly in later iterations after getting past the plateau of broken or inconsistent fixtures. Perhaps the only problem we have right now is our customers don’t run the tests… they just like to look at them to see what test coverage we have, which has been good because they can see at a glance what we are doing and often make corrections and comments in daily stand ups. They call our acceptance tests our “Test Plan”. :)

I’ll try to write more on Testing DSLs… I keep thinking about other possibilities outside of FIT/Fitnesse, perhaps with tools like JBehave or even with some of the languages for creating DSLs like ANTLR or OGNL.

Dr.Strangescript or: How I Learned to Stop Worrying and Love IE

July 16th, 2007 by James Carr

Sigh…. after a lengthy hiatius, I’m back on the road again to writing complex javascript and dealing with the little cross browser quirks. Naturally, a lot of my problems have been from that little troublemaker Internet Explorer. It’s like IE was designed to thwart my every javascript based move! :)

Luckily, a little googling helped me remember a lot of the important tips found in any javascript developer’s toolbox. The most important one… I want to quit seeing the nonsensical “Object expected” on non-existant line 945! Luckily, I found a quick rehash of how to turn the script debugger back on in IE, and since then a lot of my problems have been blissfully debuggable. :)

Then there is the whole browser sniffing fiasco, which should be reduced to object detection just when you need it. But, in case you have a valid reason to sniff the browser:

var isMSIE = /*@cc_on!@*/false;

Thankfully, jQuery has taken care of most my worries. ;)

Theory P and Theory D

July 15th, 2007 by James Carr

Tim Bray Reginald Braithwaite has written a VERY GOOD blog post on the two dominant modes of software development in the industry, with much to grin about and much to cry about when you recognize the different traits described of both Theory D adherents and Theory P adherents.

Some choice favorites:

“Theory D managers often “game” their workers by “negotiating” estimates downward in a cruel game of “guess the estimate I’m think of.”


Theory P adherents believe that there are lies, damned lies, and software development estimates.


Theory P adherents believe that the most important element of successful software development is learning.


Theory D adherents believe that the most important element of successful software development is planning.



Which one are you?

TDD Anti-Pattern Translations

July 8th, 2007 by James Carr

Wow… it seems my blog post on TDD Anti-Patterns has been translated! Today I found a coment that a Japanese translation is now availble, and I have also received an email that a French translation is in the works.

Cool! ;)

Overiding Singletons For Testing

July 7th, 2007 by James Carr

While thumbing through the Xunit Test Patterns book tonight, I came across a rather interesting pattern named “Dependency Lookup.” The premise was simple, and I had actually used it on occasion… you delegate object retrieval/creation to a broker rather than access it directly (i.e. factory), and then provide a mechanism to set the object you want to have returned (good for overriding dependencies with mocks/stubs). Normal stuff, I know… but what interested me was one implementation that used a Singleton, but then the test extended that Singleton and overrode the sole instance in order to return test data.

What follows is my late night, 10 minute hack to exercise the idea. ;)
Read More »

A Quick Thought On UI Testing

July 1st, 2007 by James Carr

Writing a test that checks for static text on a page or dialog that will never change based on domain logic or system behavior and then writing the text to make it pass…

That’s not test driven development. It’s just a complete waste of time and absolutely stupid. By the kind of contrived logic such tests are based on, I should be writing tests for each of my blog posts. ;)