
Show HN: The JavaScript Way, a new book for learning modern JS - bpesquet
https://github.com/bpesquet/thejsway
======
ivraatiems
I appreciate the effort that went into this, and it's certainly important to
have a good clear reference on JS. Unfortunately, I can't support the effort
to aim this at beginners, because I think JS is an extremely poor choice of
language for first-time developers. It's poorly designed, with too many side
effects and edge cases and confusing behaviors to be a good choice for a first
language. It will bog down first-time learners with weird minutiae, and it
will do that because it is a poorly/hastily built language that is being used
in ways it was never intended for. I realize JS is ubiquitous and easy to
access (since all browsers have it), but that doesn't make it the right
choice. It's just too broken.

~~~
dflock
Accessibility beats out all other concerns; why is JavaScript so popular and
ubiquitous? It doesn't really matter if you like it or not - especially from a
'purity' point of view.

80% of everything is crap.

The weird edge cases in JavaScript are easily avoided when teaching a subset
of es2016 to new programmers.

The basics: variables, loops, functions, etc... are all fine. It's got pretty
good functional programming support, too, for beginners.

~~~
ivraatiems
In terms of "should one be able to use it," no, it doesn't matter whether I
like it or not. A developer who works on the web needs to know JS. That
doesn't mean newbie who doesn't know what they want or anything much about
development needs to know it, and certainly not that they need to start with
it.

It's not a "purity" point of view, it's an "ease of use for the purpose" point
of view. JavaScript does weird things that stymie experienced devs - a newbie
hitting them will be completely lost. What's worse, as I said, is that it does
these things because it's poorly designed/its design doesn't adequately cover
all the edge cases it should, so newbies will learn the wrong information
about why things do or don't happen.

The edge cases are not easily avoided because you don't know what a beginner
will or won't try to do when working on their own. That means that not only
might they do an okay thing in most languages that doesn't work in JS, but
that they may also do something BAD that DOES work in JS, because JS is weird.
For instance, the way JS handles variable hoisting and scoping is bonkers
compared to most other languages - not stuff you can avoid while learning to
program, and making it easy to learn the wrong practice as a result.

"80% of everything is crap" is a good thing to know when doing development
_work_ , but it isn't helpful when learning. The goal of learning in this
context is mastery of the basics of development; 80% won't be good enough.

~~~
dflock
> you don't know what a beginner will or won't try to do when working on their
> own

This is true regardless of which language you use to start with. Computing in
general is so ridiculously over-complex and constructed entirely of layered
kludges, that beginners are going to trip and fall into lots of these
crevasses no matter what, unfortunately.

The first lesson advantage of being able to start the coding immediately
(everyone has a browser) is not to be dismissed. If you try to do this in
Python - otherwise an excellent choice - you will spend the first ~day of the
course installing Python and explaining about command lines, editors and the
REPL.

This seems trivial to us, but it's a huge hurdle for many first time
programmers. The JS version of this is "go to this URL, then right click and
select Inspect. Start typing in the console."

------
rco8786
> using latest language standard(ES6/ES2015), avoiding awkwardnesses from the
> past

> `Object.create`

:(

~~~
bpesquet
Care to elaborate?

Understanding prototypal inheritance seems essential to me, and
Object.create() is the cleanest way to show it in action.

The book also presents the alternative class syntax and numerous ES2015
additions like block-scoped variables and arrow functions, to name a few.

~~~
rco8786
It explicitly states it avoids the past and focuses on es2015, but then talks
about old patterns.

~~~
bpesquet
I don't consider Object.create() and factory functions to be "old patterns",
but YMMV.

How would you teach OOP basics to a JS newcomer then? Using only class without
mentioning prototypes?

------
gigatexal
Bookmarked. Hoping this proves to be the structured intro to web development
and JS that I need.

~~~
antfarm
Maybe "Front-End Web Development: The Big Nerd Ranch Guide" is what you are
looking for.

[https://www.amazon.com/Front-End-Web-Development-Ranch-
Guide...](https://www.amazon.com/Front-End-Web-Development-Ranch-
Guides/dp/0134433947/)

