News for hackers. Stuff that matters.
Re:Ask HN: Resources for catching up on modern JavaScript fo... by sametmax on Tuesday April 10, 2018 @11:36AM (#16802123)
+1 for You Don't Know JS.

But the rest is a bit "all or nothing" isn't it ?

React is a huge bite for a start, espacially since you need webpack. How about something lighter first, like Vue.js ? Once you get how it works, you can up your game and go to React (+ webpack + Mobx, don't try redux at first it's too much) or Angular 2.

As for the backend, you can stay in Python first and do a rest API. Then once you get the front right, write a backend using node AND a framework. Do not attempt to pure JS first, it's like doing web Python without django or flask. Possible, but not worth it. ExpressJS is close to flask in philosophy, except for the asynchronous part.

If you really want to have fun though, checkout crossbar.io.

It's a Python router than allow very easy PUB/SUB and RPC between clients. Clients can be written in JS, Python, Java, C#, etc.

You can even write JS clients in the browser, making push notifications and other real time feature a breeze. It's a good way to give you motivation to try on JS: mix it with what you know, and try a new exciting technology. Plus a good way to see the difference between async in JS and in Python.

Re:Ask HN: Resources for catching up on modern JavaScript fo... by tomc1985 on Tuesday April 10, 2018 @01:11PM (#16803017)
Scratch all that. Go for as long as possible without reaching for a framework like React or Vue. You don't learn JS learning those tools, you are just learning the tool.

React et al gives language newbies good shoulders to stand on, but a lot of React's so-called concepts map fairly simply to lesser-known language primitives. (And for the record, writing a simple, one-way databinding library in JS takes all of about 20 lines of code)

Don't be a tool, learn more than the tools :)

Re:Ask HN: Resources for catching up on modern JavaScript fo... by alibarber on Tuesday April 10, 2018 @01:41PM (#16803314)
This is something that I'm not sure how I feel about in general. I'm not really interested in learning any particular framework (because there seem to be about a billion and the landscape changes every day), but then again re-inventing the wheel over and over is never fun, even if learning something new. I'm hoping that something like React might be quite instructive to use and study in looking at its design choices and API structure - and also to learn _why_ someone might want to use it and what the problems are in JS/Front end development that it's there to solve...
Re:Ask HN: Resources for catching up on modern JavaScript fo... by tomc1985 on Tuesday April 10, 2018 @02:17PM (#16803684)
The thing is, you aren't reinventing the wheel. There is a certain amount of repetition in programming... you will always need to sort a list, or iterate a for loop, or assign a couple of variables.

There is a re-occurring thread of inventors (especially on here) building things that are more complex than necessary, and certainly more complicated than the problem they are working on. React, Angular, Electron, and a lot of other tools all use 1000 words where 100 would do. If you go through programming thinking that that is normal, or acceptable, you are doing more harm to the ecosystem and your own knowledge than if you had "reinvented the wheel" a couple of times on smaller tasks.

In the long run neither frameworks nor languages matter. If programming to you is reaching for the latest framework du-jour then you will find yourself left in the dust unless you keep with technology's futile and arbitrarily-hastened pace. (And no, I do not consider it OK that this is considered necessary) But if you master the concepts of what the tools do... then you start seeing just how badly and inefficiently they are written. Then you find yourself bypassing them, and simultaneously completing projects faster than ever while writing bespoke code that fits your requirements perfectly, and is also much easier to maintain (because hey you wrote it)

Re:Ask HN: Resources for catching up on modern JavaScript fo... by sametmax on Wednesday April 11, 2018 @04:05AM (#16808991)
> In the long run neither frameworks nor languages matter.

While I agree with this statement, a real life project include several people, some new to the projects, some good, some not, some with experience and some young. It requires communication and sharing things.

And tooling helps a lot with that.

Re:Ask HN: Resources for catching up on modern JavaScript fo... by dalai on Tuesday April 10, 2018 @03:10PM (#16804183)
Could you expand a bit on your recommendation? Do you mean just ES6? Do you have specific resources to suggest? What do you think about all the associated tooling for writing, compiling, testing and debugging, when starting? Is a browser and a text editor good enough, or is a minimal setup vital, in particular when one is building something that is more than a toy project?
Re:Ask HN: Resources for catching up on modern JavaScript fo... by l_t on Tuesday April 10, 2018 @04:14PM (#16804868)
I would try to think of it from a first-principles approach. You can begin with a blank slate, for instance, a single HTML file with a <script> tag. Only when "doing it yourself" becomes tedious do you start to look for libraries to solve your problem.

Personally, I find a bare minimum of tooling to be valuable. I have built SPAs using 100% vanilla JS, and it can be quite repetitive and error-prone. I'd recommend using highly simple build tooling (maybe Brunch) and an extremely simple view layer like https://github.com/Matt-Esch/virtual-dom. Pretty much everything else you can build yourself with surprisingly few lines of code -- state management, routing, event handling, data bindings, etc. I think of it as "building your own framework", and although you might not want to do it for every project, the learning experience is great.

Re:Ask HN: Resources for catching up on modern JavaScript fo... by tomc1985 on Tuesday April 10, 2018 @04:46PM (#16805181)
l_t's response was very good, I would recommend what he has to say.

To follow-up... essentially, yes. A text editor and a <script> tag is one way to approach it, though I would advise that you stick with making something small. One-off, toy SPA's are a great way to get to know JS. (Here's a challenge: TodoMVC sans frameworks ==evil grin==) With big ideas it is a lot harder to do this with big ideas until you have a firm layout of the code in your head.

In fact, this may go against a lot of recommendations but I'd recommend getting comfortable with ES5 before moving to ES6. A lot of existing code is written to ES5 standard and, while ES5 is certainly missing LOTS of important goodies, there is more than enough language to do most kinds of data-processing. (Though don't feel bad if you find yourself building a util.js with a bunch of string manipulation functions, for example, or find yourself importing jquery... I consider JQ to be an exception to the 'no tooling' rule, because classic JS DOM manip really, really sucks). Things like callback hell are important to understand, even if you never intend to write in that style.

Re:Ask HN: Resources for catching up on modern JavaScript fo... by sametmax on Tuesday April 10, 2018 @01:18PM (#16803110)
Learning just the js language takes one day if you are an experienced programmer. It's a very small language.
Re:Ask HN: Resources for catching up on modern JavaScript fo... by mzzter on Tuesday April 10, 2018 @01:32PM (#16803224)
How is JavaScript a small language at all? It’s comparable to Java in the number of language features.

Java Reference https://docs.oracle.com/javase/specs/jls/se7/html/index.html

JS Reference https://www.ecma-international.org/publications/files/ECMA-S...

Re:Ask HN: Resources for catching up on modern JavaScript fo... by sametmax on Tuesday April 10, 2018 @01:40PM (#16803302)
It's not even on the same planet.

In JS you have a very small number of types, keywords and a ridiculously small stdlib.

I'm not sure what to make of your comment.

Re:Ask HN: Resources for catching up on modern JavaScript fo... by tomc1985 on Tuesday April 10, 2018 @04:50PM (#16805235)
There is a lot of meta-knowledge buried in using those few features that he is probably referring to. Knowledge of language features is one thing, knowledge of when to use them is another
Re:Ask HN: Resources for catching up on modern JavaScript fo... by sametmax on Wednesday April 11, 2018 @04:07AM (#16809000)
That's true for every language.

The only hard part with JS is the accumulation of bad design decision that means you gotta avoid or hack around part of the language.

The rest is just a basic dynamic language with some async semantics. Nothing crazy.

Re:Ask HN: Resources for catching up on modern JavaScript fo... by chatmasta on Tuesday April 10, 2018 @11:46AM (#16802228)
All good points. Some counters:

- Re: React. I actually disagree with this given that OP is an experienced programmer. The react API is very, very simple to learn but difficult to master. The forced conventions are good for productivity. If you use create-react-app, I don't see any reason to put off learning it until later, but of course you should start with the JS basics before installing react. I'm not sure vue would be better; in fact it might be worse as a first experience, just because there is far less documentation / community / ecosystem around it.

- Re: python backend. That's fine, but if the goal is to learn JS, you're not learning much by writing the backend in Python are you?

Nice tip on the crossbar.io, I'm going to check that out.

Re:Ask HN: Resources for catching up on modern JavaScript fo... by paultopia on Tuesday April 10, 2018 @11:48AM (#16802252)
Disagree slightly with the point about far less documentation/community/ecosystem on Vue. The Vue documentation is stunningly amazing---probably the best out-of-the-box documentation I've ever seen for a library, and that really makes it vastly easier to learn than its competitors.
Re:Ask HN: Resources for catching up on modern JavaScript fo... by sametmax on Tuesday April 10, 2018 @12:00PM (#16802350)
> Re: python backend. That's fine, but if the goal is to learn JS, you're not learning much by writing the backend in Python are you?

It's true that backend JS has the most modern dialect, and without any need for a transpiler. And OP did mention "modern".

Re:Ask HN: Resources for catching up on modern JavaScript fo... by sireat on Tuesday April 10, 2018 @04:53PM (#16805262)
If you want modern Javascript I'd say React is a better choice than Vue.

I spent 10 years doing embedded Javascript(not web) and wanted to see what modern webdev was like.

Vue came highly recommended but I do not feel like I am writing pure Javascript when writing Vue. Vue might be a better choice for someone who does not want to write JS.

The hip people told me to avoid React (FB, too massive etc).

Surprisingly React feels great for writing Javascript. Just learn ES6 features(arrow functions for one) and go to town.