Skip to content

Instantly share code, notes, and snippets.

@Raynos
Created April 12, 2012 22:57
Show Gist options
  • Save Raynos/2371647 to your computer and use it in GitHub Desktop.
Save Raynos/2371647 to your computer and use it in GitHub Desktop.
JavaScript tools

RE: State of the Art

There was a recent article on State of the Art JavaScript. It's fully of dated / wrong recommendations.

Let's see what he is recommending:

JavaScript

JavaScript is awesome and state of the art ;)

I presume what he failed to mention or talk about is what state of the art JavaScript looks like. State of the art involves writing lean and modular JavaScript that complies with separations of concerns including techniques that are common to software engineering in general like writing tests and documenting your code properly.

jQuery

jQuery is a mediocre library at best, I would recommend avoiding it where possible as it's bloated and ugly, not to mention it incurs a performance penalty of an order of magnitude.

If you need a legacy browser compliance strategy consider

  • using a shim
  • not supporting legacy browsers
  • offering HTML / non-JS versions to legacy browsers
  • Writing your own layer

requireJS

requireJS is a reasonable library for AMD compliance, it has some ugly bits on the edges. There are alternatives for AMD compliance like curl or other AMD loaders.

There are furthermore alternatives in the form of using [commonJS modules]. There are numerous commonJS loaders including webmake, browserify and modul8.

It should be given considerable though which one to use although they are very similar. (I prefer commonJS because the API is cleaner and node.js compliant).

BackboneJS

MVC libraries are for developers who can't implement MVC as an architecture.

Seriously though, these libraries are silly. MVC is a code organization pattern, you use it to organize your code. You don't need a library for this. The same goes for any MVC library.

Backbone in particular is just bloat upon bloat that get's in the way.

underscore.js

Underscore for templating, really? Ugh. templating is a [simple function] or a complex templating library.

Including all of underscore for a 10 line templating function is madness.

QUnit

QUnit is horrid.

  • Does not comply with commonJS test specs
  • Doesn't do asynchronous testing elegantly
  • Doesn't give style / spec choice for the API like mocha
  • Can't be run in the command line
  • Doesn't have multiple reporter formats, TAP anyone?
  • No test coverage
  • No before/after/beforeEach/afterEach/etc

That should be enough. Please use mocha

Jetty

What, Java? Just use node.js, done. Or if you want a http server to do http, apache/nginx servers that purpose (althought node also serves that purpose with a simple npm install)

JsMockito

I'm sorry but mocking is silly, just mock it out manually using the flexible and dynamic language that is JavaScript.

I havn't seen a single good mocking library that doesn't give enough value for the added complexity and confusion it adds. Please let me know if good mocking libraries exist.

JSCoverage

JSCoverage is pretty good, and by pretty good I mean awful but it's the lesser of evils.

Mocha uses it to do code coverage, I do recommend you use an abstraction on top of it or wait for TJ / SubStack to write a good one. Or just write a good one.

PhantomJS

Phantom just like zombie are pretty cool.

I however find myself running unit test suits in browser directly or unit testing HTTP using request in node.js

JSDoc

Is a joke. It's ported from Java. All of it's documentation doesn't help with node.

There are currently no good documentation generating tools, I recommend you document your code naturally and manually write API / docs pages. This increases usability as much as possible. I've also seen most auto generated JSDoc pages, they can't be navigated or used effectively.

Ant

Use node or make or grunt. XML build systems are silly

Rhino

Use node.

Minifier X

Use them.

Employer is understandably hesitant to switch to a minifier that rewrites our code (e.g. UglifyJS, Google Closure Compiler) on a large, existing JavaScript web app. Do you have any info/stats to help me push them past this?

Yeah the info/stats are run your unit test suite on the uncompiled and compiled code. Then show they both pass.

But I don't have a unit test suite!

Then write one. You can't write software and not write tests :\ That's a joke.

WebStorm

As far as IDEs go, webstorm 4.0 is the lesser of evils. It's still a leaky JS IDE. I personally recommend you use a text editor of choice like vim or sublime text 2

SASS / LESS

SASS / LESS are useful for keeping your CSS DRY. However they have disadvantages if used too heavily, use them sparingly.

Dev Tools

We kind of need these to debug. So yes using them is to be taken for granted. It should be noted that safari and opera also have dev tools that are useful

Node.js

node.js is awesome, use it to solve all your problems

TestSwarm

Lovely concept, we have to see whether it's practically useful. Alternatives to this are testling

Selenium

The entire selenium stack seems bloated. I would personally avoid in favour of unit tests, HTTP tests and distributed browser tests

CoffeeScript

As mentioned, it's a joke.

Dart

Also a joke

Jasmine

Jasmine is like mocha but more shit

Pavlov

It builds on QUnit, therefore shit.

JsUnit

Lol no.

JS MVC

Lol no.

knockout

Interesting concepts, mediocre implementation

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