Tuesday, June 5, 2012

Why abstraction and open source is valuable even in small embedded programs: An example using the Arduino SPI library

  Since the object oriented "revolution", abstraction and code reuse are the bywords of modern software development even when programming in non-OO languages.  But use of these techniques has lagged in highly embedded development due to perceived inefficiencies compared to C and assembler.   Yet embedded development can be incredibly detail-oriented and time consuming.  It took a bug report discussion  and listserv conversation (you can read the originals by following the links, or just read my summary after the break) between a couple of highly experienced engineers to figure out the best solution for an 8 line chunk of code that on the surface is quite simple.  It just enables the SPI bus.

  This experience shows the power of FOSS and abstraction in microcosm.  First, judging by the discussion, any one of these engineers (including myself) working alone would likely not have figured out the best solution.  This would have meant revisiting the issue some time in the future.  And second, once this time-consuming, detail-oriented problem was solved it never needs to be solved again.  This (added to countless similar cases) creates tremendous efficiencies affecting (judging by hits to this blog) engineers across the entire world.  Neither of these effects would have taken place in classic closed-source development.