We also need to educate everyone on how to write "adapters" for services in Jaggery. We've got it a bit wrong in the API Store code by using Java stubs via host objects.
The right approach should be to create a Jaggery module for the service starting with a generated stub. If necessary hand wrap it into a nicer experience and then push it out as a module so anyone can use it via "require". I think some *good* samples will help. Sanjiva. On Wed, May 23, 2012 at 1:05 PM, Nuwan Bandara <[email protected]> wrote: > Hi All, > > Writing javascript code should not be considered lightly. It is as serious > as your server code. If you write crappy code and create bugs, > comparatively they are harder to find and solve; *During code reviews > please make sure following guidelines are also met for any javascript code > written by developers. * > > As a general standard for Javascript programming, developers need to > adhere to the javascript guide *[1]* originally published by Google. > > As for tools, > > - For code sanity check - JSLint [2] or Closure Linter [3] > - Javascript documentation - JSDoc-toolkit [4] > - Unit testing - QUnit [5], JSUnit [6] > - Javascript minification - JSMin [7], YUICompressor [8], Closure > Compiler [9] > > *What you MUST do* > > - All javascript that are written need to be checked against JSList. > This is something similar to find-bugs for java. > - All scripts that are being used across the platform need to be > minified, from any of the tools mentioned above. > - Create Unit tests for code javascript code you wright, use one of > the tools above. (QUnit proves to be easier) > - Try to do documentation as much as possible and use JSDoc to > generate documentation > > I have documented there guide lines at > https://sites.google.com/a/wso2.com/engineering/standards-conventions/javascript-standards-tools. > (for internal reference) If I have missed anything please do update the > document. > > With increase use of javascript as server-side language, I believe we need > conventions and guidelines in-place. We will be creating/modifying tools > such as JSLint, JSMin, JSDoc and QUnit to be compatible with Jaggery as > well. > > [1] http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml > [2] https://code.google.com/p/jslint4java/ > [3] https://developers.google.com/closure/utilities/ > [4] http://code.google.com/p/jsdoc-toolkit/ > [5] http://docs.jquery.com/QUnit > [6] http://www.jsunit.net/ > [7] http://code.google.com/p/jsmin-ant-task/ > [8] http://developer.yahoo.com/yui/compressor/ > [9] https://developers.google.com/closure/compiler/ > > > -- > *Thanks & Regards, > > Nuwan Bandara > Associate Technical Lead & Member, MC, Development Technologies > WSO2 Inc. - lean . enterprise . middleware | http://wso2.com > blog : http://nuwanbando.com; email: [email protected]; phone: +94 11 763 > 9629 > * > <http://www.nuwanbando.com/> > -- Sanjiva Weerawarana, Ph.D. Founder, Chairman & CEO; WSO2, Inc.; http://wso2.com/ email: [email protected]; phone: +94 11 763 9614; cell: +94 77 787 6880 | +1 650 265 8311 blog: http://sanjiva.weerawarana.org/ Lean . Enterprise . Middleware
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
