dimanche 28 août 2022

What is the best design pattern for handling same condition across multiple functions/classes

I have various functions that take user input and "construct a component" across multiple functions/classes. There will always be a core set of logic that gets executed regardless of the user input conditions, but recently, I found the need to add a configuration input and when it is set to true, additional logic will get executed. I feel like it is poor design to be passing this configuration flag around to various functions/classes, and it will also create a maintainability nightmare. What design pattern can I use to create a clean set of logic to handle this condition?

This is for a java desktop application.

Thanks

Aucun commentaire:

Enregistrer un commentaire