The Qualities of Clean CodeReadabilityExtensibilitySimplicityNaming ThingsVariablesNaming conventionsThe dataLengthAvoid unnecessary informationAvoid conjunctionsOnly alpha charactersMethodsUse verbsReturn valueBang methodsClassesPurposeRoleModulesCreating Quality MethodsParametersUse fewer parametersParameter orderReturn ValuesGuard ClauseLengthHow to shorten a methodToo shortCommentsQuality commentsStale commentsComments and refactoringLimit NestingUsing Boolean LogicUsing a VariableUsing a MethodUnlessTernary operatorDouble negativeTruthy and FalsyTruthy ValuesFalsy Values& vs &&ClassesInitialize MethodKeep it SimpleAvoiding ErrorsToo many parametersClass methods vs instance methodsInstance variablesPrivate methodsMethod orderMoving methods to a moduleLimiting InheritanceRefactoringNo change too smallTestsSingle Responsibility PrincipleTest-Driven Development (TDD)Start with testsImplement our codeMore TestsClean TestsWrapping up
Veja mais