Does this code follow the Factory Design Pattern?
I am somewhat confused about Factory Pattern. Please review this code . When we need object of KeepItems we will instantiate KeepItemsConcrete Class. Is this pattern a Factory Pattern?
Shyam Kumar, Aug 02, 2010
I created a working example that might help. It's a simple logging object for your applications that allows you to choose where the logs are being written to, either a Text file, database or email.
Although I'm still fairly new to Design Patterns, I'm a little torn between whether my example would be considered more a Strategy Pattern than a Factory Pattern.
You can read about the application here: http://www.kingwilder.com/Blog/tabid/55/EntryId/29/ASP-NET-Simple-Logger.aspx
And download the sample application here: http://www.kingwilder.com/Downloads/tabid/56/Default.aspx
I hope this helps.
King Wilder, Aug 03, 2010
Great post! As a side note, I use MVP(Passive View) for both WinForms and WPF apps. This has worked out quite nicely. Davy Brion has a series of posts on how he uses a modified variant of MVP with WPF (http://davybrion.com/blog/2010/08/mvp-in-silverlightwpf-series/). However, as Chrisitan mentioned, MVVM is the most used pattern for WPF and the one recommended by MSFT.
Aug 09, 2010
In your example, the interface is empty, your child class has not modified the parent class which makes it redundant. So this would be a completely wrong example for any design pattern.
Simply put, Factory pattern is all about having a Factory class which has a method to create a Product class you want i.e. you create create a factory producing the desired product. Here's a link having simple example in case the one here are inadequate: http://wiki.asp.net/page.aspx/310/factory/
Pankaj Mhatre, Aug 03, 2010
Got a 404 for the second link. Go to http://www.object-arts.com/downloads/downloads.html and then click on "Technical Papers" to download the PDF.
Feb 02, 2011