From the moment I met the young Bjarne Stroustrup, I knew that he was not someone to be persuaded easily. I just saw a glimpse of the early design of what would become the de-facto programming language of the IT world by the close of the 20th century. I thought to myself that to try to convince Bjarne that the C with Classes blueprint would need rethinking and redesign seemed a greater challenge than convincing him I came from the future. Because how do you make someone in the past comprehend the change that has overtaken the world in less than two decades? How does one ever invent something new in the hope that it will solve problems that you don’t know yet? That is, unless you have seen the future or someone with a time-machine paid you a visit and told you what people in the future wanted.
I brought with me a list of things I thought Bjarne should consider integrating into C with Classes before releasing it to the public. At the sight of my iPhone, Bjarne seems to finally get convinced of my time-travel story, and decides to listen to what I have to say. I show him the list, and he reads them out loud – automatic memory management, generic programming, simpler polymorphism mechanism, and… dumb programmers. The last bullet point, of course, somewhat brought on the first three points. “Dumb programmers are what smart pointers are for”, I tell Bjarne. He gives me a blank look and I tell him I will explain to him later what a smart pointer is as I go along. First off, I tell him to rename “C with Classes” to a catchier “C++“.
Let’s start with automatic memory management. I tell Bjarne to brace himself in the future, because people would blame C++ for everything from lost productivity to global warming. Because it turns out that placing the responsibility of managing memory in the hands of the programmers have a rather negative consequences in the future when applications have grown exponentially large. Time spent on debugging memory leaks and errors have been blamed for lost productivity. What if programmers do not have to deal with pointer? What if programmers do not have to know who allocates or deallocates memory? I think they could spend more time on their algorithm and refine their logic. Even the coupling of pointers and array have caused confusion to beginners learning the language. Of course, I need to talk to Dennis Ritchie about this, and hopefully, when I go back in time to 1972, I will be able to sway him to do something about it. I tell Bjarne that , eventually, automatic memory management will be integrated into C++ through the use of smart pointers and RAII or Resource Acquisition is Initialization.
RAII? He asked. And I then explain to him what RAII is all about. What a cruddy name for a brilliant concept, he blurted. “Well, Bjarne”, I say, “RAII is one of the most brilliant creations of yours. It seems to have pacified even the most critical C++ opponents in the future. But I just pray that you do it much sooner.” Maybe sometime in the 80’s?
I then begin to talk about generic programming. I tell Bjarne that applications have become complex and large. Languages that provide the tools to create reusable routines for processing different types and objects are boon to the businesses. What if you could tweak C with Classes to include a capability to abstract he requirements on data types across algorithms and across functions? That is, provide the capability to abstract thee algorithm and data structure, so that my functions ca use a data type that is defined much later in the future. For example, one sort function that is abstracted to accept(and sort) either an integer, floating point, characters, or any data type. I tell Bjarne that, eventually, this feature would have been integrate into C++ libraries with the help of Alexander Stepanov, and suggested that he start working with him on this generic programming thing.
And then finally, I tell Bjarne to make the polymorphism mechanism in C++ a lot simpler. He asks me what part of it gives me the most trouble. And I say, I’m not really sure. I tell him that if I always need to have a copy of the C++ Programming Language whenever I begin implementing inheritance, then it could be a flaw in the language. Or it might just be that I am one of the dumb programmers of the future.