lundi 30 mars 2015

Software Design Pattern for Master Detail

Can anyone suggest a design pattern for a master/detail UI? Basically, I have a master page that shows a collection of items. You can select an item, delete, add, edit. When you add or edit, it will show the Detail UI, where the single item is edited and saved.


The master has the basic functionality of -



  • getItems (collection)

  • getItem

  • deleteItem


The detail has the functionality of -



  • getItem

  • saveItem


Many different objects in my application will have this same pattern; they are just different types. My natural tendency is to create two generic base classes that do as much of the work as possible - BaseMaster, BaseDetails class


and just inherit from them from each object type. However from experience I find that you put too much code into the base classes and end up fighting around the functionality of them.


I was thinking some sort of dependency inject/composition over inheritance idea would be the way to go but cannot quite picture it fully.


Aucun commentaire:

Enregistrer un commentaire