The document provides best practices for writing quality code, including following style guides, using consistent naming conventions, writing single-purpose functions and modules, avoiding magic numbers, using abstraction, and following principles like the Twelve-Factor App methodology. It emphasizes writing clean, readable code through practices like descriptive naming, separating concerns, and removing duplication.
13. FUNCTION NAMES
• Function names should be verb
• DoThing, MakeAbc, GetAbc, SetHello
• Property names should be noun and adj
14. GET-SET
• GET does not get input
• SET gets single input
get hello() {
return this._h;
}
set hello(value) {
this._h = value
}
var center: Int {
get {
return 0
}
set(newValue) {
}
}
15. const games = await api.games();
// TODO(burak): fix name
this.getGamesData(games);
const categories = await api.categories();
// TODO(burak): fix name
this.getCategoriesData(categories,this.state
.games);
16. NAME AND CONTEXT
• Name and context of func/property/class
have to be consistent and meaningful