Simberon Design Minute
 

Sweeping it Under the Carpet

I was recently tracing down a problem in client code when I saw something strange going on. An operation that should have raised an exception and stopped, actually worked and continued running. As it turns out, somebody had implemented a method that caused the problem to be quietly ignored. In this case, a Smalltalk developer years ago had a problem where a variable contained nil and was reporting a does not understand to a do: method. To solve the problem, the programmer implemented do: for UndefinedObject to just return nil. This solution just sweeps the problem under the carpet. It also hides similar problems in the future. Now we can't easily fix this problem properly because we don't know how many other places rely on this assumption and would break if we fixed it. It's always best to take the high road and solve the problem properly.

Download