Friday, 7 June 2013

Should I write a wrapper within a manager object?

Should I write a wrapper within a manager object?

I have three classes that work together to do one function (from the perspective of the rest of my program). There is a little bit of set up between them, so, to make it easier for the rest of my program, I grouped them into a ListManager object, which initializes them to the right values when it is constructed. The three objects it stores are: Timer, TriggerManager, and CueList. CueList is a linked list with the usual getters and setters that come with that. TriggerManager is basically a wrapper around an ArrayList that manages Trigger objects. Since the rest of my program is only interacting/referencing the TriggerManager class, should I write wrapper methods for the objects it manages? So should I make ListManager.add(Cue c) as a wrapper for CueList.add(Cue c). OR should I just add getters for the three objects and let the rest of my program use that to manipulate them.
I tend to think that the later option is far more maintainable, but at the same time, the code produced if I make the wrapper just seems... prettier...
What's the best practice in situations like this?

No comments:

Post a Comment