Live data from Hacker News

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

blog.kareldonk.com

1–10 of 87 posts

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

#3
People aren't rational actors for a reason: Sometimes things are easy to argue for but aren't that great in practice. And so by following your heart instead of your head, you sometimes make seemingly illogical but objectively better decisions. And I think that there is a case to be made about how C++ is efficient in theory, while C is effective in practice.

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

#4
In C++, "return (x);" isn't equivalent to "return x;" [0].

But according to OP, it's not C++ that's irrational, it's the programmers who don't want to use C++.

[0] https://twitter.com/sigfpe/status/857748171778252800 [EDIT: corrected broken link]

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

#5

In C++, "return (x);" isn't equivalent to "return x;" [0]. But according to OP, it's not C++ that's irrational, it's the programmers who don't want to use C++. [0] https://twitter.com/sigfpe/status/857748171778252800 [EDIT: corrected broken link]

There's shooting yourself in the foot, and there's C++.

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

#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 I'm not here to argue how terrible C++ is (I've done enough of that elsewhere), but only that "behavioral" arguments cut both ways, and are usually little more than an ad hominem attack and/or some good old marketing tricks rebranded as "behavioral science."

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

#8
In a lengthy piece about rational arguments, you would expect somewhere in there someone would actually present a rational argument for switching beyond "it's modern."

I mean, maybe the actual details of the case for switching are slightly beyond the scope the author intended to write about, but simply starting with an assertion that "modern = better, therefore people should have already switched if they were rational" and treating that as self-evident strikes me as highly arrogant and logically fallacious.

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

#9
If we were discussing two languages Strawberry and Kiwi, and I had a large, established codebase in Strawberry and a bunch of programmers who are experts in Strawberry, it would be a hard sell to get me to switch to Kiwi even if Kiwi were better than Strawberry in every conceivable way and backwards compatible with it to boot:

- Learning to use a new system effectively takes time and energy. Are you 100% sure that the benefit of the new system is great enough to offset these costs?

- Hybrid codebases have higher maintenance costs than homogeneous ones. If Kiwi mixes with Strawberry seamlessly, maybe that burden is lower—but the more true that is, the harder it is to believe that moving to Kiwi confers a large advantage.

In this specific case, I could believe that C++ by seasoned C++ users leads to demonstrable net gains. But it's easier for me to believe that switching to Rust or Haskell would confer higher gains, corresponding to the higher risk and higher cost of switching. So I think it's not that people are irrational about avoiding C++. I think that C++ is in an awkward place on the hill between C and things better than C++. If you need something better, you will go to something with better tradeoffs than C++; if you don't need something better, you just live with your existing C codebase.

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

#10
post #3

People aren't rational actors for a reason: Sometimes things are easy to argue for but aren't that great in practice. And so by following your heart instead of your head, you sometimes make seemingly illogical but objectively better decisions. And I think that there is a case to be made about how C++ is efficient in theory, while C is effective in practice.

You hit my pet peeve right on the head - our instincts, such as fear of the dark, not wanting to touch dead bodies, etc., may be irrational, but there's usually a good reason we have them, and going against them without first understanding them is what is irrational.

I still vastly prefer C++ over C though :P

Post reply on HN