jeudi 5 août 2021

"Do something different for every property of an object"-Pattern

I have a task:
I have to calculate a value for each property of an object based on its name, type, range and so on, and sum them up.

Right now i am thinking about creating an array of those properties with all the information I need and then use something like a mapping table to determine, what formula/function/method will be used for each property.

My question is:
Is there a pattern that fits this task?

I thought Strategy, maybe... But, it feels somewhat heavy for the task.

Do you have other suggestions?

Aucun commentaire:

Enregistrer un commentaire