09-03-2020 10:56 AM
What are the favorite architectures/design methods for running programs that have simulation and real hardware capabilities? My first thought is to use objects to ensure that simulation and hardware are not mixed. What architectures/design do you guys use?
09-03-2020 10:34 PM
Except in the simplest of applications I think it's almost always worth abstracting your hardware with classes. The second decision you need to make is figuring out how you want to switch between your real and simulated hardware.
Personally if there were only two options, simulated and some specific hardware, I would probably just put the two options in a case structure and have the selector based on some INI token (default to real hardware if the token doesn't exist). This doesn't take too much effort but still enables you to switch between real and simulated components even after deployment which can be handy. Also, this can be easily replaced with a more complicated dynamic loading process if the need arises in the future as you already have the skeleton of INI string token input results in some abstract class output.