C++ in embedded systems: a business perspective

Juan M. de Hoyos photo By Juan M. de Hoyos Comment Permalink

Choosing the right tools is a key factor of success for any software project. This gold rule is out of discussion for many managers, at least the most successful ones, who do not hesitate to allocate time and resources for early evaluations of any new technology. Unfortunately, decisions about which programming language to pick seems not to deserve the same attention as many other technical questions, even though choosing the wrong language is a costly mistake. An inadequate programing language leads to opportunity cost that the company has to suffer. Opportunity costs are not easily measurable, but they exist.

Especially in the embedded world, a holy war between C and C++ programming languages has been running since decades. When C++ emerged as general purpose object oriented language in the early-nineties, it quickly surpassed his old brother C in many software sectors as the most widely used programming language. This trend however, runs in a slow lane if we talk about embedded software development, where C language is still king. Most IT Companies running embedded projects seems to be more than reluctant to move on and embrace the benefits of C++ and the object oriented approach as software design paradigm. The reasons for such mindset vary, but they all have something in common: they don’t consider the advantages of C++ in the long term, beyond the scope of the project. They fail to see that C++ can lead to a higher operative efficiency and can even turn into a competitive advantage for the company in terms of reducing development costs.

If I should highlight the advantage of C++ against C with only one word, it will be Reusability. In computer science, is the possibility of use the same code in different contexts to solve different problems. Of course C, as any other modular languages, offers certain level of reusability in form of functions and procedures. But C++ boosts this concept by introducing one of the most typical object oriented features: inheritance. C++ lets functions -now called methods- and data be grouped together and be considered as one unit. By inheriting from a class its entire interface -except the part defined private- is placed at the disposal of the heirs. And the best is that it only cost one line of code; the hard work is made by the compiler. But reusing is not just a matter of reducing coding time, but -and even more important- debugging sessions. Bugs are the old enemy of every software project. They are like bacteria. You cannot see them, but they are there, and cannot be avoided. As E. W. Dijkstra magisterially pointed out, we can only be sure about the existence of bugs, not about their absence. Therefore, all countermeasures taken in earlier phases of a project to minimize bug fixing in the later, will pay off. By inheriting from well tested classes we reduce the development risks and the potential costs of debugging.

Companies are run by people in the end. An IT company is intensive in human capital and one of the main drivers of success for technology companies is to attract, generate and retain human talent. In order to get good people a company has to look over its shoulder form time to time and have a look to the market. In IT business the technology runs fast and what yesterday was a trending technology today may not be considered by the programmer community as attractive as I used to be. Companies which stick to out-of-fashioned technologies can face hard times to get skilled programmers, and if they do, it will be certainly at a higher cost. Scarcity of resources increases their price, is basic economics.

The same argumentation applies when it comes to retain talent. In the same way that people expect their financial assets to increase their value over the time - or at least, not to lose it-, the technical assets deserve a similar dedication. As the market evolves, new professional profiles go on demand and some others lose their charm. Especially in periods of economic growth and low unemployment ratios, when the professional mobility increases, those companies based on unattractive technologies suffer from high personnel rotations. Every manager knows that high rotations can slow down a project dramatically, as the learning curve of the team never achieves the break-even point. In other words, the development costs associated to your people’s skills don’t decrease as much as they will if the team were stable. As a matter of fact, the market today is abundant in skilled object oriented C++ programmers. Many of them have more than one decade of experience in the industry. For sure most of them are also proficient at C and can be hired, but if they want to remain tied to C for a long time, is another question.

Innovation is probably the best lifeboat for a company to sail the sea of unknowing. IT companies rightly consider innovation as one key of success; a mean to keep a competitive advantage in the long run. Innovation champions have all something in common: they experiment with new technologies and are not afraid of making mistakes. Many of them even mention innovation in their mission statement explicitly and try to make it part of their culture. But even though the innovation mantra is heavily invoked by most part of the industry, in many cases this enthusiasm dissipates when it comes to daily work. The reluctance to introduce C++, not even as a pilot project, is a good example. The rationalization of this position is often bolstered up with conservative arguments, which contradict the whole idea of innovation. How can a company call itself innovator when is not able to question its own practices?

C++ is a mature technology. It has been around for more than thirty years and has proved to be an efficient programming language for the industry. There are no reasons why embedded software companies cannot profit from the same advantages as other business did in the past. Discussions about C vs. C++ in embedded systems are quite recurrent, but often take the form of quite technical debates where the management prefers to remain aside. Little or none attention has been paid to this topic focuses on how it can affect the business. Because in fact, all decisions a company takes has an impact on the P&L, sometimes in the form of revenues, sometimes as opportunity costs. For high competitive businesses, the lack of knowhow is like an open wound. And in this case the pain is even more because is self-inflicted. The C++ market in abundant at this time. If you do not have the right people, hire consultant, but move on, don’t stay behind the trend. Tomorrow the gap will be certainly harder to fill.