I have multiple objects that inherit from a base class and am trying to decide how the user should edit them. There are many common fields and a few fields that only apply to each sub class. Is there a design pattern to address this?
I was thinking I could have one web page for each one or I could have a single web page and show/hide the fields for the subclass. I can think of pros and cons for each one. It'd be nice to know if there's a standard way of handling it.
C# -Pipeline Style event model
Correct way to optimize repeated Rails code
Report Metadata in a Collection of [Telerik] Reports
Using this idea, you'd create a base code-behind class to cater for your base class's properties and then create classes derived from this to support the necessary UI to handle the additional properties of your derived classes..
Are there any design patterns used in the .NET Framework?
Parallel class libraries can lead to problems e.g.
What is Model View Presenter? [closed]
if you create a new derived class then you also have to create a new derived UI class etc, however if your derived UI classes are simple then this might not become too much of a problem..
PHP Web-App Design
If this is the route you go down, you would want to create a hierarchy of user controls rather than pages, then add the appropriate user control to your page at runtime..
Design Pattern Alternative to Coroutines
Which namespace does a factory class belong?
The idea being that all of the common fields go on a Main tab.
Anything that depends on the particular class goes on a tab with a similar name.. At runtime I decide what object it is and show the appropriate tab(s)..
A compositional approach to this problem would have you create a basic display control for the base data of your class (which would normally in a compositional scheme be held in a core object) and a specialized control for the specialized data (which would be held in its own separate object).. This has some advantages and some disadvantages.
The most important advantages are that you have an infinitely extensible system for displaying common data set types all the way up the class tree, and you get the normal compositional style strengths - changing the definition of the class tends to break down into smaller edits on smaller, more self-contained units.
The most important disadvantage is probably that you end up having to fracture the work into a lot of subunits rather than having a single "elegant" (elegance is often an illusion when it comes to class trees) abstraction for the class and its visual representation/serialization..