Programmers often criticize C++, calling it an overly complicated and dying language.

I don't care if this is true or not. My question is, considering the argument that supports this claim, does that argument also apply to the way that C++ is used by a quant, and not by some general developers in the regular software engineering industry?

In other words, is C++ a complicated language if one only wishes to use it for Quantitative Finance purposes? And is C++ dying within the Quant industry (and if so, in exchange for what)?

NOTE that the words used here are obviously exaggerations. "Overly complicated" is a biased assessment, and "dying" is hyperbole. So, don't get bogged down with those details and provide some easy answer like "herpderp answer is clearly no". Be NUANCED.

  • $\begingroup$ What's your programming background? $\endgroup$ – Matthew Gunn Nov 26 '17 at 15:35
  • 4
    $\begingroup$ As a general rule, people who criticize a language, such as C++, are the individuals who program in other languages. Every language has its market. For instance, the embedded system market is dominated by C, not even C++, because it is quite a good match for the tasks one wishes to do when programming embedded systems. C++ is most certainly not dying in any way. C++11 brought a great deal of interest back into the language, resulting in an accelerated cycle of specs, C++14, C++17, and C++20. Compiler manufacturers were amazed at how much interest there was in C++11 features. $\endgroup$ – Cort Ammon Nov 26 '17 at 18:00

Perhaps this claim is based upon the observation that there are more friendly options out there, Python being one. I want to make two remarks about this statement:

  1. "friendly" here is a very vague word. If you have used C++ in the past and are already familiar with its power, you could also claim that Python is "over-complicated". I believe that there are many advantages of using C++ over Python in some cases, e.g. the use of MPI (Message Passing Interface) and the level of efficiency you can reach with it is amazing.

  2. I intentionally use Python because it is also object-oriented. This shows that if C++ is "dying" it is not because this particular programming paradigm is being replaced by some new novel technique. In my opinion Python is taking over just because it is faster to develop/ship products. However, many libraries used by Python are implemented in C/C++

| improve this answer | |
  • $\begingroup$ Complicated here, I guess, is not to refer to if one has already used it or not, but rather to entry costs. You want to fetch imdb ratings from imdb web site, with c++ : go ahead ! With python though, it will be trivial - 5 minutes. Even syntactically, c++ is not that much difficult that python. I you want performance ? Forget about python. If you like python front end and want performance, use python and pybind11 to expose your c++ to python. No pricing/risk lib / serious algo trading system is implemented in python. Some are in c#, but if you want real real performance, c++ is mandatory. $\endgroup$ – Olorin Nov 29 '17 at 16:17

To make a loose analogy, C++ is to Python as a violin is to a guitar. The guitar is more accessible to the beginner, while the violin allows the skillful expert tremendous control.

The choice of programming language involves tradeoffs. A few are:

  1. Speed of running code
  2. Speed of writing code
  3. Ease of use (i.e. years of software development experience to not suck)

As this answer describes, C++ allows high levels of programming abstraction (for productivity) but without performance penalties! In a sense, C++ prioritizes (1), (2) then (3). A number of libraries (eg. quantlib) where performance is important are written in C++. Updates to the C++ standard have added various features to modernize it.

On the other hand, (2) and (3) in practice are perhaps more important than (1) speed for many if not most purposes. Python has grown tremendously, partially because of its accessibility to professionals who didn't study computer science. In Python with numpy and pandas, you essentially call libraries written in C, C++ or other compiled languages for speed critical components while using the interpreted Python language for everything else. (Aside: Numpy in fact uses LAPACK written in Fortran).

Example: Pointers are a huge difference in C, C++ vs. Java etc...

To code well in C and C++, you need to perfectly understand how pointers work; you must understand the distinction between an object and the memory address of an object.

In C++, you need to explicitly think about memory management to not f*@#($* up while you can survive in some higher level languages like Python and Java just by ignoring or hand waving. Did Pandas give me a copy or a view of a dataframe? One can produce useful code without understanding all the nuance while in C++, you'd probably be dead.

A common paradigm?

  • Use a language like Python or Java for non-speed critical components
  • Write important, speed sensitive libraries and components in C++
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.