×

Loading...

Adapter pattern + Facade Pattern

本文发表在 rolia.net 枫下论坛Dear Guest,

I think I have understood your probelm now.
You have a server, which can provide some basic services. To serve the customers from Company A, you need add some "pepper" in your services. To satisfy those from Company B, you need add some "sugar". ..... As you talked about adding clients, you were actually talking about add a class of clients. (This is your ignorance in your early posting. Adding a class of clients is different from adding a single client in the usual sense.) Whatever companies those clients come from, the services they enjoy are basically the same.

To solve your probelm, I suggest you use Adapter pattern to wrap your basic services,
then add some flavors such as "pepper", "sugar", "vinegar". depending upon the clients. This is the first step. The client is usally not interested in how your server provide services. So the second step is to use Facade pattern to output your services to different clients. If you use Java, this is usually realized using some static methods.

I thank you so much for offering me this opportunity to discuss the patterns. If you were in Virginia, I may invite you to have a dinner.更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report