News for hackers. Stuff that matters.
Re:A Modern JavaScript Tutorial by ornornor on Monday December 07, 2020 @02:36PM (#25336166)
I never understood that. Is it really that hard to spell out full variable names? It’s so much more legible, there is autocomplete on virtually any editor (even the ones that aren’t IDEs), and you write code once but read it hundreds of times. Why even try to save 8 bytes at the expense of readability?
Re:A Modern JavaScript Tutorial by kinjba11 on Monday December 07, 2020 @02:51PM (#25336391)
Short variable names make code more readable in some scenarios, not less.

  fooBarBazThings.each(t => t.DoThing())
  for (int i = 0; i < len(things); i++) { // i used here }
Some local code patterns are seen so often you understand it in one go. Something like

  fooBarBazThings.each(fooBarBazThing => fooBarBazThing.DoThing())
  for (int thingIndex = 0; thingIndex < lengthOfThings; thingIndex += 1) { // thingIndex used here }
Just clutters things up.
Re:A Modern JavaScript Tutorial by ornornor on Monday December 07, 2020 @02:59PM (#25336518)
I disagree. I always use descriptive variable names. I have no idea what ‘t’ is. ‘thing’ is 4 bytes more. Not the end of the world, but much more readable. Same for ‘i’ vs ‘index’.
Re:A Modern JavaScript Tutorial by twic on Monday December 07, 2020 @03:34PM (#25337077)
This is a bit of a false dichotomy, because the names don't have to be that long.

  fooBarBazThings.each(thing => thing.DoThing())
It's more useful when the receiver of the method doesn't tell you as much, eg:

  getRecentPurchases().values().forEach(price -> priceStats.accept(price));
Re:A Modern JavaScript Tutorial by drran on Monday December 07, 2020 @03:33PM (#25337061)
Modified obfuscator can make your code even more readable. It can simplify functions in addition to variables. Also, it improves job security, which is important in times of covid.