(Crazy) Computer engineers will agree that we live in "Object Oriented World". Most of you got introduced to the world of objects through the C++ programming language. CE is extremely proud to have Dr. Bjarne Stroustrup - the inventor of C++ programming language on CE. Dr. Stroustrup answered questions asked by our own CEans. Presenting our Small Talk with Dr. Stroustrup...
CEan - KGV: What made you think beyond C and go for an object-oriented approach in C++?
Dr. Stroustrup: I had a couple of problems (in the area of concurrent and distributed programming) that would be best attached with what is now called an object-oriented approach. Unfortunately, there was at the time no language that could handle both OO-style code in the context of hard, close-to-the-hardware systems programming. So I transplanted the key OO ideas from Simula (the first OO language) into C.
CEan - Elisa: What is the toughest challenge in designing a new programming language?
Dr. Stroustrup: To get someone to use it for anything real. Most new programming languages are for years only tried on toy examples and on stylized problems in controlled environments. That shows. C++ benefited hugely from having to work through its early years. It is not as pretty a language as I could have made it, but far more useful than it would have been had it had an easier upbringing.
CEan - Crook: What changes would you make to C++, if you were to begin the work from scratch?
Dr. Stroustrup: Of course, we can never begin from scratch, but let’s dream: No implicit array->pointer conversions, no implicit narrowing conversions, one set of overload resolution rules for built-in and user-defined types, no messy declarator syntax. We’d still be able to write code without a garbage collector (using constructors and destructors), but there would be complete type safety and some form of optional GC. We’d have a cleaner integration of classes, class hierarchies, and templates. I’m assuming a systems programming language (incl. embedded systems programming) here, because that’s what I like and that ‘s what I know a bit about.
CEan - Suyash: When I started learning C and C++, I was told the importance of these programming languages in designing operating systems. What is the status of their usage in the creation of modern operating systems?
Dr. Stroustrup: Many operating systems and parts of OSs have been written in C++. A lot of IBM stuff, Chronos (hard real time), Choices (Academic), Bea (Media), parts of Windows, etc. In my opinion the massive use of C that still dominates this field is partially inertia and partially a serious unwillingness of old dogs to learn new tricks. In the context of close-to-the-hardware programming (such as device drivers and OS kernels) it is important to remember that C++ is not just an OO language; not everything is best represented in code as a class hierarchy.
CEan - Kidakaka: What do you see beyond OOP?
Dr. Stroustrup: It’s hard to make predictions, but I’m hoping for a smoother and more effective merger of object-oriented and generic programming techniques.
CEan - Kidakaka: C++ has advanced a lot and it has lead to the emergence of other languages (e.g., Java, C# etc.) which we may loosely call "progeny of C++", what is one thing (you can list more if you like) that you think you thought was a bad design decision?
Dr. Stroustrup: A programming language is created to solve problems and those programming language were not created to solve my problems so it wouldn’t be fair for me to be too critical of the designs of Java and C#. I’m very keen on portability, on programming close to the hardware, and of non-proprietary languages. Java, C#, and most of the popular scripting languages takes some major hits there – but that doesn’t matter to them because my ideals aren’t their ideals either. I don’t think we should dream of a single language used by everybody for everything. However, my ideal language is not proprietary and doesn’t require half-a-Gig of runtime support. Being able to convert a container of Circles to a container of Shapes (to use the most common example) is a violation of proper type rules that I find troubling. I also think that a new language could come up with a syntax that didn’t suffer from the legacies of C and C++. That said, those languages are obviously useful in their application domains and for the purposes for which they were designed.
CEan - Kidakaka: In most engineering colleges, they first teach C, then C++. I generally found C++ easier to learn. So should C be phased out for those who have just started to learn the basics of coding?
Dr. Stroustrup: Yes, C++ should be taught before C. The better notational support and better type checking provided by C++ makes it easier for users to appreciate basic programming issues and principles, and the more supportive library types (such as vector and string) are invaluable. That’s the way I teach beginning programming. C is easily taught/learned later on.
CEan - Maro: Will humanity someday create something to replace Von Neumann Architecture, which means new standards in every single digital bit in the world?
Dr. Stroustrup: Depends on how you define “Von Neumann” architecture. With multicores and static and dynamic reordering of instructions we have departed from anything Von Neumann would have recognized. The reordering brings a “traditional” machine closer to a data flow machine. With multicores and multi-level cashes, our basic semantics have to be defined far more precisely than before. One of the major efforts in the design of C++0x was to address these challenges directly. Much of the credit for this work goes to Hans Boehm from HP.
CEan - Kidakaka: Seeing your baby take on such magnificent proportions, how does it feel as its creator?
Dr. Stroustrup: Scary and most gratifying. Gratifying because it is great to see my ideas and those of my friends flourish (in C++ and other languages). Scary, because there have been so many misguided attempts to use half-understood versions of those ideas, so much half-baked understanding. It is really nice to see C++ used in scientific endeavors, such as the Mars Rovers and the sequencing of the human genome, and in everyday cool toys and tools, such as the iPod and Google. To get an idea of my opinions on C++, read my paper: Evolving a language in and for the real world: C++ 1991-2006. ACM HOPL-III. June 2007. It’s a peer reviewed paper, not a sales blurb.
CEan - Ruhi: What’s next after C++?
Dr. Stroustrup: I can dream of going beyond C++, but C++ will still be my major tool for a long time to come. First, I have to help finish C++0x and finish my programming textbook for beginners (using C++ of course). You don’t go “beyond” something just to do something new. In my opinion at least, you design and build something because there is a need.
CEan The Big K: Sir, I thank you for taking out time to talk to CE. What is your message to Crazy Engineers?
Dr. Stroustrup: The obvious: Be ambitious, yet realistic in your dreams. Do something that makes a positive impact. Don’t let the nay-sayers get you down.
CrazyEngineers is thankful to Dr. Stroustrup for taking out time to talk to us. Visit Dr. Stroustrup's website. Discuss this article on CE Forums