从国外某大学设计模式课程试卷上找到的一道设计模式试题,Sunny暂不翻译,,大家可以尝试做做先!
Groupon has already been called the “fastest growing company in history” by the Forbes magazine. In it’s second full year of business, 2010, it pulled down $713.4 million in revenue. The revenue a year earlier was only $30.47 million. That’s a growth rate of 2,241%. Yes you read it correctly. Now let us see what is how their business model is working:
When you check the Groupon website you will see webpage like the one shown below:
The webpage shows deeply discounted offers from different business located in the city where you are living. The figure shows a beauty salon offer that has a 50% discount on women’s haircut. You do nothing if you are not interested. If you like the Groupon deal, you select “buy” before the expiration date and your credit card is charged. If enough people select the deal, you will be sent a link for your rebate coupon at the end of the offer. Once you receive your coupon you can claim it at the specified store, usually within a period of time before it expires as noted on the website. If enough people do not join for that deal, the Groupon is cancelled and no one gets it and in this case you will get a refund for your money. You can see in the left down corner of the figure that the deal is on because more than 15 people has already joined the deal. In case that you have changed your mind you can also cancel an already made order and you will get a full refund. Clever, isn’t it?
Which design pattern you would use to implement the Groupon application? Please give a short explanation why. In particular, show an appropriate class diagram(s) and/or enough code fragments to illustrate your use of the pattern to solve the problem.
【作者:刘伟 http://blog.csdn.net/lovelion】