Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Essential JavaScript Links
@ericelliott
Copy link
Author

ericelliott commented Feb 27, 2015

@nackjicholson If you want to tightly couple your modules to your app, by all means, make them depend on a dependency injection container.

Wait. Wat? Yeah. The whole point of dependency injection is to loosen the coupling between modules, but a DI container bypasses the nice dependency system built-in to node (so any dependency static analysis has to be rolled out custom for your app), and your dependencies all end up knowing each other by dependency name.

Granted, it makes it a little more convenient to swap out dependencies (just replace the named dependency with something else), but if you're building wisely, you're exposing facade wrappers to your app, anyway, so that benefit is nullified.

"Sometimes, the elegant implementation is just a function. Not a method. Not a class. Not a framework. Just a function." - John Carmack

The great thing about functions is they can take arguments. The great thing about JavaScript is functions can even take other functions as arguments.

You want the most flexible dependency injection system? For anything that produces objects, export a factory function that takes an options hash.

Do the same for dependencies that need to be shared between modules. Pass in your logger and your app config objects.

If you're worried about DI, this should be your new favorite pattern:

module.exports = function myAwesomeThing(options) {
  var myAwesomeInstance = {};
  // use dependencies passed in on the options object
  return myAwesomeInstance;
};

Want to get really fancy? Throw Stampit into the mix for truly flexible factories.

@ericelliott
Copy link
Author

ericelliott commented Feb 27, 2015

@Cmdv Many of those benefits are available through plugins in Sublime Text, but WebStorm does have some very nice static analysis built-in. Sublime Text + Tern + DocBlocker gets you most of the way there, but WebStorm is all pre-configured for you.

But for me, I keep going back to Sublime Text because it's faster. WebStorm is like a Cadillac that tops out around 50mph. Sublime Text is the nimble sports car. I find after I've invested time tuning it, I can run circles around WebStorm... it's just that up-front investment that sucks. =)

Your mileage may vary. It's certainly possible to bog down Sublime Text too if you go too crazy with the plugins. For example, I always build a nice dev console into my projects so I get realtime lint and unit test feedback while I'm developing, so I don't install any of the inline debugging tools in Sublime. I also have a tendency to do quite a bit of interactive debugging directly in Chrome with workspaces, so it would be dishonest to say that my whole workflow really depends on Sublime Text. I let it be a good text editor, and I let my other tools be awesome at what they do.

@Nevraeka
Copy link

Nevraeka commented Mar 2, 2015

Hosting - Divshot

@igwemagnusnnamdi65
Copy link

igwemagnusnnamdi65 commented Mar 20, 2015

@ericelliott you remain blessed.

@mindjuice
Copy link

mindjuice commented Mar 20, 2015

@ericelliott How about a list of the best/most useful Sublime Text plugins? You mentioned Tern and DocBlockr. Others?

@xfq
Copy link

xfq commented Apr 5, 2015

I think the HTML5 community on Google+ has too much off-topic stuff.

@nackjicholson
Copy link

nackjicholson commented Apr 8, 2015

@ericelliot As always thanks. I have been doing exactly what you suggest above. Factory/Builder pattern for injecting dependencies and options into modules. It does work really well.

As far as the areas of my code, usually near the entry point, that end up being spots where objects and options are constructed in order to be passed around -- I guess that's just sort of natural consequence.

@ericelliott
Copy link
Author

ericelliott commented Apr 8, 2015

@nackjicholson - I rarely have a ton of objects with methods floating around. Instead, I have a lot of functions in place and state flows through them. See The Two Pillars of JavaScript Part 2 for why that's a good thing. =)

@rwaldron
Copy link

rwaldron commented May 2, 2015

@hueitan
Copy link

hueitan commented May 4, 2015

Javascript SDK design guide extracted from work and personal experience
https://github.com/huei90/javascript-sdk-design
page: http://sdk-design.js.org/

@KhaledMohamedP
Copy link

KhaledMohamedP commented May 6, 2015

It doesn't hurt to add CodeSchool.com and codecademy.com

@hoichi
Copy link

hoichi commented May 10, 2015

Not specific to JS, but I've found Debuggex extremely handy for regex debugging.

@moklick
Copy link

moklick commented May 19, 2015

Why should we suggests links here instead of creating pull requests?

@ericelliott
Copy link
Author

ericelliott commented Jun 1, 2015

@moklick Originally, it didn't have a proper repository. I started it as a gist, and it grew and took on a life of its own. You should use pull requests, now.

@smolinari
Copy link

smolinari commented Apr 5, 2017

Hey Eric. What happened to your EJL repo?

Scott

@victor-dev
Copy link

victor-dev commented Apr 25, 2017

Why the Essential JavaScript Links List was 404 ?

@ryanmortier
Copy link

ryanmortier commented May 8, 2017

404ing :(

@emilioriosvz
Copy link

emilioriosvz commented Jun 12, 2017

404 :(

@Mashpy
Copy link

Mashpy commented Jul 19, 2017

Thanks for your listing. If anyone would like to read JavaScript books, here you will find best javascript books for beginners.

@dwiyatci
Copy link

dwiyatci commented Nov 3, 2017

@ericelliott Everybody around the world is crying to know where does the repo go.. 😭 😭 😭

Guys, perhaps we can use this in the meantime?
https://devhub.io/repos/ericelliott-essential-javascript-links

@joeydebreuk
Copy link

joeydebreuk commented Oct 23, 2020

Isomorphic JavaScript url doesn't exist.

@ericelliott
Copy link
Author

ericelliott commented Oct 26, 2020

I no longer mantain this list. There are lots of other very comprehensive JavaScript link lists out there. Please see those, instead (Google "awesome JavaScript" for a start).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment