ICFP2003

Matt and I both entered this year’s ICFP programming contest.. I have to say thanks to Matt since I used his GUI code with a few hacks to work on my solution. We also kicked around ideas and chatted on Yahoo in the wee hours of Saturday night.

It was tremendous fun to watch my little car repeatedly crashing into the wall and then trying again, getting a little better most times. I achieved some reasonable times in the end but nowhere near the top league of results that I have seen. I have uploaded my submission here. You are free to check it out. You’ll realize just how much I relied on Matt’s GUI. My main contribution is in the LapDriver class. Funny when you are trying to code quickly – fields quickly become public and there is lots of dead code from experiments that didn’t work out. My times were

track

1

2

3

4

5

6

7

8

9

time

10307

16346

18557

20957

6351

5399

3989

10884

Not attempted

It makes you realise just how incredible the human brain really is. Just looking at the track picture, anybody could find a reasonable path in seconds. Sure we can optimise that with a computer program and we can write that program with a little effort. But to write a program to find that initial path – that is hard. Not only that, it’s amazing how the brain can keep the rest of you going when you should have been asleep hours ago.

Speaking of programming contests, I recently heard that MacTech is stopping their programming challenge. That was a great series. I only entered it once to write a Java Virtual Machine in 1996, I think. I wrote that in C++. It wasn’t the fastest sicne I solved a more general problem than required and others used PowerPC assembler. Nevertheless I learnt a huge amount about the Java VM in a very quick time. Some of that code lives on in the Ant <depend> task, now rewritten in Java.

AdSense

Matt asks whether To Adsense, or not based on this article by Aaron Swartz.

This seems like another good idea from Google although I am a bit wary of advertising for a few reasons. To be effective, advertising becomes intrusive, almost by its nature. If the click rates drop, will Bloggers start to make the ads more intrusive. Also advertising sometimes can skew content to the more sensational and perhaps more populist points of view because that can attract more readers. Look at the BileBlog.

On the other hand, having a blog that paid for itself would be nice too. It requires more thought.

C#/.Net – first tastes

I have just done a little bit of serious C# coding and thought I’d share some reactions.

Overall impression is pretty favourable. If you are only interested in developing for Windows desktops, it will be pretty hard to beat. For GUI construction, it’s all very VB like, without the VB funkiness.

The Visual Studio IDE is really nice. I’ve used Visual Studio in a past life (C++) and I found this version to be more forgiving. In the past, some things were very hard to undo. My PC did crash horribly twice while running it. This wasn’t a blue screen, just a whole load of vertical stripes, which was pretty jarring. I’m not sure if this is related or some hardware glitch developing. Have to wait and see on that.

C# is pretty easy for crusty Java programmers like myself to pickup. It’s full of syntactic sugar, as Matt would say. Let’s hope it doesn’t rot my programming teeth, so to speak. The libraries are unsuprisingly similar to the Java libraries. I was surprised, however, by the omission of a Set collection. Using a hashtable also had some oddities as it complained when I added the same key twice. Huh? You’ve got to use the [] operator thing for that. Why not a Put method? No doubt a lot to do with my java mindset, but these little things made me feel that it somewhat immature. Alternatively, perhaps collections libraries are just degrading over time – we used to have MultiMaps in C++, after all.

The case conventions for methods, fields and properties don’t seem as consistent as Java. Might just be a case of getting used to that. It’s amazing low strongly those Java conventions have become ingrained, so much so that methods starting in upper case appear odd.

Anyway, I’ll keep playing with C# …

Ant Scripting

I wrote a little while ago about Ant as a scripting language. The question, or a variation, has come up again with Jonathan Simon’s recent article (scroll down a bit for the stuff on Ant) and Duncan’s followup. Even my local JUG’s mailing list has gotten into this.

I found the comments on the two articles interesting. There are those looking for more scripting in Ant or a separate scripting language-based build system. There is also quite a few that oppose having more scripting in Ant. Ironically for both points of view, Ant has long supported the <script> task which would allow pretty much arbitrary scripting anyway. Yet it seems to me that users are not using <script>. They seem to prefer the XML based constructs. I think that it would be interesting to understand why that is. Is it the problems of changing models/modes-of-thought between tasks and scripts? Is it the complexity of the Ant object model once you get into the script?

My own contribution to the issue is the <scriptdef> task, which lets you create tasks in your build file using any BSF-supported scripting language. I thought it gave the benefit of scripting while exposing it to the rest of the build in an Ant-centric way. I think that combining this with Ant 1.6’s <import> task will be interesting. I did wonder, however, when I committed it, whether it should be part of Ant proper or hosted somewhere else, such as ant-contrib.

I also found this interesting wiki page, AntPractices, (via Andrew Newman). It contains a bit of a rant about the Ant Way, whatever that is. All I can say is that, IMHO, the Ant dev team is supportive of ant-contrib. After all Stefan is a member of that project and it relies on features such as TaskContainer and Sequential in the Core Ant that were put in precisely to facilitate such tasks for those who wanted to go that way.

I think most of the Ant developers struggle with the balance between supporting the needs of users, many of whom clearly want logic in their build processes and the desire not to turn Ant into a programming language. The current balance is to provide the underlying enablers for tasks such as ant-contrib’s logic tasks without making these part of the core Ant distribution. It certainly doesn’t come from any sort of dogma.