Introduction
When we hear the word Design Pattern, the first question that comes to our mind is, “What are Design Patterns?”
Design Patterns are reusable and documented solutions for recurring problems in software development.
Gang of four (GOF) have categorized Design Patterns into 3 categories
- Creational
- Structural
- Behavioral
When I started to learn Design Pattern I found Factory method as a very intriguing pattern. It is one of the most controversial and confused Creational Pattern. There is a alot of confusion in People to understanding this pattern .
First of all let me make all of you clear there is nothing like Factory Pattern (as per GOF design pattern list), GOF has something called Factory Method Pattern. (We will come across with both the terminology later in this stage)
In this article for discussion and explanation purpose I am introducing to you, two fictional characters Alexander (a .NET developer) and Thomas (CEO of an IT institute called Programmer24X7).
Story begins on the day when Thomas contacts Alexander and asks him to take up role of architect in his in-house project called “Course Management System”. We will see how Alexander progresses his knowledge about Factory Method Pattern day by day and how finally he come up with a great solution.
Before you starts reading this article, a small advice from my side, keep some snacks ready besides you, because it’s going to be a weary 6 day story. Basically I am trying to play with your patience. don’t worry just kidding. It’s gonna be fun, you will enjoy reading this article and towards the end of this article you can proudly say “I know Factory Method Pattern”.
So relax and let’s start our journey to learn Factory Method Pattern
Index
- Day 1 - How Alexander started? - Approach 1 - Without Factory Approach
- Day 2 - How Alexander Proceed? - Approach 2 - Simple Factory Approach
- Day 3 - Approach 3 - Multiple Simple Factory Approach
- Day 4 - Discussion on Multiple Simple Factory Approach
- Day 4 - Night – Object Nightmare
- Day 5 - Approach 4 - Factory Method Approach
- Day 6 - Final Demo
- Additional Approaches and Thoughts
- Source Code Downloads