A Couple Of Older Articles

posted on 2005-02-06 at 23:43:20 by Joel Ross

Since I've been so busy lately, I now have about 40-50 items to catch up on. Here are a couple of them, both from Brad Wilson.

The first is about Factories versus constructors. I agree with Brad - factories are better. Just Friday, I showed a team member how to implement a factory on a base class, passing in another object. The factory then looks at this other object to determine which object to return (there are three other objects that inherit from this one object). The end result? The consumer doesn't need to know which type of object it gets back - just that it supports a certain function, defined in the base class. And it works perfectly.

The next is about exceptions that you're not really handling, and how to rethrow them. I read this tip a few months ago, and have been following it ever since. 

Categories: C#