Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • 2
    If you're delegating everything, why not just inherit? Commented Jan 22, 2022 at 9:17
  • @PhilipKendall ApplicationState will have other functionality not related to the dimension, like stuff related to the currentState and StateChanges. So it won't just be a special case of Dimension. If for example ÀpplicationState will have 10 methods at the end and only three of them are delegations to Dimension should I inherit from ````Dimension```? Commented Jan 22, 2022 at 9:24
  • "so that I want have long method" do you mean won't? Commented Jan 22, 2022 at 9:48
  • 1
    long method names are considered a good thing(tm) Commented Jan 22, 2022 at 9:48
  • 2
    In addition to what Christophe said below, if AppState is a thing that conceptually has a dimension instance as its part, then doing this wrapping for ease of use (at the cost of more dificult maintenance) kind of undoes what you've accomplished by defining the Dimension struct in the first place. You've created a separate struct that represents the "dimension" concept in a higher level way - and now you're polluting your AppState class with details that are the responsibility of Dimension. You can always create a local ref/ptr to 'appState.dim', & then just do dim.setDimension(...). Commented Jan 23, 2022 at 2:33