
Elements of JavaScript Style - ericelliott
https://medium.com/javascript-scene/elements-of-javascript-style-caa8821cb99f
======
uwu
i find the longer versions of the first two examples in "2\. Omit needless
code" more readable

i think my mental parsing at a glance of the short version of the first
example trips over how there are no parentheses around the "msg" parameter and
it looks like an ordinary variable until i reach the "=>" after it

and in the second example, parentheses (expression body) are used instead of
braces (block body) but with indentation that's typical for block bodies so
you can't easily tell it's an expression body at a glance (also depends on how
well your font differentiates "{" and "(")

> Sometimes we’re tempted to assign names to things that don’t really need to
> be named. The problem is that the human brain has a limited number of
> resources [...]

i don't think intermediate variables are all that bad, especially for things
that'd make an expression too long to comfortably fit on a line

or is it something only functional programmers care about

i'm not a fan of the currying and point-free and other things and find them
pretty unreadable but i never did that kind of functional programming (to my
knowledge) so i am not legally allowed to have an opinion on them

~~~
ericelliott
See "Familiarity Bias is Holding You Back: It's Time to Embrace Arrow
Functions" [https://medium.com/javascript-scene/familiarity-bias-is-
hold...](https://medium.com/javascript-scene/familiarity-bias-is-holding-you-
back-its-time-to-embrace-arrow-functions-3d37e1a9bb75)

------
vertebrate
cargo-culting haskell

~~~
ericelliott
Cargo-cult programming is the act of copying something without understanding
how it works or even whether or not it's required.

Typically it involves the ritual inclusion of code which does not need to
exist because the author is copying something else they saw (or literally
copying and pasting from Stack Overflow). The essence of the original article
is the systematic _exclusion_ of code which does not need to exist -- that is
the opposite of cargo-culting.

All of the guidelines exist for reasons which are well explained in the
article. It's basically a guide that teaches you how to avoid cargo-culting.

If you're complaining that the guide encourages functional programming
approaches, it's useful to admit that functional programming is an important
capability of JavaScript (evidenced by the fact that functional utilities are
built-in to the language).

