Why is C++ so BIG?

In defence of C++

Bjarne Stroustrup has written:

C++ isn’t as big as some people imagine. It’s not a tiny language designed to be a minimal language for teaching, but neither are the languages people most often compare it to, such as C, Java, C#. They too are huge compared to say, Pascal as Dr. Wirth originally defined it — for good reasons, I think. The programming world is far more complex today than it was 30 years ago, and modern programming languages reflect that.

The C++ standard is 1151 pages; that includes 430 pages of language definition and 770 pages of standard-library description. The size of the language definition is within 5% of the language descriptions of Java and C# (measured by page count). Similarly, TC++PL is 1360 pages; of those 750 of those are devoted to language facilities and programming techniques; the rest discuss libraries, etc.

C++ directly supports (i.e., in the language) what some other languages support through libraries, so the language part will be relatively larger. On the other hand, if you want to write a “typical modern application”, you need to consider operating system interfaces, GUI, databases, web interfaces, etc. the sum of language features, libraries, and programming conventions and standards that you must become familiar with dwarf the programming language. Here, C++’s size can be an advantage as far as it better supports good libraries.

Finally, the days where a novice programmer can know all of a language are gone, at least for the languages in widespread industrial use. Few people know “all of C” or “all of Java” either and none of those are novices. It follows that nobody should have to apologize for the fact that novices do not know all of C++. What you must do — in any language — is to pick a subset, get working writing code, and gradually learn more of the language, its libraries, and its tools.

“The programming world is far more complex today than it was 30 years ago, and modern programming languages reflect that.”

I do not accept this at all. Yes, the programming world is more complex today, but that does not mean programming languages must match its complexity. Mr. Stroustrup’s attitude is all about how to write a large software system, not how to read it and understand it in a cognitively easy way. His position focuses on how best to express algorithms and data structures, and readability be damned; that’s how large software systems are best managed, or so he believes.

And yet, Google et al. have created a wonderfully simple and powerful language called Go which can be used to write large software systems relatively quickly and easily. Go is prized for its unbelievable productivty (as is another simple language called Smalltalk). That’s why its use in industry has been rapidly growing, and why its popularity has been skyrocketing in the Redmonk rankings.

“The size of the language definition is within 5% of the language descriptions of Java and C# (measured by page count).”

That may be, but in practice, people find Java, and even C#, much more approachable. My brother and I have used Java for years, and we don’t find it particularly onerous. I’ve used C++ briefly and it scares me. Page count is not a good way to measure language complexity. The volume of syntactical elements you must understand in order to write and read C++ code is daunting. Which brings me to another point…

“What you must do — in any language — is to pick a subset, get working writing code, and gradually learn more of the language, its libraries, and its tools.”

That’s great if you’re writing code, but what if you’re reading an existing code base? Much of the work done in IT is in maintaining and extending current software systems. I guarantee you that their code bases are not limited to a manageable subset. In order to understand the code base, you need to fully understand the language that it’s written in. So only C++ veterans will have this capability.

Wouldn’t it be great if everybody in IT was a C++ (or Java, or C#, or Scala) expert? Then we could all write massive, complex, nicely expressed software systems. Of course, this isn’t the case. The industry comprises developers of all varying skill levels. Mr. Stroustrup is essentially pandering to an elite class of programmers with C++.

And, by the way, languages such as Python, Go, and Smalltalk can be fully grasped by most developers in a matter of months. C++? You better give yourself years…many years.

“…if you want to write a “typical modern application”, you need to consider operating system interfaces, GUI, databases, web interfaces, etc.”

You need to consider these things regardless of which language you choose. It’s a lot of work to be sure, but that’s no excuse for adding to the burden with a complex programming language. If C++ does, indeed, offset some of a standard library’s API, it is surely dwarfed by the APIs of operating systems, GUIs, databases, web interfaces, etc. The gain from added language complexity is insignificant.

The gain from added language complexity is insignificant.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store