I had an interesting discussion with someone from India last night about embedded software development, one of the subjects we discussed was why someone should consider using Managed (C#/VB) vs. Native (C/C++) application development.

Perhaps some of the reasons are obvious, garbage collection, no pointers, very well organized class libraries, great development tools (Visual Studio 2005), support for devices and desktop applications (and also Windows XP Embedded since desktop applications run on Windows XP Embedded), rapid application development etc... But what about Bug Density ?

If we consider that developers typically code ~50 bugs per 1,000 lines of code (I've seen numbers that range from 10-50 bugs/1000 in different reports) then reducing the number of lines of code you write would appear to be an excellent way of reducing the number of bugs in your code, right? - in a recent blog post about supporting a USB Barcode Scanner I had estimates for the number of lines of code needed to support the device and capture barcode data ranging from 4,000 lines (C/C++) through to 10 lines of code for a C#/VB managed application.

Is bug density something you consider when writing code for your embedded devices ?

BTW, the "Spot the Bug!" blog always makes for good reading...

- Mike