Live data from Hacker News

Convincing C programmers to switch to C++: A look at human behavior (2016)

blog.kareldonk.com

41–50 of 87 posts

Re: Convincing C programmers to switch to C++: A look at human behavior (2016)

#41
> In fact, Saks found that quite often logic, facts and the truth were simply not sufficient enough to convince people. Instead, people reacted in a very irrational and emotional way, and kept sticking to and defending their beliefs.

You start criticizing people for not believing you when you have one example comparing two different programs implementing an unspecified task on an unspecified compiler. This is ridiculous.

I mean, for crying out loud, your headlining video is a talk by a person who admits that he hasn't done the thing he's trying to convince people to do.

He says things like this:

"You don't want to wait for the market to take care of this, you would like to take some proactive steps to be able to make more of the people who should be using C++ willing to use it."

in the context of aerospace, which clearly he has no authority to speak on, since he misses one of the fundamental reasons why C++ is not popular or even acceptable in much of aerospace: implicit allocation. Implicit allocation is incredibly dangerous for high assurance systems. You really need to know exactly how much memory can be allocated, when, and what state the exact allocations will put the allocator in. C++ has some facilities to manage this, but man, it is easy to drop a plane from the sky by assuming that your allocation did what you wanted instead of verifying it.

Re: Convincing C programmers to switch to C++: A look at human behavior (2016)

#42
Scott Meyers points out that one of the simplest possible refactorings is "rename method". To rename f(), you need to know what f() is, and in C++, f() can be any of 7+ different things! [0] It's extremely complicated to determine which thing it is.

But according to TFA, people who prefer C are just being emotional and irrational.

[0] Scott Meyers. Things that Matter - DConf2017 [@27:51] (https://youtu.be/RT46MpK39rQ?t=27m51s)

Re: Convincing C programmers to switch to C++: A look at human behavior (2016)

#43
post #7

A good example of human behavior in TFA as well as the talk it cites is how deeply convinced they are that C++ is objectively always better than C; they don't even try to suggest that there could be a tradeoff and sometimes C would be better. Of course the guy in the talk makes a living from C++ consulting; another part of human behavior is it's hard to convince someone of a truth which threatens their paycheck. And…

And a good example in the comments here is how few people are talking about what the article is actually about (human behaviour) but instead there's mostly anti-C++ reactions. The aversion to C++ is so strong that an article that only casually is about C++ must be attacked for the perceived C++ advocacy. The article isn't really about C++ advocacy at all.

It really doesn't matter if C++ is better or not. The article doesn't really even try to talk much about that at all. No matter what C++ may do, what it may change, what it may improve, how it may perform, how it can be simplified; it's almost impossible to convince C programmers to try C++ (or golang, or Rust, or D).

The article really is about how it's almost impossible to change someone's mind on any topic. Anyone who likes to engage in internet discussions is well aware of the phenomenon.

Re: Convincing C programmers to switch to C++: A look at human behavior (2016)

#44

How to convince them: - Show them how classes makes things easier (automatic object management, some operator overloading, etc) - Show how the STL makes most things easier (arrays, maps, etc) How not to convince them: - Show uses of excessive/pathological inheritance - Use of templating beyond the basics - Insist they use C++ functions for every single thing - Insist they OOify every interface in their code - Creatin…

[deleted]

Re: Convincing C programmers to switch to C++: A look at human behavior (2016)

#45
post #18

> The C++ language is an improved version of the older C language (it’s a superset of C), The first statement is arguable and the parenthetical statement is false. C99/C11 have language features that C++ hasn't adopted, which makes it somewhat obnoxious to support C++ from C codebases that use them. One example is the "static" keyword used in array parameters.

or designated initializers.

Re: Convincing C programmers to switch to C++: A look at human behavior (2016)

#46
I've noticed that the best way to get programmers to use a different language is to build something they want to use in that language.

I could talk to my perl programming colleagues for days about the advantages of python over perl, but what got them to switch was boto, since we were moving to aws.

Re: Convincing C programmers to switch to C++: A look at human behavior (2016)

#49

How to convince them: - Show them how classes makes things easier (automatic object management, some operator overloading, etc) - Show how the STL makes most things easier (arrays, maps, etc) How not to convince them: - Show uses of excessive/pathological inheritance - Use of templating beyond the basics - Insist they use C++ functions for every single thing - Insist they OOify every interface in their code - Creatin…

"- Show how the STL makes most things easier (arrays, maps, etc)"

The problem with the STL is that you are always running into roadblocks when you try to compose things. I tried for a very long time to like the STL, and in the end it was very very good for one thing -- pushing me to look for something better.

I suspect things have improved some with the newer C++ standards (it's probably been almost 10 years since I gave up doing much of what I wanted to do in C++), but I much prefer Lisp, Scheme, and other languages now (most, if not all of them dynamically typed). Learning Lisp-family languages did indeed change how I program in other languages -- IMHO greatly improving the way I write code.

I might revisit C++ at some point, just to see what's happening there. I've only skimmed a few articles about the newer standards, and some things look promising. But it would probably take my involvement in a real-world project that uses C++ to get me to go there. I've just spent way too many frustrating hours trying to get things to work the way I wanted in C++.

Re: Convincing C programmers to switch to C++: A look at human behavior (2016)

#50
I do not fully agree with the premise that C programmers don't know what's best for them and need to be educated to switch to C++. I do agree that C++(14++) isolated is a better programming language in many ways compared to C. The problem is that a programming language seldom is used isolated, but is part of a toolchain or is used in an environment with other technologies.

In this situation, C is a much better choice because most other languages have nice interoperability with C, but seldom, if ever, with C++. For example, as an iOS developer I can use C and C-libraries very easy with Swift, while inter opt with C++ is not possible at all and probably never will.

The main thing keeping me away from C++ is that it does not have a stable common ABI. This makes it very nearly impossible to use C++ to create and distribute a shared library. I even believe Google developers internally are prohibited from creating C++ libraries for this reason. So I'm sticking with C for low level stuff. It's a perfect glue language and fast. For higher level stuff, why use C++, when you can use Swift, Java, Haskell etc etc?

Post reply on HN