Live data from Hacker News

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

blog.kareldonk.com

21–30 of 87 posts

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

#21

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 rationa…

It's kind of amazing to me that OP's 4000-word article doesn't mention -- even once -- the relative complexity of C vs C++.

Yeah, you'd think that they would do it at least in a condescending way given their partisan position on the question.

Unless... they didn't actually think that much about the topic. I dunno. I didn't watch the video so I don't know if it's in there.

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

#22

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]

I'm not a big fan of the huge complexity of C++ (and much prefer C in general, although for some things C++ is more convenient) but I don't really think it's fair to dismiss a language based on a small snippet. You can basically mock any language that way:

- In C "getchar" returns... an int.

- Pointers and array are kinda the same thing, but not exactly. The rules for when an array decays into a pointer are sometimes unintuitive and surprising.

- Same thing for the implicit integer types promotions.

- `char *s = "foo"` is not at all the same thing as `char s[] = "foo"`. Arguably the former should be considered erroneous, but compiles just fine in C. G++ gives a warning for the same code however.

- There's also the ridiculous "gets" function that's so poorly designed it could be part of PHP. This one finally got officially deprecated though.

Of course many of these issues are also part of C++ since it's mostly a superset of C but in general it's stricter and more strongly typed.

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

#23
post #17

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 th…

One of the major problems I have with C++ is that for any non-primitive data type, there are way too many choices of mutually incompatible classes that people have developed. Even strings. There are things out there that use char[], std::string, CString, APString (#*&!), ...

Aren't char[] strings and CStrings the same?

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

#24

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]

Intuitively, you can think of this as providing the name of a variable as compared to an lvalue that doesn't name a variable.

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

#25

In the sense that OOP is often used in very stupid ways (dunno about C++ but in other languages, have a look at PHPUnit it is the best example of misunderstood OOP) I can understand C programmers. Golang is also very simple for a reason

I agree, but moreover: You can also do nice OOP with C. Take a look, for example, to COS (C Object System) which implements OOP on top of your C compiler. The object system itself is inspired by CLOS (Common Lisp Object System) and Objective-C (in turn inspired by Smalltalk). It also allows 'automatic' allocation by reference counting.

https://github.com/CObjectSystem/COS

Paper: https://arxiv.org/abs/1003.2547

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

#26
This reminds me of Godel's proof - A formal system (axiomatic system) cannot be complete and consistent at the same time!

Each side of the argument have their own set of premises/axioms to come to certain conclusions but there are always unknown truths which people tend to ignore. if there are no unknown truths then the argument should be contradictory

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

#27
post #23
post #17

Earlier quoted context omitted.

One of the major problems I have with C++ is that for any non-primitive data type, there are way too many choices of mutually incompatible classes that people have developed. Even strings. There are things out there that use char[], std::string, CString, APString (#*&!), ...

Aren't char[] strings and CStrings the same?

I think dheera meant CString class from MFC, not a "plain C string".

I'll also add QString, AnsiString, BSTR and glib::ustring to the mix :)

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

#29
>* Based on research by Kahan et. al., Saks mentions that otherwise intelligent people will likely misunderstand data if understanding it challenges their preexisting beliefs.*

While this happens, it's also an empty argument that can be applied to everything.

How about the author there misunderstands his own data on C++ because it challenges his preexisting beliefs (that C++ is "de facto" better)?

It goes downhill from there fast, to argue that those pesky people who dare to not want to use C++ are irattional, conditioned from childhood, etc (those willing to use C++ are not, because of course C++ is the only reasonable choice a programmer can ever make between C and C++).

>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. People’s basic reaction was “show me all the data you want, C++ is still undesirable.”

The problem in the paper is that some BS arguments and numerical data in favor of C++ (which I'm assuming they have -- they fail to mention any of them in this article) are conflated for "THE truth".

Sorry, author, but you are not showing people "THE reality", you're showing them some arguments and some numbers.

The programmers you are talking to (those that have tried both C and C++) are the ones that have actual empirical experience from actual reality on what C++ gets them -- and whether its worth the tradeoffs they've seen.

For one, there's an ergonomic factor in language and API design (it's usability) which can be highly subjective -- and syntax/api usability is one of the big reasons people dislike C++. This issue cannot be shot down with any "objective" argument or numbers table....

Post reply on HN