Skip to content

Commit 9ab216f

Browse files
author
Daniel Lacy
committed
Updates README with discussion from the latest round of architecture talks.
* Updates Array push information to promote using #push only. * Updates Commenting section to promote usage in Utilities alone. * Updates Naming Conventions for clarity and View/ Model/ Collections.
1 parent 077050d commit 9ab216f

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

README.md

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,12 @@
9898
}
9999
```
100100
101-
- For [performance reasons](http://jsperf.com/array-direct-assignment-vs-push/5) use direct assignment over Array#push
102-
- If you don't know array length use Array#push.
101+
- Always use array#push when appending new values to an array.
103102
104103
```javascript
105104
var someStack = [];
106105
107-
// good
106+
// bad
108107
someStack[someStack.length] = 'abracadabra';
109108
110109
// good
@@ -513,6 +512,8 @@
513512
514513
## <a name='comments'>Comments</a>
515514
515+
- Documentation is highly recommended on Utility Modules. It is optional on all other types of Modules.
516+
- Don't over document. Opt for descriptive names of variables, functions, and returns over documenting the obvious.
516517
- Use [JSDoc](http://usejsdoc.org) notation for commenting guidelines.
517518
- Use `/** ... */` for multiline comments.
518519
@@ -792,7 +793,7 @@
792793
793794
## <a name='naming-conventions'>Naming Conventions</a>
794795
795-
- Avoid single letter names. Be descriptive with your naming. These get uglified anyways.
796+
- Avoid single letter names. Be descriptive with your naming. These get Uglified anyways.
796797
797798
```javascript
798799
// bad
@@ -806,27 +807,7 @@
806807
}
807808
```
808809
809-
- Use lower camelCase when naming objects, functions, and instances
810-
811-
```javascript
812-
// bad
813-
var OBJEcttsssss = {};
814-
var this_is_my_object = {};
815-
var this-is-my-object = {};
816-
function c() {};
817-
var u = new user({
818-
name: 'Bob Parr'
819-
});
820-
821-
// good
822-
var thisIsMyObject = {};
823-
function thisIsMyFunction() {};
824-
var user = new User({
825-
name: 'Bob Parr'
826-
});
827-
```
828-
829-
- Use PascalCase when naming constructors or classes
810+
- Use PascalCase when naming Views, Constructors, Classes, Models, and Collections.
830811
831812
```javascript
832813
// bad
@@ -848,6 +829,26 @@
848829
});
849830
```
850831
832+
- Use lower camelCase for everything else (e.g.- objects, functions, and instances).
833+
834+
```javascript
835+
// bad
836+
var OBJEcttsssss = {};
837+
var this_is_my_object = {};
838+
var this-is-my-object = {};
839+
function c() {};
840+
var u = new user({
841+
name: 'Bob Parr'
842+
});
843+
844+
// good
845+
var thisIsMyObject = {};
846+
function thisIsMyFunction() {};
847+
var user = new User({
848+
name: 'Bob Parr'
849+
});
850+
```
851+
851852
- When saving a reference to `this` use `self`.
852853
853854
```javascript

0 commit comments

Comments
 (0)