Hacker News new | ask | show | jobs
by Silhouette 4139 days ago
Just curious what parts you looked at? Did you glance at the table of contents, or did you read full chapters?

I skimmed through pretty much all of "Scope & Closures". I also looked through the first few chapters of "this & Object Prototypes" to see whether they were any better.

If you had any specific feedback on what I could have done better to live up to the title, tone, and mission of the book series, I'd be appreciative of it.

Sadly, with that title and your chosen goals, I think you left yourself no chance of meeting expectations right from the start. If you're going to tell me I don't know a language I've been using for 20 years, you'd better mean it in the sense that there is something significant and new in your book, perhaps some cutting edge developments in the language itself, or maybe an original application or new perspective on how to use what was already there. In this case, the closest you get in the books I looked at is touching on a few basics of ES6 -- nothing wrong with that, but hardly earth-shattering news to a professional who runs 6to5 (ahem sorry, Babel) every day.

Leaving aside the title, though, the material is often surprisingly narrow and imprecise if your intention is to teach the subtle details of JavaScript more thoroughly than many programmers might know them already.

Your opening paragraph of chapter 1 makes several debatable claims. For example, your characterisation of mutable variables as fundamental to nearly all programming languages immediately ignores alternatives such as purely functional or logic languages. That is perhaps an unfortunate choice given the current trends in JS libraries and frameworks, which in many cases are moving in that more declarative direction.

You then seem to conflate various concepts of scope, storage and lifetime throughout the book, and similarly do not seem to distinguish clearly and consistently between the concepts of identifiers, variables and values. In a language where closures and references to functions are used routinely and where you have some types passed by value but others effectively passed by reference, these kinds of distinctions matter, particularly to someone who has learned by osmosis or perhaps come from a background working with other programming languages, which seems to be a lot of your target audience here.

More generally, your terminology tends to drift away from the ECMAScript spec quite a lot, again making it less precise. Another example would be the opening paragraph of chapter 1 of "this & Object Prototypes", where you describe this as being a "special identifier keyword". By definition (in the spec) an identifier can't be a keyword, because an identifier is precisely an identifier name that is not a reserved word.

The most vague section of those I read was probably when you discuss closures in the final chapter, where I'm sorry to say you come across as rather unfamiliar with the concept yourself. Your usage is somewhat casual, unidiomatic even, not least in your definition of the term itself. Your explanation for where closures come from ("Closures happen as a result of writing code that relies on lexical scope. They just happen.") is just plain wrong, as evidenced by the fact that numerous languages with lexical scope do not provide closures as a language feature at all.

Sorry if this all seems a bit nit-picky, but you did just write a book about the importance of understanding the details and telling me I didn't know the language. :-)

1 comments

It seems that you are offput by his title in a way that you feel he is personally challenging your knowledge and experience with JavaScript. I would guess that when he was writing and naming this series, he did not have someone with 20 years experience in mind. Seems like the series is geared towards someone with moderate experience.
I don't think the title is the big issue here. I don't think it's good, and clearly it does put some people off with its tone, but as you say, maybe at least some of those people aren't the intended target audience.

My stronger reservation is that these books have a lot of loose writing and give so much space over to asides or describing bad practices that someone who wasn't so experienced might still not know JS by the end, having missed the wood for the trees.