1

This question already has an answer here:

When is it advisable to write a class that can do multiple things?

A bit of background: my boss prefers to write things that can be used over and over again. While I tend to agree with this sort of concept (OOP and all), there have been some instances where trying to do such a thing causes, what seems like, extraneous programming.

For example, I've written some simple classes such as date pickers, date range pickers, PDF viewers, and such which serve their purpose very well without any extra programming.

The examples where things get complicated seem to be when I try to adapt something that is easier done in the designer (such as a grid). If I try to use the same grid with multiple data sources, I end up having to program all of the aesthetics like column names, width, etc. To me it makes a lot more sense to create a separate class and deal with the aesthetics in the designer. I mean, that's what they were made for.

Maybe I've answered my own question: use a separate class when there is a lot of designer work. Use the same class if the visual will remain unchanged.

Is there a concept I'm missing here? Or a general rule of thumb?

marked as duplicate by gnat, Community Oct 3 '16 at 20:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.