The C++ Role in Industry

A hot debate has been maintained for several years about the advantages or disadvantages of C++ in the practice of programming. C++ has certainly gained a lot of strength in the market, especially since the new standard (C++14) was approved and became supported by most compiler vendors. On the other hand, C++ still receives lots of critics for being a language that is not very accessible to new developers and with lots of rough edges that make it difficult to create code free of known “pitfalls”.

While some of these critics are well deserved, the language has taken a lot of steps in the right direction by providing safer mechanisms for initializing objects, for example. They have also done a good job to reduce verbosity in the type system, though the use of automatic type detection.

Another group of programmers have frequently advocated for the use plain C as the best way to fight the problems in the C++ language. This has been epitomized by the debate between Linus Torvalds and some developers that wished to introduce C++ code into the Linux kernel. This can be seen as a both a movement towards the abandonment of C++ altogether, or just as a way of avoiding the more complex features and using C++ as a “better C”.

Industry versus Single Users

While the pros and cons of C++ provide for a multifaceted debate,  I would like to remark on the differences between C and C ++ in industrial applications. This is a important distinction to make, because the needs of industry are frequently at odds with other uses of the language, such as in an academic scenario, or as a vehicle for personal programming projects.

C++ shines on its extensive support for higher level constructs, most notably classes and templates. At the same time, C language users have been more concerned about the high performance and transparency provided by C syntax. This just reflects the different priorities of these groups of users.

Industrial use of a language normally emphasizes the collaborative aspects of programming. In a way, it is much easier to have dozens of programmers working in a project when each programmer is responsible for a single class, which is contained in its own file with clear boundaries to the rest of the application. While it could be possible to replicate this kind of division of labor with C, it is much more complicated to design a set of programming standards that give the same separation between modules as provided by C++.

At the same time, single programmers see the verbosity of C++ as a deficiency, since it requires a lot of extra work to provide something that is not necessary for their needs. For programmers that work mostly alone, C is the most direct way to design an application because it doesn’t impose verbose boundaries between the different parts of the application. The individual programmer will in most cases have the whole project in his or her own mind, and artificial boundaries will only slow down the process. In a industrial setting, however, different programmers are assigned to maintain their own interfaces, making the whole process much easier to manage.

Moreover, programming as done within companies is every day more reliant on connecting to external libraries and frameworks. This is another situation in which C++, with its standard (even if cumbersome) class model provides a definite advantage over C. Suddenly programmers are able to create and manage objects provided by other groups or companies, using the same mechanisms for creating, and releasing objects.  C programmers normally have a more difficult time because each library has it own mechanics for managing data objects, which may not match properly with the style of the current code.

In summary, the needs of individual users are frequently at odds with the needs of corporations. Given these differences, it is not surprising that some users prefer C to C++, while C++ has become so successful in industry. This is also a reason why many open source projects prefer C instead of C++. While collaborative in nature, open source developers are more used to work alone in their projects, and combining their contributions into mainstream. This is a very different mindset from programming as performed in companies, and in more corporate-like projects such as Mozilla for example.

Similar Posts:

About the Author

Carlos Oliveira holds a PhD in Systems Engineering and Optimization from University of Florida. He works as a software engineer, with more than 10 years of experience in developing high performance, commercial and scientific applications in C++, Java, and Objective-C. His most Recent Book is Practical C++ Financial Programming.

Sorry, comments for this entry are closed at this time.