Clean Code
A Handbook of Agile Software Craftmanship
*people who lie they have no time for reading
Robert C. Martin wants YOU to write CLEAN code
const d; // elapsed time in days
const elapsedTimeInDays;
const daysSinceCreation;
const accountList;
const accounts;
only when it's actually List structure.
const XYZControllerForEfficientHandlingOfString;
const XYZControllerForEfficientStorageOfString;
int a = 1;
if ( O === l)
a = 01;
else
l = 01;
class DtaRcrd102 {
statis genymdhms;
statis modymdhms;
}
for (const j = 0; i < 42; j++) {
sum += (t[j] * 4) / 5;
}
IShapeFactory -> ShapeFactory
ShapeFactoryImp / CShapeFactory
Smart people sometimes like to show off their smarts by demonstrating their mental juggling abilities.
const r*;
*the lower-case version of URL with host and scheme removed
Prefer noun and noun phrases like
Customer, WikiPage, Account, AddressParser
Avoid words like
Calculate, Visit, Parse
Prefer verb and verb phrases like
postPayment, deletePage, set*, get*, is*
eatMyShorts() === abort()
Follow the "one word per concept" rule.
const GSDAccountAddress;
*chapter 2.2 should probably be next time
FUNCTIONS SHOULD DO ONE THING.
THEY SHOULD DO IT WELL.
THEY SHOULD DO IT ONLY.