[TIMOB-8680] Core: Define Javascript coding standards
GitHub Issue | n/a |
---|---|
Type | Story |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-05-17T00:43:17.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 2.1.0, Sprint 2012-10 Core |
Components | n/a |
Labels | core, look1, tbs-2.1.0 |
Reporter | Opie Cyrus |
Assignee | Opie Cyrus |
Created | 2012-04-11T12:17:58.000+0000 |
Updated | 2017-03-20T17:01:25.000+0000 |
Description
Define a document that outlines all Javascript coding standards any javascript written for Appcelerator (internal or community contributions) should adhere to. This should represent more than syntax, but general design approaches and process flow. This document will be focused on language only. Platform Specific information will be contained inside another document.
This is a collaboration ticket.
For straight JavaScript language style, I for one really like the Google style guide, and would recommend that as a jumping off point, and then document deviations: http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml Are CommonJS modules and associated structures in scope for this conversation as well? We have a bit of a disconnect there with what is supported in core mobile web, since in the browser we use AMD, and for end developers we support what is essentially node.js' implementation (and deviations from) the spec.
I'll look at Google's style guide, but already I've seen a couple things that I don't agree with. CommonJS modules as well as inline docs are included in this conversation. We'll need to explicitly document style guides for CommonJS (standard and node.js flavors) and AMD formatted modules. Give me a couple days to come up with something to start from.
I've got a pretty decent style guide written here: https://wiki.appcelerator.org/display/pe/JavaScript+Style+Guide It might be a good idea to write some code snippets, but I don't think it's required.
I like this a lot. Also think having code snippets is handy. I'm a visual kind of person. We're going to have to make sure our CommonJS implementation is better in order for this one to be true: "Object methods SHOULD be defined on the object's prototype, not via "this" in the constructor" . Sometimes it causes parsing errors in iOS :-D
Further updates coming from Chris. Once updated, RFC email will be sent to platform and customer engineering.
Pending further updates from Chris.
Spec is locked down now. Closing.