Pure Danger Tech


Code smell: List<Object>

07 Jun 2007

Recently I ran across an instance of List coming out of some framework code. Seemed odd since the framework in any particular instance should have known more specifically what was being returned. I took this little string and kept pulling till I found the source: a Filter interface that was returning results as a List. I started slapping in some ’s and a short while later things made a whole lot more sense.

So, if you’re using generics, using a List is almost certainly a sign that you working around generics instead of leveraging them to their full potential.