I'm refactoring the price calculation of a car and tried to use the decorator pattern. This worked well for the price of the car, but to this price I should add (with ajax) other prices for the extra equipments, which each should be calculated also using his own pattern decorator.
So the question is: does the decorator pattern still fits in this context? Should i use another pattern? How do i combine these objects with each other?
I must specify that the code is difficult to understand (spaghetti code), with many IFs and HTML mixed. Any advice will be greatly appreciated. :)
Aucun commentaire:
Enregistrer un commentaire