Archive for March, 2008

Death of a giant

Friday, March 21st, 2008

Arthur C. Clarke died yesterday (OK, the day before yesterday) at the grand old age of 90.


One of the last of the Golden Age writers, one of the best and most foresighted, and probably the most optimistic. He will be missed.

Static typing and correctness

Wednesday, March 19th, 2008

I've been pointed to a post by Joel Spolsky advocating Hungarian notation so that code that fails to properly sanitise strings "looks wrong".

Here's Joel's example. The idea is that you prefix the names of all string variables and functions returning strings with either "s" or "us" depending on whether they're safe or unsafe respectively. Then assignments that have "s" on one side and "us" on the other just look wrong.

us = UsRequest("name") // ok, both sides start with US
s = UsRequest("name") // bug
usName = us // ok
sName = us // certainly wrong.
sName = SEncode(us) // certainly correct.

Well I can think of one pitfall already. How do you mark whether a function expects safe or unsafe data in a way that makes wrong code look wrong?

us = UsRequest("name") // okay
RandomMangler(s) // okay
RandomMangler(us) // errm... wrong?

If you're using a language that supports it, there is a far better way. (more...)