r/javascript • u/bpesquet • Jul 26 '17
The JavaScript Way, a new book for learning modern JS from scratch
https://github.com/bpesquet/thejsway10
u/On3iRo Jul 26 '17
This looks pretty good. I will definitely recommend this to js beginners. Thanks for sharing.
8
u/dangerzone2 Jul 26 '17
This looks looks like a great intro! However, I really wish these intro docs would also implement namespaces. Otherwise you're just cluttering the global namespace and asking for trouble if jumping in or creating a larger'ish project.
2
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/sjwking Jul 27 '17
This. Since there is a standard, follow it because of future compatibility issues.
1
u/dangerzone2 Jul 27 '17
Thats a great idea as well! I'll definitely have to consider that approach for the next project.
1
u/cyr1s Jul 27 '17
Any resources you can recommend that do?
2
Jul 27 '17
Look into the module pattern. https://stackoverflow.com/questions/881515/how-do-i-declare-a-namespace-in-javascript Skip over to Divyanshu Rawat's answer, I think it's a great explanation.
4
u/asdf7890 Jul 27 '17
Skip over to Divyanshu Rawat's answer
You can link directly to answers using the share link at the bottom of them, https://stackoverflow.com/a/41962097 in this case.
If you are logged in the link generated will include your user ID. If that is a problem for you then open the page in an incognito/private/similar window and use the share links from there.
1
1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.1
u/XVsw5AFz Jul 27 '17
I'd be careful with that. We're currently in the middle of upgrading a very large application that used a homegrown namespacing system. It was using an older grunt based simple concat/minification build pipeline where everything had to be put in the right order etc. Taking this system and moving it to webpack and
import/requirestatements has been beyond tedious. It's probably best today not to worry about namespacing at all and useimportandexport. Then use Babel and something like webpack to stitch the final output together for the browser.
6
u/spraaak Jul 26 '17
This will be my new resource to recommend to people when they ask for where to start with JS
8
1
Jul 27 '17
What is the difference between eloquentjavascript and this one?
2
u/bpesquet Jul 27 '17
Author here, so obviously biased, but anyway:
Eloquent JavaScript goes deeper about some topics, but it's not the easiest book to follow along.
The JS Way is designed to be more beginner-friendly and uses the latest language features. EJ uses an older syntax.
Both books are free to read online, so you can make your own opinion :)
1
1
u/thepeka Aug 07 '17 edited Aug 07 '17
Edit: I'm a jerk
1
u/bpesquet Aug 07 '17
Thanks for this pretty brutal feedback.
Your 'functional' examples show terrible anti-patterns like initializing an array, using a for look, and pushing to the array under a condition. Functionally this is an Array#find transform. And this poor advice is given continually throughout (specifically, loops everywhere).
Did you read this chapter entirely? It shows how to refactor these initial examples in a functional way, using
map(),filter(),reduce()and function composition.That coupled with the early and heavy push to the very limited class kw is enough that I won't be reading the rest. JavaScript is a prototypal language and you are doing your readers a huge disservice by glossing over what the sugar of class is actually doing (which is saw where there, but very much so glossed over.. not to mention the lack of using the factory pattern which is a hugely helpful real-world tool in JS). And inheritance for a game? ECS.
In the OO chapter, I explain that JavaScript OO is prototypical and that
classis just syntactic sugar over it. "Class is useless" is your opinion, not a fact. I made some choices for this beginner-oriented book, if you don't like them, don't read the book. Or better yet, try writing yours and see how easy it is.2
u/thepeka Aug 07 '17
yep, you're right. I apologize for my pre-coffee, mobile-only, hungover, poorly crafted analysis.
I have actual criticisms but this is overall a pretty good reference and I won't nit pick it.
2
u/bpesquet Aug 07 '17 edited Aug 08 '17
Nevermind, my reply was a bit brutal too.
And I'm interested in your post-coffee criticisms :)
6
3
2
2
u/rfargetton Jul 27 '17
I actually followed this guy's course on openclassrooms.fr, which was really similar to this. It is a fun and simple intro to JS. Definitely recommend it π
2
1
u/jegcel Jul 27 '17
Excellent resource. I'm both reading it, and recommending it to everyone who wants to start a career in web development. I especially like the tl:dr sections since they are not simplistic, but provide an effective summary of each concept. Thanks for sharing.
1
1
1
1
1
u/thxbra Jul 27 '17
I've added this to my curriculum of you don't know JS, udemy courses, freebootcamp & the modern js tutorial. In my short time studying this topic I've learned that immersion and active practice is key alongside my readings. This will be a perfect addition. Thank you very much.
3
u/Amos47 Jul 26 '17
I'm curious why you think starting at the front end, and doing a small piece on node later is the right way to go?
I've been instructing new people to build some basic node APIs then build an index page, then do some JS on that as the buildup to a full web app.