Relative Content

Tag Archive for patterns-and-practices

Strategy vs Publiser-subscriber pattern

Let’s say I have a channel endpoint where I receive messages. Because I want to process messages in a different way depending on its Header property, rather than create a massive switch I create different strategies with the contract:

Callback pattern handling exceptions – Best practices in .NET 3.5

I am looking to implement the callback pattern with error handling such that error is caught and pass to the callback code with the response. Since I am using .NET 3.5, I cant use Task (TAP) pattern which provides us with t.Result and t.Exception properties. I tried some googling for best practices and ended up with the Begin/End APM model. Since I dont want to block the main thread, I ignored this model.

What is the best way to initialize a child’s reference to its parent?

I’m developing an object model that has lots of different parent/child classes. Each child object has a reference to its parent object. I can think of (and have tried) several ways to initialize the parent reference, but I find significant drawbacks to each approach. Given the approaches described below which is best … or what is even better.