Blog highlights

I enjoyed myself with this trip through my blogging history, but I guess something you’d like to see is some highlights of what I’ve written about. Here’s the greatest hits of stillbreathing.co.uk (in my opinion, of course).

*Sniff*. Good times.

Protecting your bits

My car is poorly. Yesterday there was a “big metallic bang”, according to my wife, and then it started “clanking”. Gotta love these technical people! The guys at Kwik Fit soon diagnosed the problem: the front passenger side coil spring had snapped. Great, more expense. And all due to the state of the roads. Thanks, local council.

But one thing the Kwik Fit bloke said interested me. Looking at the broken spring he commented how it was good the car manufacturer had started putting a plate at the bottom of the spring, as in days gone past springs would snap and go through the tyre. That would, obviously, have caused a serious accident. But the spring fortunately broke in a safe way, and I’ve got a reasonably drivable car.

When writing software we have to do the same thing. We code for the possibility that bits will break, to protect other bits and the application as a whole. There are a number of ways we do this, here’s a quick list of the ones I can think of.

  • Ensure that if we’re going to use a variable, it is set
  • Check the type of variables: if a variable must be an int then make sure it is an int
  • Checking whether we need to do an operation at all, for example not looping a collection if there’s nothing to loop
  • Checking a collections length before trying to get an item with a non-existent index
  • Catching exceptions
  • Providing meaningful error messages
  • Persisting form information so users can try again if their submission doesn’t work
  • Checking variables are within the required range, for example validating a birth date

And there are probably loads more, including ensuring that the UI looks and functions reasonably, even if the user doesn’t have the latest, greatest browser.

With all of these things we’re aiming to ensure that if something breaks – and it will, let me assure you – it doesn’t cause an accident. Car manufacturers have figured this out, and rightly so as they have a responsibility towards the safety of road users. I don’t want to think of how many tires were blown before they added those safety plates.

Here’s an old, but true, saying; an ounce of prevention is better than a pound of cure.

I’ve been certified

It’s been a good week, for several reasons. One of them is that I passed a Microsoft exam: Developing web apps in .Net 4. That means I am now (drum roll) a Microsoft Certified Technology Specialist. I’ve been building websites for 14 years, give or take, so it’s about time I had some kind of qualification in it.

This is, to put it bluntly, an unexpected turn of events. For much of my career I’ve treated the Microsoft-based things I do in my day job as “just” work, and my real passion has been the Open Source web development I’ve done in my own time. When those two worlds collide, which they do occassionally, it always feels a bit strange. The most obvious example of my day job and personal work coming together is my Performer JavaScript library, which I use on every project I can.

So why the dismissal of Microsoft web technologies for so long? I guess it’s because, for much of the lifetime of ASP.NET, they just haven’t been very good. ASP.NET fundamentally ignored the way the web was designed to work for a long time (I’m talking ViewState and WebForms) but I have to admit it also introduced many fantastic features as well. Templated controls and MasterPages are just brilliant. For this and more of the good stuff refer to my articles on Nettuts.

But now, well, things have changed. ASP.NET MVC is a cracking bit of kit, and Microsoft’s embrace of Open Source – particularly jQuery – has changed many opinions about the Redmond behemoth. Plus the fact that finally we’re beginning to see versions of Internet Explorer that don’t suck. Although much of the industry press is still about open technologies, like WordPress, JavaScript and RoR, it no longer feels faintly embarrasing to me to be a Microsoft developer. Yes, thing’s have certainly changed.

So here’s to the future. A future where all companies, technologies and platforms can work towards making the web more open, accessible and useful in people’s lives.

Initial2: Tame your CSS

Just a quickie. I’ve often used the great initial.css stylesheet from Faruk Ates (site currently down) and Robert Nyman which allows you to initialise basic styles on a page (it resets margins, line-height etc). A long time ago I added a few extra classes that, I suppose, for the very basics of a CSS framework. Nothing fancy, certainly not like the 960 grid system, but useful all the same.

Take a look at the demo file here. You can also download full-fat or skimmed versions of the CSS file.

Business case for web standards

Here’s something I’ve been meaning to blog about for a long while. So long, in fact, that the wiki was last updated over 18 months ago. Still, it contains loads of great information for standardistas wishing to promote web standards in a business.

The business case for web standards wiki initiated by the great Chris Heilmann is the place to be. If you’ve had success, or heard arguments against using web standards that aren’t yet in the wiki, please contribute.

Together we can change the world. A bit.