Thursday, 19 February 2009

Nullable<bool>


I don't like Nullable<bool>. The cognitive dissonance is louder and more dissonant than a Sepultura guitar solo. [3'00]

A boolean is defined as: "Of or relating to a data type or variable in a programming language that can have one of two values, true or false."

Two. Deux. Zwei. Dos.

TWO!

Not three.

But that is what exactly Nullable<bool> is. True, false and null. Three states.

What does null mean? It's got to mean something. You're either pregnant or you're not. You can't have a third state. A light switch is either on or off.

If a light switch doesn't exist then it's potentially very dangerous. Almost as dangerous as having a nullable bool.

If it has three states, it isn't a bool.

Tuesday, 17 February 2009

The Pomodoro Technique aka Tomatoes!

You say tomayto, I say tomahto.

One of the things buzzing around the blogosphere and twittersphere recently is the Pomodoro Technique.

The idea is fairly straight forward. You create 25 minute segments in which you concentrate on a single task. Nothing gets in the way of what you're doing. If you think of something during a task, or you realise that the task will need further sub-tasks, you are permitted to take a note, but you must finish your 25 minutes focusing on the task in hand. If the task takes 15 minutes, you still stick with the task. You "over-learn" it.

From the link above here's what you need:
  1. Pencil
  2. Kitchen timer
  3. To Do Today Sheet – today’s date, my name and a list of my activities planned for today
  4. Activity Inventory Sheet – my name and a unordered list of my upcoming activities in the near future
  5. Records Sheet – my sampled process metrics to be used for my process improvement
I followed Uncle Bob and bought a kitchen timer that looks just like a tomato. The problem is that it's very noisy. The ticking was starting to get annoying, so I knocked up a very simple software timer.

This is what it looks like while it's running. Note that the form title also has the time on it. This is useful because you can see how much time is left in your task bar.



When it's finished it beeps once and looks like this:



You can press start at any time to reset the timer to 25 minutes.

You can download the application here. The source code is here. No unit tests as this is a quintessential 'trivial' application.

You will need .NET 2.0 or later installed for the application, and Visual Studio 2008 for the source.

Sunday, 11 January 2009

Stephen Walther

I've been reading Stephen's blog for nearly a year now and what strikes me is the level that he pitches at. It's never patronising and it's certainly never a soap-box from which to shout about how clever he is. When you want to learn a new advanced topic such as using mocks in TDD or the new ASP.NET MVC implementation, Stephen's posts are invaluable. Even if you know a topic quite well, it's worth reading what he has to say on it as you might not be as clever as you think. :-)

There's a tonne of information out there for newbies (Teach Yourself How To Be Raymond Chen in 14 Seconds etc) and quite a few excellent blogs for getting nicely deep into a topic (e.g. the force of nature that is Ayende), but Stephen has a knack of pitching all you need to know to get you from beginner into the latest brave new world.

This is much easier to explain with a graph so here's a whiteboardy sketch.

Stephen isn't completely alone here (just) and it's not to say that all of his posts are pitched at this level, but he is the most consistent.

It would be great if more people blogged at this level. I think I might make that my goal for future posts too.

Thursday, 16 October 2008

Visual Studio 2008 Colour Schemes

In the past year, the trend to modify your Visual Studio colour theme has gained momentum. Yes it's a trendy bandwagon, but it's not without merit. After using Oren Ellenbogen's Dark Scheme (via Scott Hanselman) for a while, I now find the default Visual Studio colours a trifle harsh.

The key is having a very dark, rather than black background. I have also adopted this for my desktop backgound using 56,56,56 rgb.

Here is Oren Ellenbogen's theme updated for Visual Studio 2008 transformed using Tomas Restrepo's xlst.




To save you the trouble of the transform, you can download my version of the Visual Studio 2008 theme here. It includes a couple of minor tweaks for ReSharper.

Here's to not all looking like Mr Magoo by the time we're 45.

Tuesday, 7 October 2008

Comments Anti-Pattern

Code comments. They are good right? Well yes. However you can fall into the trap of thinking if commenting is good, more comments are better. Comments all 'round. Comments for everyone! The Milkybar comments are on me.

This is the common anti-pattern:
/// <summary>
/// Tests if an order can be prepared for printing.
/// </summary>
[Test]
public void PrepareOrder()
{
...
}
If you multiply that by every public method and or test it can make the class files look a bit jumbled.

So why not refactor by renaming the method and lose the comment?
[Test]
public void OrderCanBePreparedForPrinting()
{
...
}
or even
[Test]
public void Order_Can_Be_Prepared_For_Printing()
{
...
}
I find this far easier on the eye.

Monday, 22 September 2008

Ja! Mein Das Keyboard ist sehr gut!

I took delivery of my Das Keyboard Ultimate on Saturday. Since then I've been in clicky-clacky-blank-key heaven.

I have to say that I'm smitten. As has been noted elsewhere, Das Keyboard is very similar to an old IBM Model M. I remember a coworker being very pleased with himself for rescuing a model M from a skip outside our office. I can now see why.

Is it worth €99 + P&P? If you type for a living, yes it probably is. Amortised over its expected lifetime it's potentially the least expensive computer thing money can buy.

What's good:
  1. Lovely responsive typing action.
  2. Nerd points. Your fellow geeks will be in awe.
  3. Your typing will probably improve as you'll be forced to touch-type.

What's bad:

  1. Passwords. We all try and make them as complex as possible right? Right? Well if you do, it can be a nightmare. I plugged in my old fingerprint reader to assist with that.
  2. The noise. I'm toying with getting another one of these for work, but I don't want to be an office hate figure.
  3. Upfront cost. The current exchange rate means buying stuff from Germany is more expensive than it was. €99 + P&P equated to £90 on my credit card statement.

It was a joy typing this post. I think I'll type some more.

The slow purple fox pole-vaulted over the resting dog.

Lovely.

ReMix UK 08



Microsoft ReMix 08 was held last week in my dear beloved Brighton. This was my first time at ReMix. In the main, I very much enjoyed it. The weather was nice, I knew plenty of people there and it was good to hear Scott Guthrie talk about ASP.NET MVC, .NET in general and Silverlight.

What was right:
  1. Brighton. Brighton is a splendid place to have a conference. It was held at the famous Brighton Centre, which is a tired old 60s bit of architecture, but is about 5 minutes walk from my flat which makes up for it.
  2. ScottGu. Great to hear about this stuff from the man himself.
  3. The other presenters. There were some really interesting talks.

What was wrong:

  1. Session were pitched a little low. Everything was fairly introductory. I would like to have seen a more in-depth discussion on MVC for instance.
  2. Catering. It was rubbish. Tea and coffee were only served twice a day for 10 minutes. It was like visiting a parsimonious relative. The food was crushingly mediocre. C'mon Microsoft. You have the cash plus the tickets were about £300! I couldn't see anyone getting away with such a poor showing in the US. England is no longer the country with the crap food. Have you learned nothing from Gordon, Jamie, Delia et al?
  3. 'Sneak Peaks'. There was nothing announced. Nothing. Bar a quite a nice table that takes pictures of things, there was nothing of any value. We all felt a bit cheated. If we wanted to watch adverts, we could've stayed at home and watched E4.

I will go back. Definitely. But if I was marking ReMix at school, it would be "6.5/10. ReMix has the potential to do well if it only concentrated a bit more on the details."

Also a special mention for Mike Hadlow who had Suteki Shop displayed by Scott Gu in his keynote as an example of a local MVC project. Go Mike!