News for hackers. Stuff that matters.
Re:A Modern JavaScript Tutorial by longnow on Monday December 07, 2020 @04:18PM (#25337689)
There is a chapter called ‘ninja code’, which is full of terrible advice. A small example.

> The ideal name for a variable is data. Use it everywhere you can.

There is one small comment at the top of the chapter, which says ‘Irony detected’. Is there really a whole chapter written Ironically? It would be very easy to read this and think it was real advice.

(And if it is real advice, and I’m completely misunderstanding, then I can’t possibly recommend this book).

Re:A Modern JavaScript Tutorial by lucideer on Monday December 07, 2020 @05:09PM (#25338328)
I understand that often subtleties of language, particularly when it comes to irony or sarcasm, can be lost in textual content (particularly supposedly-formal content like educational materials), and that generally this is something to be avoided.

However, after reading that chapter, I really can't help thinking that you simply weren't paying any attention.

It's not just written in sarcastic tone (something that yes, could be easy to miss for many), but it's also littered with active dissuasion and explicit explanations of the pitfalls of using this style.

Examples:

> If you write like that, a developer who comes across this line and tries to understand what is the value of i is going to have a merry time. Then come to you, seeking for an answer.

> A quick read of such code becomes impossible. And when there’s a typo… Ummm… We’re stuck for long

> A fellow programmer who wants to work with elem in the second half of the function will be surprised… Only during the debugging, after examining the code they will find out that they’re working with a clone!

> First, the code becomes longer and less readable, and the second, a fellow developer may spend a long time trying to figure out what the underscores mean.

You can argue that the chapter is inappropriate, but I don't think you can reasonably argue that it's misleading.

Re:A Modern JavaScript Tutorial by hanoz on Monday December 07, 2020 @04:53PM (#25338125)
>There is one small comment at the top of the chapter, which says ‘Irony detected’.

The whole chapter is littered with clearly tongue in cheek remarks.

Re:A Modern JavaScript Tutorial by ehutch79 on Monday December 07, 2020 @05:07PM (#25338308)
People will absolutely not get that and take the advice to heart.
Re:A Modern JavaScript Tutorial by tasuki on Monday December 07, 2020 @06:01PM (#25338946)
I doubt many will. It's not subtle.
Re:A Modern JavaScript Tutorial by bigiain on Monday December 07, 2020 @11:37PM (#25341872)
I see you've met the entire front end team where I work...
Re:A Modern JavaScript Tutorial by mekoka on Monday December 07, 2020 @05:36PM (#25338651)
I think that page would benefit to first more clearly define what a JavaScript Ninja is and why it's good for you to become one. Something along the lines:

"A JavaScript Ninja writes code that is brilliantly mysterious. When people read such code it should induce confusion and if at all possible, fear. Clarity is for the feeble. Obviousness is overrated. Obfuscation and secrecy: that is the way of the Ninja. So, how do you become a Ninja?"

Re:A Modern JavaScript Tutorial by strogonoff on Tuesday December 08, 2020 @07:06AM (#25344182)
> There is a chapter called ‘ninja code’, which is full of terrible advice.

How someone interprets a tongue-in-cheek chapter could be a good litmus test of their reading comprehension, grasp on the fundamentals, and (last, but not the least) basic sense of humour. I’d hate to see it removed.

If someone takes this section literally, I would be immensely curious how they reconciled in their mind that advice with what they (supposedly) read in preceding sections.

Re:A Modern JavaScript Tutorial by abhishekjha on Monday December 07, 2020 @07:39PM (#25339907)
This reminded me of a brilliant and hilarious presentation on microservices : https://youtu.be/X0tjziAQfNQ
Re:A Modern JavaScript Tutorial by mcgingras on Monday December 07, 2020 @04:29PM (#25337820)
yes, it's a whole chapter written ironically. I too find this to be misleading.