Software Factory

   

The Factory design pattern

In   object oriented  programming languages  the factory-design pattern  indicates a manner to instantiate  objecten without exactly lay down the Class from these objects originated from. In this pattern there's a methode (the factory-methode) used that can be implemented by subclasses. The class of the object that's instantiated by this methode, implements a certain interface or abstract class. Each of these subclasses can then decide from which class the object will be made, for as long this class implements the interface or abstract class.   

The goal of this design pattern is simplifying the call to make a new instance that inherits from an base class. and there simplifying the maintenance of the software. Also you will get a more
loose coupling between modules, because only the interface or abstract class has to be
known. In the code example I've provided the call to make a specialized instance by using Reflection.

How is it done?

For those who like to discover the pattern in code, I've made a program that uses the pattern, and provides a console application to test the program in live situation and by unittests. Especially the unittests provide a easy way to step through the code and observe the logic to create the different specializations in the factory. The unittests provide a coverage of almost 100% so it's you can observe almost all the variants that are possible.

To try this out, you need Visual Studio 2005 or higher with version of the .NET framework 3.5 installed. If you've any question contact me through the contact menu or leave your comments here below.

-September 2018+
SMTWTFS
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456
  • RSS
  • Add To My MSN
  • Add To Windows Live
  • Add To My Yahoo
  • Add To Google

Statistics

  • Entries (1)
  • Comments (0)

Archives


Leave your comments here 

Sunday, May 22, 2011 11:15:00 AM

Just click on Reacties()

Download Data

Site Map | Printable View | © 2010 - 2018 LeBroITSolutions | HTML 5 | CSS