News for hackers. Stuff that matters.
Re:Patterns For Large-Scale JavaScript Application Architecture by alfl23 on Saturday January 18, 2014 @07:01PM (#7082818)
From an architecture perspective, the article is a great read. However, the systemic damage in JS applications comes from profound general delusions concerning the JS language itself.

Strong performance anti-patterns can be found in any example listed in your article.

http://stackoverflow.com/questions/12973706/javascript-colle...

Re:Patterns For Large-Scale JavaScript Application Architecture by iends on Saturday January 18, 2014 @09:53PM (#7083197)
This SO post is really good, but some of the points made in the post are not very clear. For example, why is arr['key'] = 5; consider bad? I've read the post and the code, but it's still not clear from the example.

When does using Object.prototype.hasOwnProperty lead to bugs?

Any benchmarks on case statements being slow?

Any additional reading on this type of thing (books, etc)?

Re:Patterns For Large-Scale JavaScript Application Architecture by jdlshore on Sunday January 19, 2014 @01:08AM (#7083566)
As usual, it's best not to sacrifice readability for performance until you have proof of a bottleneck. Most of the code you write isn't performance-critical. And (thanks to existing performance optimizations in everything ranging from the JS VM, to the OS, to the CPU itself) it's very, very easy to be wrong about where your performance problems are. Note the comments under the SO article; most of the micro-"optimizations" are actually slower than normal code.

Also, it answers the question wrong. :-b (Arrays are objects in JS, with a bit of extra magic.)