jeudi 28 avril 2022

Basic design question having two different implementation of an interface whics falls under same domain

Could be silly question but needed thoughts.

Need to design two different implementation of an interface which both updates a configuration in application but the config getting updated are different.

The first update gets triggered whenever any application created/deleted/updated the config related to those apps are update in a data.json file which is read by 3rd party.Trigger for this update is straight forward and sync call.

Second config update gets triggered from multiple user operations, instead calculating the diff in config , the approach we took to regenerate config on interval based on some flag with a scheduler in async manner

Now the problem is have two different sets of implementation for an interface with multiple arguments. To solve this added the functional Interface with one method which parameter as Object...args. All the classes implementing this has the job to update the configuration in third party as per required. Is this right approach as per design.

Aucun commentaire:

Enregistrer un commentaire