I’ve been writing Javascript code and using extensively the jQuery library. My code is not very big although for me is a mesh right now. I would to know if there is a jQuery best practices related to the way you write the code and how to structure it, not only related to performance.
I am asking this because from my point of view using jQuery configures a different way of writing code and I think that people who are used to writing a lot of jQuery + Javascript code have methods to organise the code.
I also would like to know if there is a “common & good” way of documenting jQuery code just like Javadoc.
Thanks in advance.
The question is extremely difficult to answer because it is so broad. If you want a guide to style your code look here.
http://javascript.crockford.com/code.html
As for how to structure it, it really depends on the framework that you are using. Each one has a different style. jQuery plugins and modules have a specific structure. http://docs.jquery.com/Plugins/Authoring . Backbone or Ember JS are structured differently.
As for documentation. JSDoc works great. Here is a link to the doc creation tool. https://github.com/jsdoc3/jsdoc . You can find other documentation online.