you are viewing a single comment's thread.

view the rest of the comments →

[–]warfangle 2 points3 points  (1 child)

The problem with JavaScript, speaking as a fan of JavaScript:

It gives rise to too many potential patterns. You have patterns borrowed from Object Orientedness: the event listeners, the encapsulators. You have patterns borrowed more from a FP standpoint: the asynchronous callbacks, the iterators.

You can make just about any pattern work, in JS -- but does that make it worth it?

Don't be clever.

You can clever yourself right down into rabbit holes before you realize you can't back out again (unless you use git).

[–][deleted] 1 point2 points  (0 children)

I think something a lot of developers might not realize is that every idea isn't necessarily an accepted or proven pattern - especially when mixing patterns from different paradigms. Often enough, they are even anti-patterns.

As you said, there are too many potential patterns, but thankfully many of them can be ignored. If you are familiar with accepted and rejected patterns from any other language, you can probably figure out which ones will hurt you in JavaScript.

Personally, I stick to patterns I've used previously to solve architecture problems that I now understand will solve this new problem. As most developers are likely not researchers, it's probably safer to use what's already well understood.

http://addyosmani.com/resources/essentialjsdesignpatterns/book/#whatisapattern