Flexible Enumerations 7

Sometimes enumerations in .NET just don’t cut it. In the end they’re just a numeric value to which a piece of string metadata is attached to some of the values. Consider the following enumerations: public enum OfficeLocationNames { London, Edinburgh, Redmond } public enum OfficeLocationCodes { LON, EDI, RED } What are these enumerations actually trying to say? I see these and think that there are three office locations, London, Edinburgh and Redmond, and each has a name and a three letter code, i.e. one type of thing, an office location, with two pieces of descriptive information about that thing, name and code. But using enumerations has forced us to define two things, when it’s really one. So what solutions are there? Here’s one solution I like. I’m sure there are more, so feel free to suggest variations or completely different patterns in the comments. First off I define an ...

Snow Fun

Well it won’t have escaped many readers from the UK (assuming I have readers outside the UK!) that it’s been snowing here, quite a bit more than it would normally for this time of year! So Joanne and I took Isaac out for his first experience of snow. He, of course, slept through the whole walk through Lily Hill Park, but here’s the photos for posterity. And just for good measure, here’s a couple of shots I took this morning waiting for a train from Martins Heron into London. I think the pink hue is due to the fact that cameras in mobile phones don’t have UV filters! The train, by the way, did turn up on time, but arrived quite a bit late and was rammed full of people quite quickly. Obviously the wrong kind of snow.

And Can It Be…

With apologies to Charles Wesley. My chain fell off, My bike ran free, Rolled down the hill into that tree. My chain fell off, My bike ran free, Rolled down the hill into that tree.