albertjorlando
albertjorlando

Reputation: 212

Should I used the Factory Method pattern?

I am developing an application that uses a combo box to select a version number. Depending on this selection a different subclass is to be instantiated and a method defined in the super class is to be called. I am having trouble deciding which pattern to use. Perhaps the Factory Method pattern? Any help would be much appreciated.

Upvotes: 0

Views: 51

Answers (1)

sanderarts
sanderarts

Reputation: 334

If the subclasses that you'll create are similar and are easy to initialize the Factory pattern is the way to go.

The Factory pattern is based on the fact that the objects the factory creates have a similar interface/super class and the caller of the factory isn't interested in the specific subclass but only in the high-level interface.

Upvotes: 2

Related Questions