Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML vs Hardcoded interface?

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?

like image 931
Corey D Avatar asked Aug 07 '09 14:08

Corey D


1 Answers

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.

like image 133
Welbog Avatar answered Oct 30 '22 04:10

Welbog