Factory method pattern: Difference between revisions

Content deleted Content added
No edit summary
m removed situation link... it's just weird.
Line 96:
Again, there are [[advantage]]s to this [[method]] (clean [[organisation]] of the ImageReader classes, split up in several classes), but this is at the [[cost]] of the [[abstraction]] of the image type. Again, when you get to have dozens of file types, this will be unsatisfactory and produce code that is hard to maintain.
 
So what's the [[solution]]? Simply to take the best of both worlds, by using the Factory pattern (which you should already have an idea of by now). The [[Factory]] is a class that returns another class depending on the [[context]]. So in this [[situation]], keeping the separate [[class design]] as in the last example:
 
public class ImageReaderFactory