puzzlecracker wrote:
Given ludicrously huge promulgation of programming languages...
You might want to distinguish that promulgation between active languages and archived ones. Much fewer languages are leading-edge.
...platforms, OS's, embedded systems etc., in which environment C++ is still the most useful and the predominant language choice.
The programming world occupies a spectrum from embedded to distributed. From bits inside registers in specific hardware, to active content like web pages that can run in any generic device.
CeePlusPlus is efficient, modular (roughly), typesafe (roughly), and more flexible & maintainable than assembler. It is also statically-typed, and purely compiled.
Use C++ from the embedded level to the OS level to large, performance bound systems.
Use a higher level language to drive C++.
For example, oggle my Flea:
That program drives OpenGl with several layers of stuff. At the lowest layer, the microcode in the graphics chipset in my graphics card, C++ could easily have been used to blast all the bits around in an image. C++ competes directly with Assembly and MachineLanguage because programs that are easy to read and change can be faster than programs that force you to think of the path of each bit.
But maybe the microcode in my graphics chipset wasn't C++; the miracle of encapsulation and drivers means I don't know if that layer is C++.
At the next layer up, the OS drivers, including OpenGL, could have been written in C++, and again they might not have been. The odds are very high they were written in a C language, such as Standard C or GNU C.
Next, the GraphicalUserInterface frame around my OpenGL is written in Qt, which is an exquisite and elegant framework written in pristing C++...
...with one exception. Because C++ uses statically typed polymorphism (polymorphism that requires inheritance), and because GUIs work best with the Observer Pattern written in a dynamically typed language (a message-based language like Smalltalk), TrollTech? invented two new C++ keywords, signals and slots, and added them to your compiler.
The moral is the farther you are from the hardware, the more dynamism you need.
In the left panel of my user interface is a snip of Ruby code, which is a very high-level language that competes with Perl and Smalltalk - but certainly not Assembler. My Ruby code drives the commands that generate the graphical primitive commands sent into OpenGL. So the Ruby code generates the shape you see, and the OpenGL code renders it.
This far from the metal, the efficiency of StaticTyping is less important than the flexibility of DynamicTyping. So when my system uses Ruby to generate a shape, you don't need to recompile everything just to change the shape.
Similarily, if you write a database engine in C++, you drive it with SQL, a soft dynamic and DeclarativeLanguage.
All modules in a program must perform a balancing act between too much typechecking and too little. Use C++ when those benefits are obvious.
--PhlIp
CategoryWhatever, See AlternateHardAndSoftLayers