Sorry if someone asked this already, but I did not found a question with this specific scenario:
I have an entity with an status and a type. For each status and for each type, I should show the user a different page, and this page is some kind complex to create so it is created with the builder pattern. But, in some cases, these pages could be the same. And with some status, I do not need to check the type.
Some examples that could occur:
- Status 1 with any type -> Page "1"
- Status 2 with type A -> Page "2A"
- Status 2 with type B -> Page "2B"
- Status 3 with type A -> Page "3X"
- Status 3 with type B -> Page "3X"
- Status 3 with type C -> Page "3C"
I thought about implementing a factory (with an switch case for each status) that will create and return the result of an abstract factory (with a factory for each type). But, I will need some abstract classes to solve the "same page" problem in between these factories.
Do I really need this complex structure?
Aucun commentaire:
Enregistrer un commentaire