3 ms·
> Outside of embedded systems there is no other good reason to continue OOP I work on embedded systems, and I see few good reasons to use OOP in this domain, a
by codewiz 4y ago
> Outside of embedded systems there is no other good reason to continue OOP
I work on embedded systems, and I see few good reasons to use OOP in this domain, at least not the classic version with runtime polymorphism.
In the codebase I'm currently working on, someone thought it would be a good idea to abstract the hardware behind a HardwareInterface, so you could have a concrete implementation and a mock for testing. And now every access to a GPIO pin goes through a virtual call that can't be inlined, even though the production firmware contains only the concrete Hardware class.
A better design would be compile-time polymorphism with templates. Or even separate header files for each implementation, which is how the Linux kernel does portability to a dozen CPUs.