What is the best structure of relationships and interactions between classes in task with two line of development of the system, where the implementation of one part depends on the second?
For example, I have several types of Tree
's. Each Tree
gives a fixed number of fruits (this number is different for each tree). There is also a Fertilizer
that increases the number of fruits on the tree by a fixed number of m
. Moreover, m
depends on the type of Tree
. Tree
's and Fertilizer
's can be combined as desired.
The challenge is to find out the number of fruits in each Tree
. At the same time, I would like to make a minimum of changes when adding new Tree
's and Fertilizer
's.
Is there a way to solve this problem elegantly using OOP (perhaps design patterns)?
Aucun commentaire:
Enregistrer un commentaire