My JavaScript patterns/practices stink. Where should I seek help?

后端 未结 7 1186
庸人自扰
庸人自扰 2021-01-29 18:17

I\'ve been working almost exclusively on back-end tasks for the past few years, and I\'ve just noticed that most JavaScript (and CoffeeScript) projects have got a helluva lot pr

相关标签:
7条回答
  • 2021-01-29 18:36

    JavaScript resources

    Patterns For Large-Scale JavaScript Application Architecture

    Essential JavaScript Design Patterns For Beginners, Volume 1.

    JavaScript Patterns

    jQuery specific

    Tools For jQuery Application Architecture

    CoffeeScript

    http://coffeescriptcookbook.com/chapters/design_patterns/

    0 讨论(0)
  • 2021-01-29 18:36

    I don't think that reading on common patterns will help you write really good code. Moderately good code, but not really good code. I'd login to irc.freenode.net and ask in ##javascript and #coffeescript for help - at least in #coffeescript, there are many people who will help you improve code you put in a gist.

    0 讨论(0)
  • 2021-01-29 18:39

    You need a good book like "JavaScript Patterns" accompanied by an equally good ide/environment like "Fiddle" for practicing.

    0 讨论(0)
  • 2021-01-29 18:51

    I don't see the problem with your older code. Or with the newer code. Basically, just follow the same principles you'd follow with Ruby: refactor mercilessly and let good architecture emerge from the refactoring.

    0 讨论(0)
  • 2021-01-29 18:52

    If you need to play with a complete implementation of a large scale javascript reference architecture, have a look at:

    http://boilerplatejs.org

    It is a collection of patterns and integration of some good libraries with readymade sample application to start with. I wrote it to share my experience after working on couple of large JS projects.

    0 讨论(0)
  • 2021-01-29 18:59

    Here are some links I've collected:

    General

    http://eloquentjavascript.net/

    http://jqfundamentals.com/

    Patterns

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

    Inheritance

    http://blog.vjeux.com/2011/javascript/how-prototypal-inheritance-really-works.html

    Module pattern

    http://www.adequatelygood.com/2010/3/JavaScript-Module-Pattern-In-Depth http://ajaxian.com/archives/a-javascript-module-pattern http://edspencer.net/2009/10/javascript-module-pattern-overused-dangerous-and-bloody-annoying.html

    New keyword

    Is JavaScript's "new" keyword considered harmful? http://ejohn.org/blog/simple-class-instantiation

    Closures

    http://www.bennadel.com/blog/1482-A-Graphical-Explanation-Of-Javascript-Closures-In-A-jQuery-Context.htm

    How do JavaScript closures work? http://skilldrick.co.uk/2011/04/closures-explained-with-javascript/

    Pass by reference / value

    http://snook.ca/archives/javascript/javascript_pass

    Teaching JavaScript

    http://concisionandconcinnity.blogspot.com/2010/03/notes-on-teaching-javascript.html

    This keyword

    http://alebelcor.blogspot.com/2011/07/this-keyword-in-javascript.html http://yehudakatz.com/2011/08/11/understanding-javascript-function-invocation-and-this/

    Object Literal

    http://blog.rebeccamurphey.com/2009/10/15/using-objects-to-organize-your-code

    Prototype

    http://yehudakatz.com/2011/08/12/understanding-prototypes-in-javascript/

    0 讨论(0)
提交回复
热议问题