← Back to context

Comment by johnmaguire

7 days ago

Yes but I would push back a little on the idea that you simply put yourself in a "mindset of writing bug-free code."

Simpler code has fewer bugs. Embedded code tends to be simpler and more targeted in its role. Of course, putting yourself in the mindset of writing simpler code is great too - if you have the time to do so, and the problem you are solving is itself sufficiently simple.

Embedded code is also simpler because it has to be. When you are confined to a microcontroller, there isn't room for bloated app frameworks, hundreds of NPM packages, etc.

  • Depends on whether there's room in the budget to integrate something like a full-fat Raspberry Pi board, at which point, your light switches and thermostats can be full-fledged Kubernetes nodes if you like.

    Never underestimate software developers' ability to simultaneously over- and underengineer a solution, especially if the only limitation is hardware cost (read: somebody else's problem).

The embedded engineering mindset is not a mindset of "writing bug-free code"; it's a mindset of treating the first ~20% of the time budget you're given for the project as time spent designing and writing code (and constraining scope appropriately); and then treating the rest of your time budget as time spent coming up with every possible way to validate/static-analyze/fuzz/etc your code you can, and then debugging all the resulting failures. (Which also implies structuring your code so that it remains at all times extremely testable, whether you are writing tests just then or not.)