Archive for June, 2003

AdSense

Friday, June 27th, 2003

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.

Whales in Sydney

Thursday, June 26th, 2003

Cap’n, there be whales. Two southern right whales entered Sydney harbour overnight. It’s a good sign and pretty cool.

C#/.Net – first tastes

Tuesday, June 24th, 2003

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

Friday, June 20th, 2003

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.

Bile stains …

Friday, June 13th, 2003

The BileBlog is in full swing today and the bile is splashing dangerously close to me. It’s all good fun and this is a good opportunity to explain a few things.

Firstly let me say why Clover generates multiple files. Clover can be active in multiple VMs at the same time. Each VM will generate it’s own coverage information file. Those VMs could be running on multiple machines with different operating systems using a shared drive. Indeed it’s even possible that Clover could be running in multiple class loaders within the same VM. Could you write to a single file in those circumstance? If you could, would it be worth the testing effort to make sure it works. Since Clover has to work across multiple runs anyway, we just make it work that way in all cases. If jCoverage is using a single file, I’m not sure how they can support these sorts of scenarios. You need to look beyond your own usecases.

Now for the AntClassLoader. It is pretty ugly but, hey, one must love one’s creations. What can I say – you live and learn. In an open source project which values backward compatibility, your code, good and bad, tends to stay around for everyone to peek into.

There are reasons why the AntClassLoader is the way it is. One is that it needed to compile under JDK 1.1 which meant that some ClassLoader nicities weren’t available. Using reflection always results in ugly code. It’s a rock and a hard place – 1.2 users want to set the context class loaders etc, while 1.1 users want Ant to work for them. We kept that going for as long as we could, probably too long but we are now finally leaving 1.1 behind. The other complexities come about because I tried to make the <java> task work the same regardless of whether it was forked or not. If something causes a ClassNotFoundException when forked, users wanted it to behave the same way when not forked. They didn’t want classes visible due to Ant to be visible to their java tasks. The AntClassLoader has some features to maintain this illusion. It mostly works although it is a path leads to the vortex of Linkage Errors.

Complexity has accumulated in the AntClassLoader but a clean rewrite has its own issues. Things are in the code for a reason. Again you need to think beyond your own usecases.

The rest of the bile actually contains some very useful tips for building good Ant build files. Read it.