dreamingmind / bindery

CakePHP 1.3 Based Dreaming Mind Bindery Site
2 stars 2 forks source link

Define possible checkout strategies #257

Closed dreamingmind closed 9 years ago

dreamingmind commented 9 years ago

What design pattern can allow me to manage all these possibilities?

I think the problem is this:
There are going to be several classes involved in carrying out each checkout process. There will be overlapping use of the classes for the various processes, but not an exact match. And each process will follow a different logical process as it uses the classes and their methods.

So having all these checkout procedures in one class is going to involve a ton of conditionals, switches or branches. A big mess.

And to have all this written into the cart system would require any installing system to implement a lot of code that might not be necessary.

What's needed is some way to funnel all checkout paths into one simple class that decides on a class to handle the chosen process. That new class pulls together all the tools it needs for its task and follows the logic to accomplish it.

This way, one or many different checkout strategies might exist but no specific code would be required of the system that used the cart plugin. Each using system could define the processes and supporting code it needed.

dreamingmind commented 9 years ago