News for hackers. Stuff that matters.
Re:Clear is better than clever [pdf] by coldtea on Monday May 06, 2019 @09:39AM (#19839260)
>Is it really the state of the industry where a new person cannot learn a codebase, has no time or effort, and cannot read a single line of the language they were hired to work on, and that's the person we should build everything for?

Seasoned 10x developers, titans of the industry, and all agree on simplicity and even they frequently make mistakes on easily confusable constructs such as nested ternaries (or even BS like forgetting a break in a switch etc).

It's not some bad "state of the industry" that calls for no such constructs.

If anything, it's amateurs and newbs, more self-confident than they should be (and less humble) that call for using any old crap in a language, and think that such constructs are only problematic if developers are "not paying attention" or are "ignorant".

Re:Clear is better than clever [pdf] by atq2119 on Monday May 06, 2019 @02:03PM (#19842039)
Yes, they all agree on simplicity. Part of the problem is that simplicity is not entirely objective.

As an extreme example, people familiar with mathematical notation have a hard time when they start using a programming language that uses '=' for assignment, because they intuitively understand it as asserting equality, which it isn't (x = x + 1 would be paradoxical). And yet we all here presumably think of assignment as something rather simple.

There are plenty of code bases where the ternary operator is used frequently. It's a more succinct (but less versatile) variant of the if/then/else expression that a number of languages have - do you find that confusing when nested?

The ternary operator is just as simple as if/then/else expressions. You may not be familiar with it, which can make it seem non-simple, but then we're just back to the observation that simplicity isn't entirely objective but subject to your background.

Re:Clear is better than clever [pdf] by voidwtf on Monday May 06, 2019 @10:16AM (#19839592)
Or it could be that it’s subjective and there is no truly objective answer.
Re:Clear is better than clever [pdf] by coldtea on Monday May 06, 2019 @11:24AM (#19840254)
Well, it could be if we had more research.

From my experience, and from my reading on tons of books, code, clean code suggestions, bug reports, etc, patterns of bugs are more commonly found on such code bits, that sacrifice clarity for succinctness or "clever points" (in fact that's the very premise of TFA).

Most respected elders in development also warn against those types of code.

Lacking objective research, that's the best we can get, and I'd say better than "it works for me".

Re:Clear is better than clever [pdf] by Retra on Monday May 06, 2019 @05:45PM (#19844236)
The mistakes that people make are not subjective. They can detect when they make a mistake, and must do so to correct it. When people make mistakes by using a syntactic construct, that's something can be measured, and people do measure it, which is one of the ways they develop syntax preferences. The problem is that we don't ever measure it in an unbiased and representative manner.