Saturday, August 12, 2006

Gross Code

Mike Bowler finds some gross code. Unfortunately, there's tons of examples in the JDK. My favorite has to be the Collections class in java.util. Why you ask? For example, the method sort(List) really should have been on the List interface. I also don't like the fact that it modifies the List and doesn't return a copy. I'm of the opinion that utility classes are usually a warning sign of lazy design. I understand that you do need them, but I try to hide their usage behind my objects. I never expose them.

1 comment:

Blaine Buxton said...

I agree with your points. It's just that if the low level code is sloppy, it usually is a good indicator to look at the design too. Care should be taken at all levels. We are crafts people.

I generally don't get stuck on every detail (I do let some things slide), but I do scrutinize sloppy low level code more. I usually don'y get upset until a lot of guidelines are broken. One or two violations don't bother me and I don't expect perfect code.

I would rather have elegant design as well, but lack of detail at the low-level usually means lack of detail at the design level as well.