Interview
Bjarne Stroustrup: Learn More than One Programming Language
- The speaker initially suggests knowing five languages as a minimum but notes they previously knew approximately 25 languages when starting with C++.
- Learning multiple programming paradigms is described as essential for avoiding cultural monoglotism and improving design capabilities.
- The speaker distinguishes between the utility of low-level knowledge (machine code) and high-level abstraction (C++).
- Understanding machine code and architecture remains critical to prevent performance issues, such as cache misses that degrade speed by a factor of 100.
- Modern optimization is viewed as prioritizing clean expression of ideas over manual code manipulation.
- C++ is identified as the preferred tool for expressing ideas cleanly to enable compiler optimizers to generate efficient machine code.
- The speaker advocates "throwing out clever bits" to test if simplified code runs faster.
- A reference is made to Jason Turner's CppCon keynote demonstrating real-time abstraction on a Motorola 68000.
- Turner programmed Pong using C++ which was compiled to x86 assembly via Clang, then translated to Motorola assembly.
- As abstraction levels increased, the resulting assembly code became smaller, cleaner, and more maintainable.
- The speaker asserts that modern C++ compilers generate superior machine code to what a human could write within a reasonable timeframe.
- Functional programming languages like Scala, Haskell, or ML are recommended for learning to express mathematical notions clearly using strict type systems.
- A third category of language is suggested for rapid prototyping, with Python, Ruby, or JavaScript offered as examples.
- The speaker concludes that the specific count of five languages is arbitrary, emphasizing that the second language is the most transformative step.