Sometimes I look at a piece of code and find it hard not to sigh, especially when the developer has done something the hard way.
Take this piece of code, for example:
For reference, here’s the declaration of the CreateKey
function:
Do you see the problem?
The developer’s working too hard - writing by hand code that the compiler should generate instead.
The key is the params keyword - instead of taking a couple of minutes to find out what the keyword meant, this developer ignored it and wrote code the long way over and over and over again.
Just for the record, here’s what the code should look like:
My rule of thumb: Don’t assume that because I don’t understand something, it’s irrelevant to me.
Comments
blog comments powered by Disqus