The first thing that works

I've been reading Steve Krug's excellent book, "Don't Make Me Think". This explains that people looking for something on a website click on the first link that looks like it might be what they want. They don't read everything on the page, and consider carefully which of the similar items it might be.

I realised that I write code in a similar way. I don't initially spend time reading about (let's use a really simple C# example) all the ways of concatenating strings; how they work, what the performance is like, how much code is required, best practice etc. I would start to read about strings, and may first come across the + operator, which sticks one string onto another. I'd try it out, and if it works, I would use it and move on to the next task, which might be adding some integers together.

In this example, I would completely miss the StringBuilder class, and I wouldn't know if it is faster, when it is more appropriate than +, or even how it works.

Refactoring (at least, using the refactoring menu in Whidbey) only provides "move stuff about" options, not "do this a better way" options, so if the project allowed time for extensive refactoring, I'd still miss the StringBuilder class.

How do I get round this? By general reading as well as specific reading. I currently have 102 feeds in my news aggregator, mostly .NET and development related. I read paper books about .NET and general programming issues, and articles on other websites. If I didn't, I wouldn't have heard of the StringBuilder class. As I have read it somewhere, when I come to tackle concatenation, I have some ideas before I even start.
12 January 2005