pwzeus wrote:
ok I can understand MVC here but i m not sure how factory pattern will be usefull. I will look into it....thanks
Think static method that returns a concrete implementation of an interface based on some criteria, sample pseudo here from top of my head ..
interface IImageHandler{ ... }
sealed class ImageHandlerFactory
{
private ImageHandlerFactory {}
public static IImageHandler Create( object criteria )
{
IImageHandler handler = null;
switch( criteria )
{
case X:
handler = new PngImageHandler();
break;
case Y:
handler = new GifImageHandler();
break;
}
return handler;
}
}
Of course you could make it a lot more flexible by having the criteria match against configuration, dynamically load the implementation (and cache it).