samedi 14 janvier 2023

Command design pattern when invoker and client may be on different machines

I read about the Command design pattern on Head First Design Patterns. Note that they use a remote control and household appliance as an example.

I noticed that their client and invoker code both reside on the same machine, but in their example, the remote control and various household appliances are clearly different machines.

If we want to make this example a reality, how must we implement the design pattern? Let's say: given the 2 machines are in the same local network and use the same programming language

I tried sending the inputs and the receivers as pure strings and the invoker will decide which receiver to use, but at times I have thought about pickling. Sometimes I might wanna send pure string commands from the invoker to another microcontroller, via MQTT, running C++ code.

Any advice is appreciated. This is a personal project.

Aucun commentaire:

Enregistrer un commentaire