9 Nov 2008


I came to C# from a strictly OO Java background, and I have to say it's been a transition that has been straightforward and difficult in equal measure. The easy part is that after years of J2EE development I'm well versed in the joys of encapsulation, decoupling of classes and a few handy design patters. The syntax is nigh-on identical too, once you've got your head 'round the fact that Microsoft seem to be encouraging reckless use of capital letters.

The difficult parts... Where do I start? Where on Earth is the point in the virtual keyword? Why should I have to use override - why wouldn't I want to override a method with the same signature?

Then there's the matter of serializaton. XNA insists (with good reasons of performance and volumetrics) that all content should be serialized in a separate project as part of the build process. This of course involves writing at least two extra read/write classes per class that you want to serialize, neither of which support inheritance properly so you have to repeat functionality all over the shop. And you have to leave 'attribute' markers all over your code to tell it what to serialize. And if you want to read/write data on the Xbox 360 (which is my target platform after all), you have to use a completely different serialization procedure which doesn't support obscure and useless classes like, ooh... Say Dictionary (Map in Java).

The outcome of all this is I've spent the last two days trying to write a Dictionary to a file. In Java, this would've all come out of the box.