April, 2008

Spec#

Spec# is a C# based language from Microsoft Research. It extends the language by adding comprehensive support for Contract Based Programming, with new keywords such as assume, require and expose.

Configuration Manager in Visual Studio Express

Update, August 2010:
The tip detailed here does not work for Visual Studio Express 2010

This one has been bugging me for a while, so I'm very glad to find a fix.

The defaults for Visual Studio Express have the Configuration Manager hidden, I guess on the justifiable basis that most users of VS Express would just be confused by it.

Copy Error Dialogs

Here's a quick tip I was shown by a friendly Help Desk guy this week (thanks, Ben!).

Next time you get an error dialog from some random piece of software, don't reach for a pen to write down the relevant details.

NAnt Naming

I'm a firm believer in making the computer work harder than I do. The Pragmatic Programmers call this Ubiquitous Automation - whatever can be automated, should be automated.

While I love the fancy sound-bite, to me the idea is one of common sense - if something has to be done the same way every time, a computer is going to be much more reliable and predictable than a human.

User Settings Gotcha in Visual Studio

Found an interesting trap when configuring settings for a screensaver I'm working on.

Git

Today I was listening to a recent episode of Hanselminutes, where Scott Hanselmann interviewed three guys from Planet Argon about the source control tool Git. I originally heard about Git some time ago and didn't pay it any heed - having heard the show and done some follow-up research, I'm beginning to think that Git would be worth further investigation.

YAGNI is no excuse to be lazy

There's one thing that really really bugs me about Agile development ... well, ok, there are several things, but today I'm focusing on just one ... and that's the thinking around YAGNI.

In case you're not familiar with the acronym, it stands for You Ain't Gonna Need It.

The End of an Era

My Business Card

I saw the news in the technology section of the newspaper this week that Compudigm is no more.

Back in the days when I was a Delphi specialist, not a C# one, I spent a couple of years working for Compudigm as a developer.

I learnt a lot at Compudigm about, well, a lot of things - working with smart people has a way of helping you get smarter yourself.

Conditional Compilation

Now here's a trick that I didn't know - you can use the [Conditional] attribute to suppress a method unless a given symbol is defined at compile time.

From the MSDN documentation:

Applying ConditionalAttribute to a method indicates ... the method should not be compiled into Microsoft intermediate language (MSIL) unless the conditional compilation symbol that is associated with ConditionalAttribute is defined.

Mostly of use when you're writing logging and other diagnostic code - indeed, major use in the framework seems to be in the Debug and Trace classes.

Renaming WPF Windows

So, I wanted to rename a window in a WPF application - a prototype I'm working on.

First, I rename the code in the .cs code-behind file. Then, I change the Class attribute on the root element of the xaml file.

 

Cool, thinks I. A quick compile, no errors, everything looks good.

But, when the application is run ... I got an error dialog saying “There is no source code available for the current location”:

wpf001.png

Eh? I thought the technology was called WPF, not WTF!

Open for Comments

write.png

There's always the possibility that I'll regret doing this, but for the moment, the site is open for comments.

A Better Property Snippet

One of the less well known features in Visual Studio are the snippets - fragments of code ready for insertion into your code at a moments notice. In Visual Studio 2005, the prop snippet was a very useful way to declare new class properties, but in Visual Studio 2008 they crippled it. Since you can create your own snippets, I created a better version of prop that works the way I want.