Programming

Stuff relating to the techie things I do for a living.
On the state of ASP.NET development

There's an interesting discussion at Rob Conery's blog about the differences and divisions between .NET development and other (mainly web) technologies. There's always a little bit of me that despairs when I see these sort of discussions, in which the ALT.NET community in particular have a habit of indulging. It often brings out the worst kind of "I've escaped from the cave because I use this platform, and the rest of you squares are just too dumb to see that you're still stuck in the dark watching the flickering shadows of what's out here" nonsense. MVC guys have this attitude to...

posted @ Tuesday, June 22, 2010 3:30 PM | Feedback (5)

Dysfunctional JavaScript

jQuery is, quite rightly, lauded for providing a way of coding JavaScript for web browsers that just works. It pushes you relentlessly towards the pit of success, making simple things easy and difficult things possible. But if there's one niggle I have with coding jQuery, it's the anonymous function noise level. Every block of jQuery code is wrapped up in $(function() { ... }); and inside that you're constantly having to nest yet more anonymous blocks: $(function() { $('div.clickable').click(function() { ... }). }; (Aside: I see a lot of people coding jQuery who don't use the $(function) shorthand to hook up document ready handlers. There's NO NEED...

posted @ Friday, August 14, 2009 10:16 PM | Feedback (5)

Dangerous Ideas in C# No. 1: A 'Better' Switch

Switch statements are rubbish. Only work on strings and numbers. Require an exact match value. Let’s abuse, oh, to pick a C# feature at random, collection initialisers, and use it to make them better! string switchValue = "house"; switch (switchValue) { case "hello": Console.WriteLine("Value was hello"); break; // But how can we handle, say, all other strings that start with h? default: Console.WriteLine("No match - Fallthrough"); break; } // here’s one way: new Switch<string>(switchValue) { { "hello",...

posted @ Friday, May 23, 2008 9:57 AM | Feedback (7)