≡ Menu

C# Design Patterns

Do you know C#? Do you know Design Patterns? Do you know Design Patterns in C#? Well, heck, you just know everything, don’t ya!

For quite a while, there has been a C# Design Patterns Group headed up by Damon Carr. It took a hiatus for a while, but is back in fashion. If you think you know your stuff, now is a great time to head over, because we are in the midst of a Decorator Pattern contest judged by Damon and yours truly.

Here’s the scoop from my post to the list:

We are looking for the best implementation of the Decorator pattern. What is the decorator pattern? According to the Gang of Four:

“Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality”.

To provide some framework to work in, this round is looking for decorator patterns that increment or decrement the price of a given object. For example, the base price of a car might be $5000 USD, and you can add on various aftermarket items like wheels, spoilers or really annoying tailpipes that increment the price. In addition, you might have incentives like a coupon, a discount plan or some other thing that decrements the price of the car.

Note that your implementation does not have to use the above example. You could use houses, boats, or green beans. The main rule is that none of the decorators can be mutually exclusive to cut down on the complexity.

Your application should:

– Allow for selection of a main item (at least one)
– Allow for selection of decorators (to either increase or decrease
the price) (at least 2)
– Calculate the total cost

We don’t care if the app is a web app, Winforms, or Console. I care if you used Test-Driven Development, but pay no attention to that, because I’m just a judge, and it’s not like I’ll knock you points for not using TDD. Maybe.

Again, the deadline is March 31st. Prices and Participation may very. 2 week lease at 4% APR with automatic upgrade to Gold-infused Platinum edition at the end of term. Void where prohibited. Must take dealer stock by 3/31/07. Have a nice day if applicable in your jurisdiction.