samedi 28 septembre 2019

Which Design Pattern should I use for the following situation?

I need to decide how to create an elegant solution for the following problem.

  • I receive a list of "ClassA" objects.
  • I have an interface and four different implementations.
  • The interface method uses a class "ClassA".
  • ClassA has PropertyB and PropertyC.
  • Depending of the value of PropertyB I want to decide which implementation of the interface should I use for each object of the List.

I need an elegant solution but I can't think of any.

Does anybody has any idea if how can I implement this? An advice of which Design Pattern should I study?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire