资源描述:
《Clean Code Cheat Sheet V2.pdf》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、WhyCleanCodeSmellsGeneralFieldsNotDefiningStateCodeiscleanifitcanbeunderstoodeasily–byeveryoneontheteam.WithRigidityFollowStandardConventionsFieldsholdingdatathatdoesnotbelongtothestateoftheinstancebutareunderstandabilitycomesreadability,changeability,extensibilityandThesoftwareisdiffi
2、culttochange.AsmallchangecausesacascadeofCoding-,architecture-,designguidelines(checkthemwithtools)usedtoholdtemporarydata.Uselocalvariablesorextracttoaclassmaintainability.Allthethingsneededtokeepaprojectgoingoveralongsubsequentchanges.abstractingtheperformedaction.timewithoutaccumula
3、tingupalargeamountoftechnicaldebt.KeepitSimple,Stupid(KISS)FragilitySimplerisalwaysbetter.Reducecomplexityasmuchaspossible.OverConfigurabilityThesoftwarebreaksinmanyplacesduetoasinglechange.Preventconfigurationjustforthesakeofit–orbecausenobodycandecideoptimalResponsivenessBoyScoutRule
4、howitshouldbe.Otherwise,thiswillresultinoverlycomplex,unstableImmobilityLeavethecampgroundcleanerthanyoufoundit.systems.highYoucannotreusepartsofthecodeinotherprojectsbecauseofinvolvedhighRootCauseAnalysisMicroLayersResponsivenesstochangerisksandhigheffort.actualAlwayslookfortherootcau
5、seofaproblem.Otherwise,itwillgetyouagainDonotaddfunctionalityontop,butsimplifyoverall.)ViscosityofDesignandagain.CoCTakingashortcutandintroducingtechnicaldebtrequireslesseffortthanDependenciesMultipleLanguagesinOneSourceFiledoingitright.MakeLogicalDependenciesPhysicalC#,Java,JavaScript
6、,XML,HTML,XAML,English,German…ViscosityofEnvironmentIfonemoduledependsuponanother,thatdependencyshouldbephysical,Building,testingandothertaskstakealongtime.Therefore,theseactivitiesEnvironmentnotjustlogical.Don’tmakeassumptions.Responsivenessarenotexecutedproperlybyeveryoneandtechnical
7、debtisintroduced.ProjectBuildRequiresOnlyOneStepSingletons/ServiceLocatorCostofChange(CoCTechnicalDebtNeedlessComplexityCheckoutandthenbuildwithasinglecommand.Usedependencyinjection.Singletonshidedependencies.Thedesigncontainselementsthatarecurrentlynotuseful.TheaddedExecutingTestsRe