lundi 27 avril 2020

Design pattern to avoid passing unecessary parameters?

In my current project i defined the following interface:

public interface CmdExecutor {
    void execute(String[] tokens, OutputStream outputStream, List<ServerWorker> serverWorkers) throws IOException;
}

Every CmdExecutor needs tokens and outputStream but after the executon of his job, I need to update some information in List<ServerWorker>.

There is some design-pattern that can help me to avoid passing to every worker this List? I've heard about using an "event bus", there is some other option other than this approach?

Thank you

Aucun commentaire:

Enregistrer un commentaire