Linus' idea of "good taste" code

Chris via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 27 02:11:23 PDT 2016


On Thursday, 27 October 2016 at 08:24:54 UTC, qznc wrote:
> On Wednesday, 26 October 2016 at 09:54:31 UTC, Dicebot wrote:
>> On 10/26/2016 12:53 AM, Walter Bright wrote:
>>> It's a small bit, but the idea here is to eliminate if 
>>> conditionals where possible:
>>> 
>>> https://medium.com/@bartobri/applying-the-linus-tarvolds-good-taste-coding-requirement-99749f37684a#.nhth1eo4e
>>
>> I find it both funny and saddening how many reddit 
>> commentators complained about Linus version of that code is 
>> over-complicated.
>>
>> "Prefer clear code over smart code" principle is good in 
>> general but sometimes it is over-applied to the point where 
>> incompetence gets glorified. And this sucks.
>
> I'm unsure about Linus' version. For this example, I agree that 
> it is elegant. It is fine in this specific case, because 
> everything is local within a single function. In general, the 
> trick to use a pointer to the element probably not a good idea.
>
> The article/Linus does not explain the tradeoffs properly, 
> which makes it dangerous advice.

It's like everything in life, like playing an instrument for 
example - or indeed life itself. Nothing, not even the best 
advice, can replace experience - which comes with age. It's only 
when you have a lot of experience that you understand the advice 
given to you by your elders. Then you pass on the same advice - 
but the inexperienced have to make the same old mistakes all over 
again until they understand. Some never do, though.


More information about the Digitalmars-d mailing list