Below is a reason which is given in a book to assigning a Factory helper class to delegate creation of objects due to complexity of object creations. That is "Conditionally creating of objects from one of a family of similar classes based upon some external property value". I cant figure out this situation. Can anyone help by giving an example for above.
2 Answers
At my company we deal with microphones and multiple platforms.
We have a factory method along the lines of createMicrophoneRecorderSource(...)
On Linux, we create an ALSA microphone. On Windows we use WASAPI and on iOS we use... native iOS stuff which I don't remember the exact name.
The user doesn't have to bother about knowing what is what, we hide all the gory details inside the factory.