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*

11
  • "BrakeSystem should also expose BrakeLever" can you expound more on how you would do that? Commented Nov 24, 2019 at 7:32
  • I edited my answer, BrakeLever should be a public property of BrakeSystem Commented Nov 24, 2019 at 7:36
  • Would aggregation still work? Correct me if I'm wrong, but if I use composition, it would mean that the BrakeSystem would not exist if Bicycle does not exist as well, right? Commented Nov 24, 2019 at 7:44
  • That is the idea. Why should BrakeSystemexist outside of Bike? Commented Nov 24, 2019 at 7:49
  • 1
    @LeeMerlas: This is a contrived example, so it doesn't make sense to overanalyze it in this way. Whether something is an aggregation or a composition entirely depends on how you conceptualize the model, since you are the one doing the modeling. "Why should BrakeSystem exist outside of Bike?" - if, because of the nature of the programming problem you are trying to solve, your program needs them to have an independent existence, they can (say, you might want to have different models that you can fit on different bikes). So, again, it's contrieved, don't overthink it. Commented Nov 24, 2019 at 11:33