One WASM module or several WASM modules

I am coding airplane interfaces( simconnect.clients as external programs(exe)) for the B747, B787, and the A320 so my special hardware can control all LVars via their own WASM module per airplane or via only one WASM module that handles all 3 airplanes.

My question is simple, but the answer is maybe not that simple.

Should I make only one WASM module that handles all airplanes or is it better with a WASM module for each airplane? Is there any advantage of using one WASM module compare to several WASM modules?

Hi @Voss1917,

I would always go for one module for each aircraft type.

As a software developer I am used to follow the “seperation of concerns” principle to make my live a bit easier. Seperation ensures that changes made in handling one aircraft type’s event handling will not change the behaviour of other aircraft types, therefore limiting the need of testing to the one aircraft type you worked upon.

Mixing event handling of all aircraft type would mean to test every aircraft type after changing code and, even more restrictive, after each build.

The examples above aim at souce code changes made by yourself. Even worse, changes made by the airplane types’ suppliers would mean to test whether your code still works. And even in this scenario a limitation to one aircraft type will be an advantage, limiting the testing effort to a minimum that has been done.

Last but not least, when both scenarios come together, i.e. you changed your code for aircraft 1 and while doing so, aircraft 2 gets an update from its supplier, and you find your code for aircraft 2 is not working any more, you will not know whether it is a side effect of your own changes aiming at aircraft 1 or an incompatibility of the changes the update of aircraft 2 implies.

Another hint that seperation will be a good thing is when your code base increases. Then you will probably search for ways to split your code into (at least) one section for each aircraft - a thing that seperation into several modules will provide out of the box.

1 Like

Thanks for your reply. Sounds right. I tried to make just one WASM for all airplanes but soon went back to one WASM per aircraft.

One WASM module all the way. You need to clear and reload the lvars on an aircraft change, and reset/clear any Client Data Areas and re-initialise them as well, if using to pass the values back to a client. Also, as Client Data Areas persist through the runtime of MSFS, you need to re-use previously created Client Data Areas when going back to the same aircraft after changing to another, rather than recreating afresh.