Discover your dream Career
For Recruiters

"As a coding language, C++ appeals to the ego, not the intellect"

I notice that this site has a tendency to extol the virtues of C++ as a programming language. As someone who has worked with C++ and who has followed the debate around its use for a long time, I think it's time to set the record straight.

The truth is that C++ is one of the worst languages ever foisted on the industry. Far from being used in modern trading systems, C++ should now only be used for legacy projects. It is based around machine thinking, which is not programming thinking.

Generations of programmers have been misled by C and C++. Many have fallen into the black hole of its cult with trite platitudes like ‘under the hood programming’, which means no more than driving along with the hood open, trying to fix the engine, but unable to see the road. Cult followers urge end-users to "trust the programmer", which is stupid and naive, but appeals to the programmer's ego. And programmers are supposed to have "freedom," although no one ever says freedom from what.-  It's certainly not freedom from the flaws and traps of C++.

 

Programming is about programming and not about hardware machines (programs run on theoretical machines). That seems hard to understand and counter to people’s intuition. C++ just supports the intuitive and populist thinking instead of trying to fix it.

So not only is C++ technically bad, but it is culturally bad since it appeals to the ego, rather than the intellect.

I'm not the only one to dislike C++. Ken Thompson, the Bell Labs researcher who implemented the original Unix operating system, described it as a "bad language" that's "way too big, way too complex" and "obviously built by a committee." Damningly, Thompson also said that C++ does, "a lot of things half well" but is "just a garbage heap of ideas that are mutually exclusive."

The problem is that C++ is based on C and C itself is not a brilliant language. It is full of flaws and compromises. It compromised on compiler technology, forever forcing programmers to take care of detail that should easily be done by a compiler. In turn, C was based on B, which was based on Martin Richards’ BCPL, which itself was a cut down on Christopher Strachey’s CPL, which was too ambitions to be implemented at the time. It is Strachey who is the real genius here in my opinion, not people like Bjarne Stroustrup, who now works for Morgan Stanley and who hacked OO into C to create C++, even though C wasn't a good base. 

Either way, if you're trying to learn C++ and you're struggling to master it, it's not you that's the problem. The language is flawed. Designing a programming language is very difficult, and C++ is simply not that well-designed. Systems programming and application programming are two very separate things, and C++'s real issue is that it tries to combine them both. 

Ian Joyner has done many things, including industry programming, systems programming, language and programming research and compiler development, networking, distributed system standards and lecturing. 

Register your CV with eFinancialCareers to make yourself discoverable for C++ jobs in finance. 

Contact: sbutcher@efinancialcareers.com in the first instance. Whatsapp/Signal/Telegram also available (Telegram: @SarahButcher)

Bear with us if you leave a comment at the bottom of this article: all our comments are moderated by human beings. Sometimes these humans might be asleep, or away from their desks, so it may take a while for your comment to appear. Eventually it will – unless it’s offensive or libelous (in which case it won’t.)

Photo by Peter Gombos on Unsplash

author-card-avatar
AUTHORIan Joyner Insider Comment
  • gg
    gg_hard
    10 June 2024

    Programming is about programming and not about hardware machines (programs run on theoretical machines).


    This is not wrong. However, it's an oversimplification and doesn't hold true for real-time applications, let alone any low-latency/HPC tasks. In today's world, prop trading firms and even certain quant hedge funds compete on speed. It makes no sense to run programs that are suboptimal in speed, as you didn't push your "real-world" machines to their full potential, alongside cutting-edge FPGA/ASIC components.

  • To
    Tom London
    9 June 2024

    This is nothing but a rant. What is the solution?


    Key is to build and use abstractions which are in line with quantitative models - P&L tensors, quantiles, probability distributions etc. - and encapsulate them accordingly. There must be suitable libraries which hide the complexity, and which ideally are available off the shelf to reduce excessive testing effort.


    Whether to use C++ or Python for that is a matter of taste and organization. I personally believe that Python is a better tool for integrating the lifecycle from quant researchers to production - but that may not be the same for every organization and skill distribution.

  • nu
    nulled2zero
    13 May 2024

    Stop talking about something you don't anything about. C & C++ are backbone of any modern language.


    They are solid as rock and these languages for for system development so don't compare anything with anything

  • Mu
    MurexExpert
    8 May 2024

    My patience ran out when he started throwing C with the C++ bathwater.

    You know eFinancialCareers is on the way down when an uninformed rant passes for an article worthy of publication.


  • Qu
    QuantXAsset
    7 May 2024

    People forget that any solution is for the business.

    The main points to considers are :

    1- it must be fast in term of execution time

    2- it must be easy and quick to add new features

    3- it must be easy to identify issues (and debug)


    1- implies that you want a simple hot path without 20 layers of inheritance and a full load of virtual functions.


    2- implies an easy design and architecture to understand based on components/modules.

    You don't want your C++ taking hours of compilation because it will reduce drastically your cycle dev/test. And some people will want to take a shortcut and the testing part becomes optional. And we know where this behavior drive you... you want something quick for compilation and testing. So you want to limit the usage of templates everywhere otherwise you will compile forever. The testing, another crucial part of the dev, obviously you have to test the maximum possible the dev. But you don't want to have a ratio of 10% dev and 90% fixing the tests because you change a bool somewhere. So, you have to design well your testing framework. A good testing framework and strategy allow you to deliver quicker and safer.


    3- implies very good error strategy and logging. Usually people neglects that part and it's a big mistake. When the business call you for a crash or wrong results, you want to give them a fix or analysis very quick. To identify issues quickly is critical. So if your code is multi million line of code, full of call backs and multithreaded, it might be complicated to understand what's going on. And the UB in C++ doesn't help neither...


    Is C++ answering to the three points ?


    For 1-, yes C++ can be fast. You "just" need to be focus on it : "keep in mind your cache line"


    For 2-, almost never. Usually, it comes from the fact that you inherit from old code which has been patch years after years. People left the company and we lost the knowledge. But in theory, we shouldn't need someone to explain the code, the code must be the documentation ( ie, you read it and it's easy to understand). Other common situation, the business ask for a demo, you build an MVP (Minimum Viable Product) and they want it in prod for next week. Then the requirements change again, and someone create a patch and so on .... you create a monster, no one understand why the code is like that and need a complete re-write... Any senior faced that type of situation.

    But, is this behavior due to C++ ? yes and no. The development time in C++ is pretty long, mainly due to the compilation. Which increase drastically the time to delivery. So people try to save some time somewhere... and usually those people are not in the company anymore when everything collapse...


    For 3-, yes and no. The complexity of the C++ makes it extremely hard to identify issues easily. Depends on how you design and dev your solution. But yes, C++ people get tendency to over complexify things, targeting the beauty of the code and not the "service" (yes sometimes you can have both).


    I didn't mention, the typical issues regarding the compilation and the management of the external libraries. Yes, you can use CMake, Conan and plenty of beautiful other tools but maybe you are unlucky and you don't have them where you work. Because you have 100 levels of authorization to get from people that are not involved in your project and are not C++ expert.



    The main issue of C++ is it's to easy to make big mistake like UB.

    And it's extremely hard to make a good design in an environment which change the requirements constantly.


    Do we have something better to replace C++ ?

    Not yet .... to be continued


Sign up to Morning Coffee!

Coffee mug

The essential daily roundup of news and analysis read by everyone from senior bankers and traders to new recruits.

Boost your career

Find thousands of job opportunities by signing up to eFinancialCareers today.
Recommended Articles
Recommended Jobs

Sign up to Morning Coffee!

Coffee mug

The essential daily roundup of news and analysis read by everyone from senior bankers and traders to new recruits.