... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)


Up-calls as a Code Smell

Of late, I've been doing a lot of class hierarchy refactoring (in Java).  I think that "up calls", methods that call a method in a superclass, are bad news.  Calling the super implementation of a method or constructor is not so bad (being the Java equivalent of a Beta inner invocation).  At least, it is no worse than having implementation-inheritance in the first place.  But I have observed that if a class calls any other method from a superclass, then the code is usually messed up: hierarchy inversion, is-a/has-a confusion, too many responsibilities, or some other sin.  Thus, the presence of an up-call is a code smell which should make one step back and think about refactoring.

Disclaimer: I'm talking about API here, not SPI...

Blog Archive