Skip to content

Latest commit

 

History

History
executable file
·
72 lines (53 loc) · 1.19 KB

naming.md

File metadata and controls

executable file
·
72 lines (53 loc) · 1.19 KB

1. Don't abbreviate names

function relScore(m1, m2) {}

function movieRelationScore(movie1, movie2) {}

2. Use Endiannes / Smurfing / Molds

# big-endian = Most significant word FIRST
profitMonthlyMax

# little-endian = Most significant word LAST
maxMonthlyProfit

3. Don't use single letters

let x = 1;

let someValue = 1;

4. Don't put types in the name (Hungarian notation)

bool bIsValid;
int32_t iSpeed;
uint32_t uNumUsers;
char szUserName;

5. Add units to variables.

function execute(delay) {}

function execute(delaySeconds) {}

6. Refactor if you find yourself using utils.

// utils.js
function assignDefaults() {}
function relationScore() {}
function moviesOnPage() {}
function topMoviesByRating() {}
function moviesByDirector() {}
function parseCookie() {}
function assignCookie() {}
// movies.js
function assignDefaults() {}
function relationScore() {}

// pager.js
function moviesOnPage() {}

// movieCollection.js
function topMoviesByRating() {}
function moviesByDirector() {}

// cookie.js
function parseCookie() {}
function assignCookie() {}