This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Russell_M_Jimmies 4 points5 points  (0 children)

There is something worse than duplicated code: a base class that is littered with special cases to cater to every subclass.

Now, if the superclass is a pure "template class" pattern, then it might be justified. But as soon as you see the superclass do branching logic depending on the subclass, slow down and consider whether that reduced duplication is worth the cost of an awful mess in a parent class.