comic-reader
comic-reader copied to clipboard
javascripts naming rules/refactoring threads
Naming Rules
Follow this one: naming convention
Functions
camelCase
// bad example
function MyFunction() {...}
// good example
function myFunction() {...}
Variables
- Variables with multiple words should always use an underscore between words.
- Confusing variable names should end with the variable type.
- No Abbreviations
// bad example
var deliveryNote = 1;
// good example
var delivery_note = 1;
To use camelCase, when sometimes it is impossible to declare a function directly, the function variable name should match some patterns which shows that it is a function.
// good example
var doSomethingFunction = function () { ... };
// or
var tool = {"doSomething": function () { ... }};
// bad example
var doSomething = function () { ... };
Database related
All of the variables store information grabbed from the database (Settings) should end with _data
Example:
-
all_comic_data
: store all of the comic data from the database -
comic_data
: store one comic data from the database
MVVM
ViewModel
filename should be *-viewmodel.js
and put under ./renderer-process/viewmodels/
ViewController
filename shouldbe *-viewcontroller.js
and put under ./renderer-process/viewcontrollers
create guidelines wiki page link