For the first entry in this series, I wanted to start simple, with one of the most popular design patterns: the Singleton. This is a pattern that many developers are familiar with, even those otherwise unaware of design patterns in general. This should give us a nice, gentle introduction into the topic. Even so, there's a lot of detail here that is often overlooked. (Singletons are also one of the most commonly poorly implemented patterns.)
As this is the first post in the series, I'm still working out the format. For now, each post will discuss a single pattern, broken down into the following segments:
- Who - The name and basic description of the patter.
- What - A longer description of the patterns behavior, requirements, and purpose.
- When - Major use cases and types of problems this pattern can solve.
- Where - The kind of applications, frameworks, and other patterns where this pattern is often found.
- Why - The reason we apply this pattern to solve a problem, as opposed to other possible solutions.
- How - A detailed implementation of this pattern in C#, and how it was derived.