Blog Archives

Designing your way out of the CanHandle-Handle conundrum

CanHandle – Handle pattern conundrum

When you have multiple classes implementing an IWorker interface with a CanHandle and Handle method, such as

you find yourself in a conundrum: should you call CanHandle again from Handle?

If you don’t, someone could pass in work that a worker isn’t designed to handle and that can lead to a multitude of different exceptions or subtle,

Read more ›




Act like a pessimist and call CanHandle from Handle (again)?

You have multiple Worker classes that can each handle a one or more types of command. Your IWorker interface offers two methods: CanHandle and Handle.

Perfect.

Anyone with work to be done can now find a worker that says “yay, I can handle this” and then pass off the work to that worker.

Read more ›




Property.Settings.Default makes it hard to unit test any method that uses it

Storing your application and user settings should be a solved problem. After all, we have done it since the dawn of software development. Yet, the question “What is the best way to store settings?” keeps cropping up. The answers vary widely and quite often spark religious wars.

As interested as I am in why people are so invested in whatever they use,

Read more ›




Show Buttons
Hide Buttons