I am doing a small application for a neighbour and quite confused about the design at the moment. It looked pretty simple to start with, yet now I am stuck. I understand the inheritance and thus,
- All gifts must be wrapped.
- Gift is an abstract class.
- Wrapping Style is an abstract class.
- Birthday gift inherits from Gift.
- Origami Style inherits from Wrapping Style.
Scenario: User gives a gift to the shop with its identity (e.g. bday for family, bday for colleague). So there's a birthday gift that is for a colleague, which is different from a gift for a family. User specifies which wrapping style they like to use. (e.g. Origami, Western) In this case, let's say birthday gift for colleague must be wrapped using a birthday style under Origami.
But how can I connect gift with wrapping? At first wrapping looks like an interface to me. So a gift implements it. But the fact that wrapping each main wrapping styles has sub wrapping styles makes it complicated. How can the gift object birthday for colleague knows which interface to implement? It seems like birthday, wedding supposed to be abstract classes too, since only 3rd generation of gift class is a concrete class.
How can I get this design to make sense yet easy to code now and have room for modifications/improvements later?