Windows World

Well, I never would have seen it coming, but I’m now doing my first really serious Windows programming. It’s for work, of course – not for pleasure. And I know I’ve programmed for Windows before, but that was in Visual Basic of the pre-.NET variety and ASP.NET. Now I’m actually writing Windows applications and tools.

It’s definitely a different experience to developing for Mac or any of the *NIX platforms I’ve got under my belt (Solaris, FreeBSD, Linux), and I don’t mean that in a negative way. It’s just really, really different. Sometimes I think “that’s really sensible” and sometimes I think “what were the MS boys smoking?”

Here are some random thoughts from the experience:

  • The .NET APIs are a hell of a lot better than the Win32 APIs. Microsoft really are lifting their game. I don’t agree with all the decisions made about how .NET has been done, but they seem to be reasonably consistent, and things make sense. With Win32, you’re always lost – never knowing where you should be looking or what you should be calling.

  • C# isn’t a bad language. I like it better than C++ (that’s not hard), and obviously a lot better than Visual Basic (that language should be buried), but I don’t like it as much as Objective-C. You can see that there has been some rational thought put into the language design. They’ve tried to make it harder to make common C errors. You notice it in little things, like the way you need an explicit goto to fall through in a switch statement. You have to explicitly break out or fall through – you don’t accidentally fall through because you forgot to break out. There are lots of nice things like that. But I really, really, really miss labelled arguments.

  • The Windows Form Designer is utter crap. It should be thrown out and build again from scratch. Who the hell decided that the toolbox should obscure the for you’re working on? They deserve to be shot! The grid is useless. Give us real alignment guides! I don’t want my controls aligned to an arbitrary grid – I want them to align in a visually pleasing and user interface standards-compliant manner. The grid makes it next to impossible to align the baselines of a text box and its associated label. Microsoft, take a look at Interface Builder. This is one place where Apple really does have it right.

  • Automatic indenting and reformatting of code is evil. I thought I left that behind when I stopped using THINK Pascal (memories of a different era come flooding back). I want the code to stay the way I leave it, thank you very much. The worst cases are when I’ve broken a long statement across several lines. I try to make it as readable as possible, but Visual Studio does its best to thwart my efforts.

  • The way the form designer generates code is interesting. You draw the UI, and it generates code to make that UI. This is very different to Cocoa nibs and their “freeze-dried” objects. The Cocoa way depends heavily on reflection to reconstitute the objects at run time; the .NET way avoids the need to use reflection at all. The big disadvantage I see in the .NET way is that you have to subclass Form every time you do a window layout. You can’t completely separate the controller layer. In Cocoa, you only subclass NSWindow when you actually want different basic behaviours (like full-screen borderless windows).

  • Delegates seem like a very roundabout way of passing a method call around. Objective-C’s @selector() operator feels much more elegant.

  • I still don’t see why ArrayList isn’t a subclass of Array and StringBuilder isn’t a subclass of String. Oh, and I find it painful that String and string are distinct types.

  • Is int an object or not? Sometimes I can use it where Object is required, suggesting it might be a subclass of Object (like when I want to store it in an ArrayList), but other times, it seems to be an atomic type. Can we make it clear one way or the other?

  • Named properties with defined get and set accessors are cool. I like them a lot.

  • Bonjour for Windows actually works as advertised. Apple making software that plays nicely with the opposition. I never would have expected that.

This entry was posted on Wednesday, 19 October, 2005 at 12:10 pm and is filed under Development, Technology. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One response to “Windows World”


TestName says:

Test myfunction comment

Leave a Reply