Monday, 24 August 2015

Bjarne Stroustrup is catching up

Bjarne Stroustrup, creator of the C++ programming language, once famously said "There are only two kinds of languages: the ones people complain about and the ones nobody uses". Interestingly, Bjarne has gone on the defensive in his recent lectures, completely changed his tune and is catching up with the conclusions that most former-C++ developers have arrived at.

In a recent lecture Bjarne made many eyebrow-raising assertions. He is happy that people are no longer talking about C++ because that means it has succeeded. In reality, C++ demand in the job market has been in freefall for years and few new software projects are choosing it. He attacked computer scientists for copying data and said that "even babies don't do that", a very strange statement to make in a technical presentation. He also implied that other languages deep copy 10,000x10,000 matrices and claimed that a shared_ptr is "like an old fashioned garbage collector except it gets resource release correct". Perhaps most interestingly the topic of his presentation was OOP without inheritance.

So C++ is moving from templates to the kind of parametric polymorphism ML offered before C++ was invented. Is the backbone of OOP, inheritance, being deprecated? And new features in C++ are closer to first-class functions and garbage collection.

Looking at "modern" C++ makes me angry. I wasted so much time learning all of this incidental complexity that just gets in the way of software development. And I am angry that so many people are still being deceived by this nonsense. Thankfully fewer and fewer people each year but where did we go wrong? How did we let this happen? I think it reflects a serious disconnect between academic and industry.


Arseny Kapoulkine said...

I'm honestly not sure what your point is, however...

- Your language data disagrees with statistics. At least here's some from GitHub:

- I have mixed feelings about modern C++, assuming you mean C++11/etc. On one hand, they bloat an already impossibly big language. On another hand, they lead to code that's much more pleasant to read and write - at least some of them. Even more arcane things like variadic templates actually make some things like function object implementation really really simple (especially compared to C++03).

So despite the insane amount of additional complications these features introduce to the language, if you stop thinking about language purity and focus on practical usage aspects, they do mostly make the language better.

Before C++11 I hoped that we'll see a beautiful clean language emerging that would overcome C++ in areas where C++ is strong and still sorely needed (my personal interest is mostly in game development and other extremely performance sensitive fields, where 80-20 rule does not work). That is, despite the huge issues with lack of tooling, community, resources, people and existing established tested optimized libraries, C++ will grow so old that we'll see a language emerging that will slowly overcome these hurdles.

After C++11 I no longer think in 10 years this will happen. Rust emerged, which was unexpected (in a good way), but I don't feel that this is enough, and Rust has enough issues of its own.

I'm not really sure why you mention inheritance in this context. Some modern C++ features are about classes (e.g. override, default member implementation, constructor inheritance), some aren't (e.g. lambdas, ranged for loops, rvalue references).

Finally, it seems to me that Bjarne's quote still holds true. I really like ML languages (and spent some quality time with F#), but it's hard to argue that all of them were dramatically less successful compared to C++.

Jon Harrop said...

@Arseny Kapoulkine

I was thinking of job market statistics where C++ has fallen from 31% market share to 8.9% since 2005:

while C# has risen to over 30%:

and Java has, of course, been far more popular than C++ for many years:

Interesting that Github gives very different results. I don't think it reflects commercial code bases at all. The vast majority of the code on Github is probably abandonware. Perhaps if it were weighted by downloads.

I am completely disinterested in C++ to be honest. In fact, I am amazed that anybody still cares about this stuff. I find it as exciting as the proposals for Fortran 2000 that was going to be OOP.

MLs themselves remain unpopular compared to C++ but far more new projects are using parametric polymorphism from ML than C++. The only thing the most popular languages today have in common with C++ is surface syntax.

Rene said...

I have been around since the beginning. I have seen languages come and go, both in education and in industry. I can understand your anger about wasted time and wasted code. One of my programs has been rewritten five times for different systems, starting from Atari OS, IBM OSX, Unix XWindows, Windows, and now Java. The latter is by far the best. But now, Oracle is slowly killing Java.

So what? Hardware changes, the industry changes, and software follows it. Now that we can afford to translate metalanguages, we should could start building open libraries for cross system development. But we don't. The waste goes on.

Java, I think, was a good start. But it did not work out, partly due to rejection in the Unix community, partly due to economic reasons by the industry. Let us see, what comes next.