Ask HN: What is the best JavaScript stack for a beginner to learn?
I'm an experienced Rails developer, and I'm helping a friend learn about javascript frameworks so he can eventually get a job (we're kinda learning together). He was considering the MEAN stack, but with the announcement of all the breaking changes in angular 2.0, I don't think it would be a good use of time to learn angular.
It would be nice if there was a Rails of javascript, but there seems to be a lot of competing technologies. Obviously, you can learn new things at a new job, but it would still be better to learn something with a lot of adoption. I'm thinking a MEEN stack (using ember instead of angular) or even using react and flux. Meteor is another choice, but I'm not sure how widely adopted it is. I think it would be best for him to pick one stack and master it well before moving on.
It's annoying because, when it comes to Rails, I know exactly what skills a beginner needs to learn. Does anyone know what the more successful js bootcamps like hack reactor teach? Or do you have any advice on a good stack for a prospective full stack js developer to learn?
60 comments
[ 3.0 ms ] story [ 118 ms ] threadAfter doing a small project with backbone, other frameworks like react + flux / angular or ember will be easier to pick up, and the tradeoffs they make will be easier to understand.
Then I would suggest building a project with jQuery. It has been around for years. Any seasoned JavaScript programmer will have encountered a project that was based on jQuery. It will also help you understand the motivations behind the creation of the more recent frameworks: React, Angular, etc.
For the backend I would stick with Rails. I see no benefit of moving to Node for a general application when you already know Rails.
Ember, Ember Data and Rails works incredibly well together.
React is probably the best candidate to achieve that simplicity along with Angular, although I would give Angular the edge, simply because it does not rely on tooling to build a small app and still benefits just as well from it when it is present. The documentation, even two years ago, was better than Backbone's at the time (and as far as I can tell from a recent study of Backbone, still is) - Ember's might have been a little better, but it also threw more stuff at you upfront.
The expert can probably work with all of these frameworks just fine - in the end, finding what framework (or no framework) jives with you is the best for your long term development. Become an expert with one, then experiment with others to draw good ideas from them and incorporate it into your code style, that is what separates the good developers from the rest.
Whatever you're working with will most likely be out of touch with what the job requires and outdated in a year, but the ability to pick up new things is an indefinitely transferable skill.
In addition to not bothering with stacks, I would also advise you not to limit yourself to JS.
Personally I am into React/Flux lately but that's because I like doing things at a bit lower level, with more control. Note, lower level doesn't mean better.
So I don't really know what to tell you, except that you probably have the wrong idea about JavaScript, and so the best recommendation is, as others have said, to work without a framework (other than jQuery, of course) until you understand what JS's role is in web development.
In analogy form, I think his question is:
Ruby::Rails
Javascript::???
I'm not saying this is the "ideal" front end stack (because that has yet to be created) but a good simple starting point IMO would be backbone + react. Very simple, flexible introduction to concepts like router, functional reactive, and components.
Backbone is not needed with React and although it is possible for them to be together (hell, we lived React+Backbone for almost a year), everything gets so much nicer when you can finally drop Backbone baggage.
It might be possible though that in order to see where Flux shines, one has to sweat through limitations of Backbone. That may be valuable experience.
I'd like to add also that a simpler approach is often the best choice for experts as well. The big complex frameworks simply are not the right tool for many (perhaps even most) projects.
So if anyone's reading this and feeling bad that they don't feel like doing that, just dive in and do something fun. The longer you spend learning, the more likely you are to pick up all of those important details anyway.
But it's not that bad when you have someone behind you, helping you when really needed, and showing you what you can achieve afterwards.
Jumping into JQuery, copy/pasting snippets from google and such won't (well, not often anyway) bring novices very far. Plus, they'll have a hard time learning other frameworks if needed (new job, etc.).
Example of first week complexity: make a choose-your-own-adventure player from a list of {id="sec01", text:"..", links:[{'Continue':'sec02'}, ]}s.
Second week: Wrap the chrome speech API[1] to produce a "game editor" for the above format.
Third week: make a youtube playlist editor that plays a list of time intervals from youtube videos: [{'tStart':0, 'tStop':451.3, 'url':'utube/URL'}, {..}, {..}, ... ]
It's just "toys," but they're immediately useful. In general I think ''file://localhost'' development of .js is a good place to start because of the immediate feedback---it either works or it doesn't.
@nielmalhotra One thing you can tell ur friend is that everyone is a beginner with the most of the modern APIs. So by reading the docs and trying things out he's already a "research level" web dev ;)
[1] http://www.google.com/intl/en/chrome/demos/speech.html
- http://codecombat.com
- http://www.codecademy.com/en/tracks/javascript
- http://nodeschool.io
(I haven't used any of them, but these are the ones that I've heard about)
I just wrapped up the one for Hapi.js which was slightly out of date in NPM (the source on Github does seem up-to-date).
After that, you should have enough JS knowledge to start building a client-side app that consumes your API. I honestly prefer AngularJS, but React+Flux seems like a fine choice.
There are a lot of benefits that come from using mainstream existing frameworks and libraries from the beginning. You learn conventions pretty quickly, and immediately learn to write idiomatic code for that language. When you use a major framework or library there are typically a lot of blog posts and stackoverflow answers, more so than just for a language itself. When you track down errors you'll end up learning about how the frameworks and libraries work, and thereby learning about how to implement things you wouldn't have considered independently.
As a result, what I'd recommend is coming up with two extremely simple ideas for tools that he'd find useful for himself and implement one each with Ember and React.
Personally, I've been following this approach for many years (I'm currently simultaneously working on three new projects in multiple new-to-me languages like this) and it works extremely well in my experience.
It's not something that can be learnt over the weekend and takes time to master.
Just like Rails, it seems to be able to a lot of things by magic and needs some dedicated effort to understand. This article from their blog [2] and this video [3] gives a very good comparison of what Sencha ExtJs covers with respect to other Javascript frameworks.
[1] http://www.sencha.com/products/extjs
[2] http://www.sencha.com/blog/4-questions-to-ask-before-choosin...
[3] http://vimeo.com/108127206
Focusing on learning frameworks seems like a good idea for resume-building purposes, but they come and go like fashion. Learn Javascript the language very well first, and then learning the framework du jour will be trivial.
When youre more familiar you can roll your own cutting edge framework, maybe use koa, write a yeoman generator, fancy non-relational databases like couchDB. Learning to recite APIs as one comment pointed out will actually help you understand good api design, and give you a working idea of how theyre wired usually, allowing you to ramp up faster on a new framework than if you jut knew vanlla js and individual components. IMO. Sorry for any spelling errors, temporarily on a samsung v1 chromebook, things appear a few seconds after i type and the internet is hard to use while listening to music
1. Start with vanilla JavaScript/DOM and try to make a small app with that. You'll learn encapsulating DOM into some kind of DIY views, and browser APIs such as pushstate, requestAnimationFrame, etc. This is an essential step.
2. (Optional) Try a classic MVC framework, simpler is better. Backbone is very basic and might be a good idea as middle step. Refactor your simple app to use Backbone views and models. Learn the hard way about their shortcomings.
3. Learn React and Flux (any flavor). Throw Backbone away. Ditch imperative DOM updates, learn top-down data flow. Even if you don't stick with React, other frameworks (e.g. Ember) are starting to embrace top-down data flow, and it's an essential concept that simplifies webdev so much.
4. (If you really feel like it) Try some Angular. This will help you see why one-way bindings, no templates, no direct DOM manipulation and minimal API surface rock over other approaches.
5. (If you want to stay on the edge) Try exotic stuff like Cycle.js or Om (or Omniscient.JS if you don't want to leave JS land). These build up on ideas React pioneered, but one uses Observables as primitive and other uses Cursors.
Another great resource is You Might Not Need jQuery (http://youmightnotneedjquery.com/). Take what you need, leave the bloat behind!
If your friend's a total beginner, though, then it's better to just learn vanilla js for now.
An essential that might be obvious but in case he missed is that learning JS is much easier in the developer console. If you want to experiment with underscore, go to http://underscorejs.org/, hit cmd-i/f12 and type in _.map([1, 2, 3], function (x) { return x * 2; }); or if you want to understand moment, go to http://momentjs.com and type moment().fromNow(); in the console -- the library objects are available there and this makes it really fast to try things out.
http://backbonejs.org/docs/backbone.html
If you don't understand all of that, probably learn more javascript.