lundi 25 septembre 2017

Factory pattern - how to avoid switch construction?

I use simple Factory pattern, look at screen, please:

enter image description here

As you can see I use switch operator to choose object and create instance.

But if there are over 100 classes? Problem is came. How to avoid switch construction? Using interface?

Aucun commentaire:

Enregistrer un commentaire