Is the Factory Pattern correct for my message system?
Just started to read the amazing books in the Design Pattern Framework 4.5. However, I am a bit confused.
Say I have a messaging system which can send each message using different channel.
Is it a mistake to define Factory class -> Create function based on Enum which due to value return the right channel?
Since the creation is dynamic at run-time as I understand a Factory pattern doesn't match here...
Here is some code:
Amit Malina, Sep 13, 2013
This seems like a fine implementation of the Factory Method design pattern.
It allows each message channel to implement its own SendMessage implementation.
Furthermore, you can easily add a third message channel with little effort.
Hope this helps.
Jack Poorte, Sep 13, 2013