tags:

views:

134

answers:

2

I'm working on a flexible GUI application that can have ~12 varied layouts. These layouts are all well-defined and won't change. Each layout consists of multiple widgets that interface with a DLL using bit patterns. While the majority of the widgets are the same, the bit patterns used vary depending on the interface type being presented.

My gut instinct is to use inheritance: define a generic 'Panel' and have subclasses for the different configurations. However, there are parts of the interface that are user-defined and are spec'd to be specified in an XML file.

Should the entire panel be defined in XML, or just the user configured sections?

+10  A: 

YAGNI: Design your screens for the current requirements, which you specifically state aren't going to change. If a year down the line more customization is needed, make it more customizable then, not now.

KISS: If using XML results in less overall code and is simpler than subclassing, use XML. If subclassing results in less code, use subclassing. Experience tells me subclassing is simpler.

Welbog
+1  A: 

My feeling is that you should do whatever will give you the greater flexibility to change your mind, add new features or adjust the layout in the future.

rikh
Dangerous advice. Program in the future tense, yes, but always preferring flexibility can create a maintenance nightmare without any actual benefit.
gimpf