Code Style Conventions can be found here: Code Style Conventions for JavaScript |
Always copy the license header for ASL 2.0 at the start of each source code page
/** * Copyright 2012, Raxa * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ |
Always:
Enable CORS headers whenever you are doing Ext.Ajax requests:
Ext.Ajax.request({ url: HOST + yourRequestURL, withCredentials: true, useDefaultXhrHeader: false }); |
...
Recommended:
It is recommended that you use Object literal-style JavaScript class declaration as follows, with a capitalized first-character classname:
var Foo = { type: "fruit", color: "red", getName: function () { return this.color + ' ' + this.type + ' Foo'; } } |
It is recommend that you create an enum for the different pages you can navigate to using "setActiveItem", rather than writing setActiveItem(1). This helps with readability and updateability of the code.
// Creating enums in JS: http://stackoverflow.com/questions/287903/enums-in-javascript var <Current Namespace>.PAGES = { LOGIN_SCREEN : 0, CONNECTION_SETTINGS : 1, OPTIONS_PANEL : 2 } |
See how Joy M (Unlicensed) handled this in CHW: https://github.com/jming/Raxa-JSS/blob/f88baa795b560a0972d9e1fc98dcebe5432dc600/src/chw/app/controller/basic.js#L21-28. Note that this code should include the current namespace so as to not conflict with the global namespace.
See how Piyush Madan (Unlicensed) handled this for Lab: https://github.com/Raxa/Raxa-JSS/blob/master/src/resources/scripts/page_enum.js.
Seldom:
Never:
Always:
When adding a ChangeSet to the liquibase.xml file, give your id in the following form:
<changeSet id="2012-02-29_create_new_feature" author="billclinton"> |
In the liquibase.xml give a unique constraint name. Keep foreign key constraints separate from createTable changesets. Give constraint names in the following format
FK_<baseTable>_<columnName>_<referenceTable>_<columnName> |
Recommended:
It is recommended to use _ (underscore) between table names for separate words and camelCase in corresponding Java classes. i.e. if the table is called patient_list, the corresponding class should be called PatientList. Similarly, DAOs should be PatientListDao and implementations of services say PatientListService should be PatientListServiceImpl
Seldom:
Never:
===============================
Please write suggested coding guidelines below, and we can discuss to determine (1) if we would like to follow the standard and (2) the appropriate level level of enforcement
Suggested coding guidelines: