Archive for the ‘life’ Category

The Cat Empire

Tuesday, February 3rd, 2004

While I was back in Australia over summer I was introduced to The Cat Empire, a great band out of Melbourne. They do a kind of indescribable funk/jazz/ska/reggae/arabic mixture that really makes a mockery of the word “fusion”.

If you want a feel for what I mean, you can download a video of ‘Hello’.

But I suggest you just believe me, do yourself a favour, and pick up the CD, which has been on constant rotation on my iPod. (If you are in the UK you can get it from amazon)

.. and If you’re going to Womadelaide next month, make sure you see them live and have a dance for me.

Darren Emerson at the End

Monday, February 2nd, 2004

I spent a fun (and rather long) Saturday night at the End watching Darren Emerson of Underworld fame - finally got home around 6am to a well deserved sleep.

The show was fantastic — absolute class — mixing simple but extremely lyrical lines above really interesting and quite complex beats. There’s a definite element of “less is more”, with many fewer songs and climaxes than other DJs.

Here’s some videos from the night — starring the two Mikes. (Its amazing what you can do with digital cameras nowadays) — click on the pictures for the movies.

…and here’s some more pictures (Click on them for the full-size versions).

More reasons never to use C# enums

Tuesday, January 20th, 2004

I already hate c# enums, for reasons I have expounded on before. But I just found another doozy. Suppose I have an enum defined as follows:

public enum AnEnum
{
  One = 1,
  Two = 2
}

What do you think would happen if I tried to do this:

int illegalValue = 666;

AnEnum shouldBeIllegal = (AnEnum)illegalValue;

Console.WriteLine(string.Format("Value is : {0}", shouldBeIllegal));
Console.WriteLine(string.Format("Type is : {0}", shouldBeIllegal.GetType()));

I would expect an Exception of some sort - probably some kind of cast exception.So what happens? It works! C# and .NET will let you create a “strongly typed” enum with an underlying int value of 666, or anything you like.. Now that’s just insane. It also gives me another reason to prefer the Java style strongly typed enums.

Here’s the complete code I used to prove this:

using System;
using NUnit.Framework;
namespace EnumIsBroken{
  public enum AnEnum{One = 1,Two = 2}

  [TestFixture]
  public class EnumTests{
    [Test]
    public void BrokenEnumBehaviour()
    {
      int illegalValue = 666;
      AnEnum shouldBeIllegal = (AnEnum)illegalValue;
      Console.WriteLine(string.Format("Value is : {0}", shouldBeIllegal));
      Console.WriteLine(string.Format("Type is : {0}", shouldBeIllegal.GetType()));
    }

    [Test]
    public void NormalBehaviour()
    {
      AnEnum one = (AnEnum)1;
      Assertion.AssertEquals(AnEnum.One, one);
    }
  }
}

Night Bus at Christmas

Sunday, December 21st, 2003

Yesterday I had the best night bus experience - I caught the N38 from Charing Cross Road after the TW Christmas party, and there were (as usual) quite a few people on the inebriated side. In particular a couple of rather jolly lesbians who were trying to gee up the bus - which was packed as usual. Anyway, they started up a banter with another inebriated gentleman on the bus, and before long they had started singing Christmas Carols. And then the rest of the bus joined in. And we sang progressively sillier versions all the way back to Balls Pond Road.

I think my favourite was Partridge in a Pear Tree, which no-one could remember the words to, so it ended up going something like:

On the fifth day of Christmas my true love gave to me:
Five go-old rings,
Four na na na na
Three na na na na
Two na na na na
And a Partridge in a pear tree

It was very cool. Sometimes I do love London.

Visual editing of properties

Friday, December 5th, 2003

Some time ago when Mike was in London we had a bit of a hat about using JIRA as a tool to manage agile projects. We could enter the cards as issues and then you would have happy management. Develpers would then pick up the cards from JIRA instead, and work on them.

But of course we don’t work that way. Its ironic that we are developing sophisticated software systems using index cards, but they have some very important advantages over issue tracking systems and other electronc management tools.

  • Cards are concrete — well paper actually, but what I mean is they can be shuffled, passed from hand to hand, shoved around the table, placed in piles, crossed off or even torn up.
  • Stuck on the wall they are visible — and when you place a big bold cross on them you can easily see how many you have done.
  • A pile of cards on the todo pile gives visual cues of the amount of work left — big pile or small pile.
  • You can stick task cards under the story cards to which they relate.
  • You can staple related cards together
  • you can move cards into different areas to indicate different priorities — in our project higher up the board means higher priority
  • different areas of the board have meaning — ‘ongoing’ cards and ‘targets of opportunity’ each have their own area on our board

All good reasons to use cards. But I got to thinking about it, and there’s nothing there that you couldn’t actually do in code. And if the paradigm (ugh) works well for cards, why not for other things?

Imagine a “surface” with a set of “things” — little boxes with text in them or whatever. You could associate an axis on the screen (say the y axis) with an attribute of the “thing” (say priority). Then dragging the “thing” up or down the screen would change the priority of the thing itself.

Or define a “region” of the screen to be associated with a particular value of an attribute — following the story cards idea lets say that you have a region for each iteration. Then dragging a card into that region would set the iteration on it.

But of course the “things” don’t have to be cards. Say you are managing a unix system with many processes. Dragging a process up or down might change its priority.

And such a system could layout the things for you — so if you went into some other system and changed the card’s priority and came back to the visualisation, then the card should have moved.

So I guess what I want is a generic visual layout engine that lets me do this sort of thing — almost a two-way dot

Does anything like this exist or am I going to have to write it? :-)

What is the most dynamic language?

Monday, December 1st, 2003

I love Ruby. Its elegant, simple, clean, powerful and dynamic.

Python is pretty cool too, but its not as good as Ruby — its OO support seems ‘tacked on’ — I mean passing around self references? Come on!

But developing in these languages is nowhere near as good as in my favourite dynamic language — Java. Or rather, Java+IntelliJ.

Huh? Java is not a dynamic language is it?

Well not strictly, no. But in terms of the way that I develop — using IntelliJ to help me code — it might as well be.

If I were developing in a text editor with only a little support for the language, then Ruby would win hands down. I can create properties (getters and setters) really easily, things like the command pattern, implemented as Runnables in Java are elegantly expressed as blocks in Ruby. All of this is way cool and very very productive.

But I can’t refactor automatically. I can’t even rename a class and be sure that all references have been changed. And I won’t find out until runtime. Search and Replace just don’t compare to a Rename refactoring — and don’t even get me started about Move.

I am more productive in Java+IntelliJ — because the combination makes up for Java’s verbosity.

And that’s my point. Good code is not about using a smaller number of lines to achieve a particular piece of functionality. It is about how efficient and easy it is to maintain that code, to refactor it and keep it lean and simple. And that is much more dependent on the tools that you use than it is on the language you use.

Of course by ‘tools’ I don’t mean wizards and drag and drop abominations like Visual Studio or JBuilder. I don’t want a clippy that thinks it can write code better than me. I want a tool that helps me write code, so that I don’t spend valuable brain time writing code that is obvious.

The best way for a tool to present code to me (the coder) is as code. Isn’t that obvious? I don’t want to have to learn a new language (the language of yet another GUI bean wizard for example, or yet another GUI UML refactoring tool) to do something as simple as creating a getter or setter. In IntelliJ I just type x.getFoo() and press [Ctrl-Enter] and it does it for me. No guis, no mouse, nothing to distract me from the code.

Working with a tool like that is a joy — a tool that helps me write code efficiently rather than trying to write code for me. And that is dynamic code.

Off to India

Monday, November 24th, 2003

I just found out that I will be going to India in January for 6 months.

I’ll be working for the ThoughtWorks India office on various of our projects out there. I have been wanting to so this for a while — and we’ve now made it happen.

Its going to be a challenge, both personally and professionally, but anyone who knows me will understand how much I am looking forward to soaking up the culture while I’m there.

Wireless!

Wednesday, November 19th, 2003

OK so I now have a wireless access point for my new ThoughtWorks laptop. Boring I know —I can now blog without cables. Very cool.

Incidentally, I love the fact that devices all have web pages for configuration, it makes installataion a breeze — open the manual and find out the IP address and bob’s your uncle.

Data object memes

Monday, November 17th, 2003

At the codehaus HausParty James Strachan, myself and a few others got to thinking about O/R mapping and Groovy.

We came up with the idea of extending the GPath syntax to allow us to specify strongly typed queries.

For example, assume that you have a collection of Person objects called people. In Groovy you can do the following to get all people with the surname ‘Bloggs’ who are over 21:

bloggsOfAge = people.findAll{it.lasName=='Bloggs' && it.age>21}
//iterate through the returned values
bloggsOfAge.each {
//do something
}

What we are trying to allow in Groovy is to specialise the collection class that will at runtime turn this into an SQL query:

SELECT * FROM Person WHERE Person.lastName='Bloggs' AND Person.age > 21

Its a fairly simple transformation, and what it gives you is very powerful — a query that is checked at compile time, not runtime.

Of course we could also turn this into some kind of xslt/xpath:

<xsl:for-each match="//Person[@lastName=='Bloggs && @age>21']">
<xsl:apply-templates select="."/>
</xsl:for-each>

But it gets cooler. In Groovy and similar languages you can build these objects dynamically. Groovy GPath works on HashMaps for example as well as real objects. And I don’t think its clear that using real objects (aka O/R mapping) is the best way to do this kind of db stuff. Maybe this kind of dynamic object construction is better?

Note that the key difference with current query syntaxes like JDO/EJBQL is taht they are just strings and therefore not checked by the compiler. There is a lot more difference between:

doQuery("it.lasName=='Bloggs' && it.age>21");

and

findAll {it.lasName=='Bloggs' && it.age>21}

than a mere absence of quotes.

James tells me that he’s been talking to people at the Apache Conference about the idea. I think if the idea flies we whould be able to write trivial adapters for other persistence technologies like Prevayler and OJB

Here’s a bit more of the zeitgeist:
Ted Neward
James Strachan
Smalltalkers with the same idea
The GPath wiki page
James Strachan’s post explaining GDO

R+J

Friday, October 31st, 2003

Went out to see R+J last week with some friends. It’s an ‘updated’ version of Romeo and Juliet. In this case updated means it is set in a boy’s school and performed by 4 boys at night while the rest of the school is asleep.

Apart from this context, the play is almost untouched, although of course the ‘boys’ take all the roles in the play. This is not so jarring as it might seem — although maybe that is just me — I have seen many cross-cast and small ensemble productions over the years.

I really like this approach — theatre is about suspension of disbelief, and without challenging the audience to suspend we may as well be watching TV.

This production used a minimal set — just two chairs, a small chest and a red cloth. The direction is hugely athletic, appropriate for characters going through their adolescence. The characters leap and wrestle their way through the text.

The conceit that they are adolescent boys adds an interesting layer to the play. When Romeo and Juliet have their first love scene, the others make fun of them — cat calling and teasing the boys for their affection. But R+J call their bluff — the affection that was awkward seems to become natural and real — and the others can no longer make fun of it. By the end of the play we beleive and feel for their love.

I won’t summarise the whole play — we all know the story — suffice it to say that it is a worthy and interesting version of the play.

I just wonder what the Eton boys in the audience thought about it.