11 ms·
JavaScript: The Right Way
- LordQuas3000 13y agoThank you very much for posting this, very useful.
- Lauricio 13y agono meteor?
- stevewilhelm 13y agoWow, no mention of Ember.js (we switched from Ember to Backbone last fall).
- bstamour 13y agoIt was mentioned in a section about frameworks: http://jstherightway.org/#frameworks http://jstherightway.org/#frameworks
- j_s 13y agoIt would be nice to see the browser versions supported by all these projects in one place... this simplifies the process of elimination for those who have to support older browsers.
- nazka 13y agoA similar website posted on HN. Very well done. http://superherojs.com/ http://superherojs.com/
- novaleaf 13y agoI started web development 8 months ago. First I started by reading "The good parts" but honestly it's not really a good book to learn from 0 with. The thing that really got me going? Typescript. Not only does it help with abstracting javascript syntax, but the intelisence made me not have to google every 20 characters i write.
- elwell 13y agoShould add jashkenas [0] to "WHO TO FOLLOW". 0 - http://github.com/jashkenas http://github.com/jashkenas
- _mhr_ 13y agoWhat I've never understood is how to effectively use both objects and functions in a multi-paradigm language like JavaScript. Most introductions to JavaScript explain how to use functions in their own section and explain how to use objects in their own section, but they never explain how to combine the two techniques.
- semerda 13y agoNice site. Cheers for sharing! JavaScript Patterns by Stoyan Stefanov (made the list under reading/books) is a must for anyone wanting to learn JavaScript the right way. The content volume is just right with great examples. Can be read in a week easily and get you rolling writing better code fast!
- mcgwiz 13y agoGiven that the greatest challenge to JavaScript testing is the browser environment, it'd be worthwhile to mention Zombie.js (simulated DOM) and PhantomJS/CasperJS (V8). Code organization is also important for any large codebases, which is often addressed with browserify or RequireJS.
- harlanlewis 13y agoGood resource, nicely presented. "We recommend you whenever possible to verify you code style with a Lint tool." That's not all they need a Lint tool for!
- gnuwilliam 13y agoThanks for the feedback! We'll improve that. :)
- shangxiao 13y agoNice, I like what you're trying to do, but things like "Backbone.js: The most popular JS client-site framework" worry me. Most people I talk to avoid Backbone nowdays in favour of the other popular frameworks. Also: some descriptions appear to be lacking/missing & you definitely should mention Grunt under "Helpers". At least it's a GH repo and I assume you'll accept PR's? ;)
- ahoge 13y agoThe most popular one right now is probably Angular. http://www.google.com/trends/explore#q=angularjs%2Cbackbonejs%2Cknockoutjs%2Cemberjs http://www.google.com/trends/explore#q=angularjs%2Cbackbonej...
- daliusd 13y agoActually jQuery or is it not framework anymore?
- ahoge 13y agojQuery is a library for things like DOM manipulation, AJAX, animation, and events. Ember and Backbone depend on jQuery, for example.
- shangxiao 13y agoAgreed, jQuery is more of a toolkit that complements frameworks
- wwweston 13y agoIt never was a framework; it was a better API for the DOM + some various other browser APIs -- so much better, in fact, you can get a near-framework-like productivity boost using it. (At least at first, before it starts to matter that it's no help in terms of organizing a larger application. :)
- nailer 13y agoAs anther poster mentioned, search may not be an indication of popularity. Personally, I've used Backbone, Angular and now Ractive, and I spent at least 10x the time Googling when using Angular.
- rmason 13y agoNice site but I take exception that backbone is the most popular framework. While I don't think popularity alone is how you should chose a framework. It appears that AngularJS tops all except jQuery at this time. http://www.google.com/trends/explore#q=angularjs%2C%20backbone.js%2C%20emberjs%2C%20knockoutjs&cmpt=q http://www.google.com/trends/explore#q=angularjs%2C%20backbo...
- deleted 13y ago[deleted]
- gojomo 13y agoThat might be a 'confusionRank' moreso than a 'usageRank'!
- frik 13y agofound a dead link in the article: http://killdream.github.io/2011/10/09/understanding-javascript-oop.html http://killdream.github.io/2011/10/09/understanding-javascri...
- macco 13y agoBesides the questionable choice of framework. Does this guide make sense? What would you remove or add?
- tipiirai 13y agoHow about https://moot.it/riotjs/ https://moot.it/riotjs/ ?
- aaronem 13y agoYep, that's a questionable choice of framework, all right.
- user24 13y agoA mention of JS debuggers like theseus might be good. Would be cool to automatically change the URL to the anchor as I scroll.
- al2o3cr 13y agoNeeds more description of why one might choose (or not choose) a particular tool. Readers already know "X is a framework" because it appears under the "Frameworks" heading: what is each framework good at? More importantly, what isn't it good at - for instance, some of the bigger frameworks are tricky to integrate if you don't want to hand them control over the whole page.
- pingsifu 13y agoI am not too fond of the styling. Looking at it on my desktop PC, the page could use some left/right margin. On my iPhone on the other hand its rather unreadable.
- sehr 13y agoFork it and add your own styling?
- garaboncias 13y agoStrange that it's just refer several times but not list jQuery as a framework but did with Zepto. It's not mention lodash / underscore which is very elementary if you want to avoid reinvent the wheel.
- CmonDev 13y ago"JavaScript has strong object-oriented programming capabilities" What would be an example of a language with weaker OOP capabilities? PS: "The bad parts" section did not fit the page?
- tchaffee 13y agoJava would be an example of a language with weaker OOP capabilities. Javascript can emulate classic OO inheritance and it also supports prototypical inheritance. Crockford covers this in his Good Parts book, and you can find stuff around the web.
- CmonDev 13y agoThis way I can say that Java supports OO inheritance and can emulate prototypal inheritance (this can be done in C# and I suspect in latest Java). I think the correct statement is that "JavaScript supports a simple OOP model".
- boomlinde 13y ago> What would be an example of a language with weaker OOP capabilities? Something without the concept of objects built in? C?
- manish_gill 13y agoHaving recently started getting into Javascript, I have to say it is the most confusing ecosystem ever. Learning the basics of the language is easy enough, but as soon as you start trying to create a non-trivial application, bam, you're hit with information overload - X framework, Y library. It's different from Python, Ruby et all because at least with them, there are good consistent popular choices that you can rely on. With Javascript, more often than not, I'm left scratching my head as to what I should exactly use. :/
- elwell 13y agoI suggest trying CoffeeScript if you want to a cleaner version of JavaScript. Not that that answers your framework question.
- krapp 13y agoCoffeescript isn't javascript, though.
- vonseel 13y agoHehe. I know the feeling. I've spent a lot of time learning about the different options over the past year. Maybe it was wasted time, hopefully not. Backbone taught me a lot about design patterns in general (event aggregators, pub/sub w/Marionette, MVC). Then I started learning Angular which felt like being turned upside down.
- onli 13y agoIf in doubt, just use Javascript without anything. Maybe add jQuery. All those frameworks may be nice, but as soon as the tools get a distraction, I think it is useful to step back. And JS doesn't really need anything to be useful.
- Torn 13y agoI'd say underscore needs to be there too
- Torn 13y agoNice collection of resources on a single page. There's a fair amount of typo's and grammar mistakes however.
- citrin_ru 13y agoIt funny, but clicking to this link caused high CPU usage for N seconds and message from Firefox: A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete. Script: http://jstherightway.org/js/jquery.js:1144 http://jstherightway.org/js/jquery.js:1144
- smenko 13y agoFor something containing "the right way" in the heading, this has awful grammar.
- tchaffee 13y agoThe command pattern is featured in the article. Why would you use that pattern in a language that supports first-class functions?
- Millennium 13y agoFor tasks that are created, executed, and processed purely in code, you wouldn't. But it still has uses in other areas, especially when you need to build something up from user input.
- tchaffee 13y agoCould you give a concrete example? Why wouldn't you be able to use first-class functions when building something up from user input? How about giving us a code snippet? The consensus in the CS community is that the command pattern disappears (becomes overkill) for languages with first-class functions. This has been noted as early as 1998 by Norvig when comparing C++ to Lisp. It's one of my criticisms of Addy's JS Patterns book. He just blindly copies the GoF patterns and many of them are not needed in languages with modern features.
- jkleiser 13y agoI would have expected to find React (http://facebook.github.io/react/ http://facebook.github.io/react/) among the frameworks.
- outworlder 13y ago> "Different from C, C# and Java, JavaScript is an interpreted language. It means that it needs an "interpreter"." I have an issue with the above statement. There are no compiled or interpreted "languages". There are only implementations. There's nothing preventing someone from "compiling" it.
- Pacabel 13y agoThe distinction can very much exist in practice, depending on the existence and capabilities of production-quality implementations. While there have been attempts to compile a language like Python down to native code, they are still very limited and not useful in a practical sense. Hence, Python is a de facto interpreted language, since its usable implementations are implemented as interpreters. The same goes for JavaScript today. Given that all of the usable implementations are interpreters, JavaScript can currently be considered an interpreted language.
- magicalist 13y ago> The same goes for JavaScript today. Given that all of the usable implementations are interpreters, JavaScript can currently be considered an interpreted language. This hasn't been true for quite some time. SpiderMonkey and JavaScriptCore do include interpreters, but only use them while code is first running. If a function gets hot, they then JIT compile the code. V8 has no interpreter at all, only JIT compilers (and is certainly usable and in wide use). And finally SpiderMonkey even just added an AOT compiler for compliant asm.js code (which, while a subset, is indeed valid JS code).
- gnuwilliam 13y agoHey guys! I see there's a lot of great suggestions and critics here! Since it's an open source project, you can feel free to open a pull request telling which resource you think it's better to be there, or which one should be removed. As well help me correct the grammar errors. I'm from Brazil, and my english is not that good. I'm really glad about all the opinions, and for sure the site will be improved from now on. Thanks!
- ericdahl 13y agoHow does this website relate to this repo [1]? I was going to contribute some fixes to the page, but when I cloned the repo, I found significantly different content. I'm also confused as to why the website [2] says that it is based on itself [2] at the bottom of the page. [1] https://github.com/braziljs/js-the-right-way https://github.com/braziljs/js-the-right-way [2] "Based on a work at http://jstherightway.org" http://jstherightway.org"
- tambourine_man 13y agoHey William, nice initiative. Your page is split in half on the iPhone, check it out. Cheers.
- n3m6 13y agoWould be nice if it had the Functional JavaScript book by Fogus.
- NigelTufnel 13y agoI occasionally code in Javascript and I always get the feeling that I'm working with a language without a decent built-in standard library. Want to work with dates? Use a third party library (or use built-in 1995-style library). Want to format a string? Use a third-party library. Want to do X? Use a third-party library. Coding in e.g Python feels completely different: almost everything I need is in the standard library.
- revskill 13y agoJavascript is the bare tool, in order to build abstraction, you need science, i mean something like algorithmic way in rendering view with framework like React framwork, it makes sense because it makes all developer around it thinks in the same way. It's the right way to do all successful thing.
- exodust 13y agoIs there a "too clever" mentality in frontend web dev culture of late? An overly fragmented workflow toolset? Not sure the cause, perhaps the influx of engineering "computer science disciplined" brains into the frontend world. Or a panicked competitive race to achieve a nirvana dev environment. Or a tendency to think that workflows for large websites with countless modules is the best workflow for a one-page web app. Overkill for the intended task, or cluttering your project with too much technology, is the thing to watch out for in the frontend aspect. Layers of tools and libraries and plugins can easily get out of control and beyond a joke. Don't forget you've got a web app to build while you mess around with the "right way" to build it. You do not need a cup-holder on your scaffolding. Just using plain JS with Jquery, and perhaps some additional smaller specific plugins/libraires, is enough to do a lot of cool stuff if we're talking "javascript" projects. Then just get a good editor and off you go.
- marknutter 13y ago> Just using plain JS with Jquery, and perhaps some additional smaller specific plugins/libraires, is enough to do a lot of cool stuff if we're talking "javascript" projects. Then just get a good editor and off you go. These new tools and frameworks are becoming numerous and popular precisely because for large, complicated front-end applications you can't just get away with using "plain JS with Jquery" without it becoming an unmaintainable mess and writing boilerplate DOM manipulation code all over the place. The only people I meet who have an aversion to these modern JS frameworks are front-end devs who refuse to learn them or server-side devs who hate javascript.
- exodust 13y ago> you can't just get away with using "plain JS with Jquery" without it becoming an unmaintainable mess and writing boilerplate DOM manipulation code all over the place. Nonsense. Maintainability is all about good documentation, neat code, sensible peer-reviewed code, a good dose of manual testing and a healthy injection of personal responsibility in seeing the project be the best it can be for your users. I test my work manually on a bunch of test devices and computers I own. It doesn't take long and I get to see any browser specific display glitches that automation tools wouldn't pick up. It's a no-brainer, and you LEARN about the nature of browsers by testing manually. I hate bootstrap, don't use it. I've made big website templates with lots of traffic, and smaller components and other things. I don't want bootstrap in the mix thanks. Whenever I have to maintain a project which someone else started with bootstrap, I sigh and dive into the ridiculous use of simulated rows and columns, and the crappy CSS overrides meant to give us flexibility, but actually giving us not much at all. So how do other developers like my work when they have to maintain it? Well, I leave them something SIMPLE and well documented to decipher, so they can get straight to work doing the maintenance and getting on with business. No learning curves of countless toolsets and pre-processing junk. Just the basics. I've had no complaints. Frontend is very much concerned with visual elements and interaction. I don't know much about server side except for what I find behind the projects I work on and fetch with AJAX or other means... such and such data feeds, this or that outputs etc. I'm more interested in user interfaces and how a web app or webpage "feels". I know exactly what to do when something doesn't feel snappy, or a graphic flashes or renders poorly on load. I know what to do because I haven't sold my soul to a framework that promised me the world, but delivered mediocrity. Each to their own.
- EvanYou 13y agoKarma's author is not Isaac Durazo - he is the logo designer. Karma is written by the team behind Angular (mostly by Vojta Jina).
- gnuwilliam 13y agoFixed! Thanks. :)
- jasonkostempski 13y agoThis is JavaScript: The Infinitely Many Ways. Shouldn't the right way remove at least a few options from the table? I've found a sweet spot for myself, at least for single page apps which is what I work on most of the time. jQuery, Require.js, text.js and JSLint. r.js for building release versions. Those, along with a small "view" class I wrote whose constructor takes an html string, finds all elements with a data-vid attribute and adds properties to itself pointing at those elements. Markup is kept in bite-size html files, loaded by require during development but compiled into the single js file for release. Also, I can't remember the last time I used a jQuery selector.
- meritt 13y agoSome additional comprehensive JS resources: http://eloquentjavascript.net/ http://eloquentjavascript.net/ http://shichuan.github.io/javascript-patterns/ http://shichuan.github.io/javascript-patterns/ https://github.com/airbnb/javascript https://github.com/airbnb/javascript
- dabernathy89 13y agoNote however that Eloquent JS is undergoing a rewrite; the original edition is a bit outdated.
- sehr 13y agoDont forget: http://addyosmani.com/resources/essentialjsdesignpatterns/book/ http://addyosmani.com/resources/essentialjsdesignpatterns/bo...
- meritt 13y agoThanks this one is awesome, I had never seen it before.
- usablebytes 13y agoExcellent work there. I always wanted to work on such a public collection but kudos to these guys on making it a reality. I've used/read-about/tried-out most of the stuff listed there and appreciate the hardwork that has gone into putting all of it together. I think Polymer (Google) and Brick (Mozilla) deserves a mention there as Web Components have a very high possibility of becoming the ultimate way for the future of web development.