Last year i was involved in a large Windows Forms project that had heavy use of Infragistics' NetAdvantage controls. Some of the complex requirements demanded the flexibility and additional functionality the NetAdvantage controls offered. One of this included the dynamic display of question/answer choices questionaire scripts in an UltraGrid.
What this means is that the first column shows the question, while the second column gave users choices on how to answer the question. The key thing here is different types of questions yielded different types of answer controls: text box, drop-down lists, combo boxes, check boxes, etc. So the program must parse the type of each question and render the appropriate set of controls on its corresponding answer column.
How I went about this is to define a base class that typically puts a TextBox in the Cell it is supposed to handle. Out of that I derive a variety of sub-classes that render a different set of controls accordingly to question type. I shall not go too deep into the rest of the details.
My question is, what type of pattern would you consider this to be?
It is not exactly like a Decorator since that tends to be a passive decoration of controls, and a Strategy tends to be deeper in application/business logic (at least these are what my understanding makes me think of them). This is UI-level polymorphism. Does that somewhat make it a hybrid? "Strategic Decorator" ? :-)
The melody of logic will always play out the truth. ~ Narumi Ayumu, Spiral