Skip to main content
grammar fixed
Source Link
Doc Brown
  • 220.6k
  • 35
  • 410
  • 625

It depends on the kind of abstraction you want to achieve with your ListManager. If your ListManager is just a data tuple of 3 independent objects, the "wrapper" approach is pointless. If it provides an abstraction on it'sits own, because the the 3 objects are not independent from each other, then you should use specific accessor methods.

For example, do you want the rest of your program to get full control over the ListManager.CueList? And does this not introduce any specific pitfalls for the user of your ListManager? Then add a public getter for the CueList.

Or is it better when the rest of your program gets only restricted access to ListManager.CueList (for example, to allow only a specific subset of the CueList methods to be called like CueList.add)? Might this prevent any unintentional errors? For example, must CueList.add be always called in conjunction with some additional operations? Then use the ListManager.add(Cue c) approach.

It depends on the kind of abstraction you want to achieve with your ListManager. If your ListManager is just a data tuple of 3 independent objects, the "wrapper" approach is pointless. If it provides an abstraction on it's own, because the the 3 objects are not independent from each other, then you should use specific accessor methods.

For example, do you want the rest of your program to get full control over the ListManager.CueList? And does this not introduce any specific pitfalls for the user of your ListManager? Then add a public getter for the CueList.

Or is it better when the rest of your program gets only restricted access to ListManager.CueList (for example, to allow only a specific subset of the CueList methods to be called like CueList.add)? Might this prevent any unintentional errors? For example, must CueList.add be always called in conjunction with some additional operations? Then use the ListManager.add(Cue c) approach.

It depends on the kind of abstraction you want to achieve with your ListManager. If your ListManager is just a data tuple of 3 independent objects, the "wrapper" approach is pointless. If it provides an abstraction on its own, because the the 3 objects are not independent from each other, then you should use specific accessor methods.

For example, do you want the rest of your program to get full control over the ListManager.CueList? And does this not introduce any specific pitfalls for the user of your ListManager? Then add a public getter for the CueList.

Or is it better when the rest of your program gets only restricted access to ListManager.CueList (for example, to allow only a specific subset of the CueList methods to be called like CueList.add)? Might this prevent any unintentional errors? For example, must CueList.add be always called in conjunction with some additional operations? Then use the ListManager.add(Cue c) approach.

Source Link
Doc Brown
  • 220.6k
  • 35
  • 410
  • 625

It depends on the kind of abstraction you want to achieve with your ListManager. If your ListManager is just a data tuple of 3 independent objects, the "wrapper" approach is pointless. If it provides an abstraction on it's own, because the the 3 objects are not independent from each other, then you should use specific accessor methods.

For example, do you want the rest of your program to get full control over the ListManager.CueList? And does this not introduce any specific pitfalls for the user of your ListManager? Then add a public getter for the CueList.

Or is it better when the rest of your program gets only restricted access to ListManager.CueList (for example, to allow only a specific subset of the CueList methods to be called like CueList.add)? Might this prevent any unintentional errors? For example, must CueList.add be always called in conjunction with some additional operations? Then use the ListManager.add(Cue c) approach.