Living in the Tech Avalanche Generation

A practitioner’s introspective on technology
Archive for June 25th, 2008

A pattern a day keeps the doctor away. A Series of posts on the GOF Patterns implemented in C#.

[Factory Method Pattern - Episode 1]

First up let me the explain that this will be the beginning of a series of posts that document a look at the GOF design patterns as implemented in C#. As this is the first episode in the series I am going to take a moment to explain the reason behind it. One thing I know for sure is that design patterns were NOT a big part of learning in University in my day and judging by the graduates that come out of the various institutions these days, that assertion would still appear to hold true.

During a dinner recently with some of my colleagues, I asked the question, “who was taught design patterns at University”? Unsurprisingly the only response I had in the affirmative was something along the lines of, “I remember learning the observer pattern at University”. Clearly the teaching institutions need to rectify this anomalous situation - don’t you think?

If you look inside a lot of small(ish) to medium(ish) development teams (and I see them as a consultant), you might be surprised to know that the idea of using patterns doesn’t get spoken of much in the course of general daily discussions and perhaps you’ve heard the old one liner that:

“You may not have heard about them but you’ve probably been using some without knowing.”

That statement may have some merit, but to a fairly insignificant degree in my opinion. I cant remember a time when I heard someone spout forth, “you should use the decorator pattern” or “it sounds like you need to consider the facade pattern”.

So rather than bemoan the emptiness of this impoverished circumstance, I have decided to try and help change it a little with a series of posts that document the GOF patterns implemented in C#. I will be using the content for training purposes in the near future when the series is complete.

nightshift-at-the-factory-factory So first up we will look at the creational patterns and specifically we start with the Factory Method Pattern. Rather than include all the content as part of this post itself, I have posted the code and training PowerPoint for download here.

Share/Save/Bookmark

3 comments

Creative Commons Attribution-ShareAlike 2.5 Australia
Creative Commons Attribution-ShareAlike 2.5 Australia