Post on 08-Jul-2016
description
0
1
1.1
1.1.1
1.1.2
1.1.3
1.1.4
1.1.5
1.1.6
1.1.7
1.1.8
1.1.9
1.1.10
1.1.11
1.1.12
1.2
1.2.1
1.2.2
1.2.3
1.2.4
1.2.5
1.2.6
1.2.7
1.2.8
1.2.9
1.2.10
1.2.11
2
2.1
2.1.1
TableofContentsIntroduction
Beginner
PersonalSkills
LearntoDebug
HowtoDebugbySplittingtheProblemSpace
HowtoRemoveanError
HowtoDebugUsingaLog
HowtoUnderstandPerformanceProblems
HowtoFixPerformanceProblems
HowtoOptimizeLoops
HowtoDealwithI/OExpense
HowtoManageMemory
HowtoDealwithIntermittentBugs
HowtoLearnDesignSkills
HowtoConductExperiments
TeamSkills
WhyEstimationisImportant
HowtoEstimateProgrammingTime
HowtoFindOutInformation
HowtoUtilizePeopleasInformationSources
HowtoDocumentWisely
HowtoWorkwithPoorCode
HowtoUseSourceCodeControl
HowtoUnitTest
TakeBreakswhenStumped
HowtoRecognizeWhentoGoHome
HowtoDealwithDifficultPeople
Intermediate
PersonalSkills
HowtoStayMotivated
HowtobeaProgrammer
2
2.1.2
2.1.3
2.1.4
2.1.5
2.1.6
2.1.7
2.1.8
2.1.9
2.1.10
2.1.11
2.2
2.2.1
2.2.2
2.2.3
2.2.4
2.2.5
2.3
2.3.1
2.3.2
2.3.3
2.3.4
2.3.5
2.3.6
2.3.7
2.3.8
3
3.1
3.1.1
3.1.2
3.1.3
3.2
3.2.1
3.2.2
3.2.3
HowtobeWidelyTrusted
HowtoTradeoffTimevs.Space
HowtoStressTest
HowtoBalanceBrevityandAbstraction
HowtoLearnNewSkills
LearntoType
HowtoDoIntegrationTesting
CommunicationLanguages
HeavyTools
Howtoanalyzedata
TeamSkills
HowtoManageDevelopmentTime
HowtoManageThird-PartySoftwareRisks
HowtoManageConsultants
HowtoCommunicatetheRightAmount
HowtoDisagreeHonestlyandGetAwaywithIt
Judgment
HowtoTradeoffQualityAgainstDevelopmentTime
HowtoManageSoftwareSystemDependence
HowtoDecideifSoftwareisTooImmature
HowtoMakeaBuyvs.BuildDecision
HowtoGrowProfessionally
HowtoEvaluateInterviewees
HowtoKnowWhentoApplyFancyComputerScience
HowtoTalktoNon-Engineers
Advanced
TechnologicalJudgment
HowtoTelltheHardFromtheImpossible
HowtoUtilizeEmbeddedLanguages
ChoosingLanguages
CompromisingWisely
HowtoFightSchedulePressure
HowtoUnderstandtheUser
HowtoGetaPromotion
HowtobeaProgrammer
3
3.3
3.3.1
3.3.2
3.3.3
3.3.4
3.3.5
3.3.6
3.3.7
3.3.8
3.3.9
3.3.10
3.3.11
4
5
6
ServingYourTeam
HowtoDevelopTalent
HowtoChooseWhattoWorkOn
HowtoGettheMostFromYourTeam-mates
HowtoDivideProblemsUp
HowtoHandleBoringTasks
HowtoGatherSupportforaProject
HowtoGrowaSystem
HowtoCommunicateWell
HowtoTellPeopleThingsTheyDon'tWanttoHear
HowtoDealwithManagerialMyths
HowtoDealwithOrganizationalChaos
AppendixA*Bibliography/Websiteography
AppendixB*History(AsofJanuary2016)
AppendixC*Contributions(AsofJanuary2016)
Glossary
HowtobeaProgrammer
4
HowtobeaProgrammer:CommunityVersionRobertL.ReadwithCommunity
Copyright2002,2003,2016RobertL.Read
LicensedunderCreativeCommonsAttribution-ShareAlike4.0InternationalLicense.
IntroductionTobeagoodprogrammerisdifficultandnoble.Thehardestpartofmakingrealacollectivevisionofasoftwareprojectisdealingwithone'scoworkersandcustomers.Writingcomputerprogramsisimportantandtakesgreatintelligenceandskill.Butitisreallychild'splaycomparedtoeverythingelsethatagoodprogrammermustdotomakeasoftwaresystemthatsucceedsforboththecustomerandmyriadcolleaguesforwhomsheispartiallyresponsible.InthisessayIattempttosummarizeasconciselyaspossiblethosethingsthatIwishsomeonehadexplainedtomewhenIwastwenty-one.
Thisisverysubjectiveand,therefore,thisessayisdoomedtobepersonalandsomewhatopinionated.Iconfinemyselftoproblemsthataprogrammerisverylikelytohavetofaceinherwork.ManyoftheseproblemsandtheirsolutionsaresogeneraltothehumanconditionthatIwillprobablyseempreachy.Ihopeinspiteofthisthatthisessaywillbeuseful.
Computerprogrammingistaughtincourses.Theexcellentbooks:ThePragmaticProgrammer[Prag99],CodeComplete[CodeC93],RapidDevelopment[RDev96],andExtremeProgrammingExplained[XP99]allteachcomputerprogrammingandthelargerissuesofbeingagoodprogrammer.TheessaysofPaulGraham[PGSite]andEricRaymond[Hacker]shouldcertainlybereadbeforeoralongwiththisarticle.ThisessaydiffersfromthoseexcellentworksbyemphasizingsocialproblemsandcomprehensivelysummarizingtheentiresetofnecessaryskillsasIseethem.
Inthisessaythetermbossisusedtorefertowhomevergivesyouprojectstodo.Iusethewordsbusiness,company,andtribe,synonymouslyexceptthatbusinessconnotesmoneymaking,companyconnotesthemodernworkplaceandtribeisgenerallythepeopleyoushareloyaltywith.
Welcometothetribe.
HowtobeaProgrammer
5Introduction
Contents1. Beginner
PersonalSkillsLearntoDebugHowtoDebugbySplittingtheProblemSpaceHowtoRemoveanErrorHowtoDebugUsingaLogHowtoUnderstandPerformanceProblemsHowtoFixPerformanceProblemsHowtoOptimizeLoopsHowtoDealwithI/OExpenseHowtoManageMemoryHowtoDealwithIntermittentBugsHowtoLearnDesignSkillsHowtoConductExperiments
TeamSkillsWhyEstimationisImportantHowtoEstimateProgrammingTimeHowtoFindOutInformationHowtoUtilizePeopleasInformationSourcesHowtoDocumentWiselyHowtoWorkwithPoorCodeHowtoUseSourceCodeControlHowtoUnitTestTakeBreakswhenStumpedHowtoRecognizeWhentoGoHomeHowtoDealwithDifficultPeople
2. IntermediatePersonalSkills
HowtoStayMotivatedHowtobeWidelyTrustedHowtoTradeoffTimevs.SpaceHowtoStressTestHowtoBalanceBrevityandAbstractionHowtoLearnNewSkillsLearntoTypeHowtoDoIntegrationTestingCommunicationLanguagesHeavyTools
HowtobeaProgrammer
6Introduction
HowtoanalyzedataTeamSkills
HowtoManageDevelopmentTimeHowtoManageThird-PartySoftwareRisksHowtoManageConsultantsHowtoCommunicatetheRightAmountHowtoDisagreeHonestlyandGetAwaywithIt
JudgmentHowtoTradeoffQualityAgainstDevelopmentTimeHowtoManageSoftwareSystemDependenceHowtoDecideifSoftwareisTooImmatureHowtoMakeaBuyvs.BuildDecisionHowtoGrowProfessionallyHowtoEvaluateIntervieweesHowtoKnowWhentoApplyFancyComputerScienceHowtoTalktoNon-Engineers
3. AdvancedTechnologicalJudgment
HowtoTelltheHardFromtheImpossibleHowtoUtilizeEmbeddedLanguagesChoosingLanguages
CompromisingWiselyHowtoFightSchedulePressureHowtoUnderstandtheUserHowtoGetaPromotion
ServingYourTeamHowtoDevelopTalentHowtoChooseWhattoWorkOnHowtoGettheMostFromYourTeam-matesHowtoDivideProblemsUpHowtoHandleBoringTasksHowtoGatherSupportforaProjectHowtoGrowaSystemHowtoCommunicateWellHowtoTellPeopleThingsTheyDon'tWanttoHearHowtoDealwithManagerialMythsHowtoDealwithOrganizationalChaos
4. Glossary5. AppendixA-Bibliography/Websiteography6. AppendixB-History(AsofJanuary2016)
HowtobeaProgrammer
7Introduction
7. AppendixC-Contributions(AsofJanuary2016)
HowToBeAProgrammer:CommunityVersionbyRobertL.ReadwithCommunityislicensedunderaCreativeCommonsAttribution-ShareAlike4.0InternationalLicense.
HowtobeaProgrammer
8Introduction
1.BeginnerPersonalSkills
LearntoDebugHowtoDebugbySplittingtheProblemSpaceHowtoRemoveanErrorHowtoDebugUsingaLogHowtoUnderstandPerformanceProblemsHowtoFixPerformanceProblemsHowtoOptimizeLoopsHowtoDealwithI/OExpenseHowtoManageMemoryHowtoDealwithIntermittentBugsHowtoLearnDesignSkillsHowtoConductExperiments
TeamSkillsWhyEstimationisImportantHowtoEstimateProgrammingTimeHowtoFindOutInformationHowtoUtilizePeopleasInformationSourcesHowtoDocumentWiselyHowtoWorkwithPoorCodeHowtoUseSourceCodeControlHowtoUnitTestTakeBreakswhenStumpedHowtoRecognizeWhentoGoHomeHowtoDealwithDifficultPeople
HowtobeaProgrammer
9Beginner
LearntoDebugDebuggingisthecornerstoneofbeingaprogrammer.Thefirstmeaningoftheverb"debug"istoremoveerrors,butthemeaningthatreallymattersistoseeintotheexecutionofaprogrambyexaminingit.Aprogrammerthatcannotdebugeffectivelyisblind.
Idealists,thosewhothinkdesign,analysis,complexitytheory,andthelikearemorefundamentalthandebugging,arenotworkingprogrammers.Theworkingprogrammerdoesnotliveinanidealworld.Evenifyouareperfect,youaresurroundedbyandmustinteractwithcodewrittenbymajorsoftwarecompanies,organizationslikeGNU,andyourcolleagues.Mostofthiscodeisimperfectandimperfectlydocumented.Withouttheabilitytogainvisibilityintotheexecutionofthiscode,theslightestbumpwillthrowyoupermanently.Oftenthisvisibilitycanbegainedonlybyexperimentation:thatis,debugging.
Debuggingisabouttherunningofprograms,notprogramsthemselves.Ifyoubuysomethingfromamajorsoftwarecompany,youusuallydon'tgettoseetheprogram.Buttherewillstillariseplaceswherethecodedoesnotconformtothedocumentation(crashingyourentiremachineisacommonandspectacularexample),orwherethedocumentationismute.Morecommonly,youcreateanerror,examinethecodeyouwrote,andhavenocluehowtheerrorcanbeoccurring.Inevitably,thismeanssomeassumptionyouaremakingisnotquitecorrectorsomeconditionarisesthatyoudidnotanticipate.Sometimes,themagictrickofstaringintothesourcecodeworks.Whenitdoesn't,youmustdebug.
Togetvisibilityintotheexecutionofaprogramyoumustbeabletoexecutethecodeandobservesomethingaboutit.Sometimesthisisvisible,likewhatisbeingdisplayedonascreen,orthedelaybetweentwoevents.Inmanyothercases,itinvolvesthingsthatarenotmeanttobevisible,likethestateofsomevariablesinsidethecode,whichlinesofcodeareactuallybeingexecuted,orwhethercertainassertionsholdacrossacomplicateddatastructure.Thesehiddenthingsmustberevealed.
Thecommonwaysoflookingintothe‘innards’ofanexecutingprogramcanbecategorizedas:
Usingadebuggingtool,Printlining-Makingatemporarymodificationtotheprogram,typicallyaddinglinesthatprintinformationout,andLogging-Creatingapermanentwindowintotheprogramsexecutionintheformofalog.
HowtobeaProgrammer
10Beginner
Debuggingtoolsarewonderfulwhentheyarestableandavailable,buttheprintliningandloggingareevenmoreimportant.Debuggingtoolsoftenlagbehindlanguagedevelopment,soatanypointintimetheymaynotbeavailable.Inaddition,becausethedebuggingtoolmaysubtlychangethewaytheprogramexecutesitmaynotalwaysbepractical.Finally,therearesomekindsofdebugging,suchascheckinganassertionagainstalargedatastructure,thatrequirewritingcodeandchangingtheexecutionoftheprogram.Itisgoodtoknowhowtousedebuggingtoolswhentheyarestable,butitiscriticaltobeabletoemploytheothertwomethods.
Somebeginnersfeardebuggingwhenitrequiresmodifyingcode.Thisisunderstandable-itisalittlelikeexploratorysurgery.Butyouhavetolearntopokeatthecodeandmakeitjump;youhavetolearntoexperimentonitandunderstandthatnothingthatyoutemporarilydotoitwillmakeitworse.Ifyoufeelthisfear,seekoutamentor-welosealotofgoodprogrammersatthedelicateonsetoftheirlearningtothisfear.
NextHowtoDebugbySplittingtheProblemSpace
HowtobeaProgrammer
11Beginner
HowtoDebugbySplittingtheProblemSpaceDebuggingisfun,becauseitbeginswithamystery.Youthinkitshoulddosomething,butinsteaditdoessomethingelse.Itisnotalwaysquitesosimple---anyexamplesIcangivewillbecontrivedcomparedtowhatsometimeshappensinpractice.Debuggingrequirescreativityandingenuity.Ifthereisasinglekeytodebuggingitistousethedivideandconquertechniqueonthemystery.
Suppose,forexample,youcreatedaprogramthatshoulddotenthingsinasequence.Whenyourunit,itcrashes.Sinceyoudidn'tprogramittocrash,younowhaveamystery.Whenyoulookattheoutput,youseethatthefirstseventhingsinthesequencewererunsuccessfully.Thelastthreearenotvisiblefromtheoutput,sonowyourmysteryissmaller:‘Itcrashedonthing#8,#9,or#10.’
Canyoudesignanexperimenttoseewhichthingitcrashedon?Sure.Youcanuseadebuggerorwecanaddprintlinestatements(ortheequivalentinwhateverlanguageyouareworkingin)after#8and#9.Whenwerunitagain,ourmysterywillbesmaller,suchas‘Itcrashedonthing#9.’Ifindthatbearinginmindexactlywhatthemysteryisatanypointintimehelpskeeponefocused.Whenseveralpeopleareworkingtogetherunderpressureonaproblemitiseasytoforgetwhatthemostimportantmysteryis.
Thekeytodivideandconquerasadebuggingtechniqueisthesameasitisforalgorithmdesign:aslongasyoudoagoodjobsplittingthemysteryinthemiddle,youwon'thavetosplitittoomanytimes,andyouwillbedebuggingquickly.Butwhatisthemiddleofamystery?Thereiswheretruecreativityandexperiencecomesin.
Toatruebeginner,thespaceofallpossibleerrorslookslikeeverylineinthesourcecode.Youdon'thavethevisionyouwilllaterdeveloptoseetheotherdimensionsoftheprogram,suchasthespaceofexecutedlines,thedatastructure,thememorymanagement,theinteractionwithforeigncode,thecodethatisrisky,andthecodethatissimple.Fortheexperiencedprogrammer,theseotherdimensionsformanimperfectbutveryusefulmentalmodelofallthethingsthatcangowrong.Havingthatmentalmodeliswhathelpsonefindthemiddleofthemysteryeffectively.
Onceyouhaveevenlysubdividedthespaceofallthatcangowrong,youmusttrytodecideinwhichspacetheerrorlies.Inthesimplecasewherethemysteryis:‘Whichsingleunknownlinemakesmyprogramcrash?’,youcanaskyourself:‘IstheunknownlineexecutedbeforeorafterthislinethatIjudgetobeexecutedinthemiddleoftherunningprogram?’Usuallyyouwillnotbesoluckyastoknowthattheerrorexistsinasingleline,or
HowtobeaProgrammer
12Beginner
evenasingleblock.Oftenthemysterywillbemorelike:‘Eitherthereisapointerinthatgraphthatpointstothewrongnode,ormyalgorithmthataddsupthevariablesinthatgraphdoesn'twork.’Inthatcaseyoumayhavetowriteasmallprogramtocheckthatthepointersinthegraphareallcorrectinordertodecidewhichpartofthesubdividedmysterycanbeeliminated.
NextHowtoRemoveanError
HowtobeaProgrammer
13Beginner
HowtoRemoveanErrorI'veintentionallyseparatedtheactofexaminingaprogram'sexecutionfromtheactoffixinganerror.Butofcourse,debuggingdoesalsomeanremovingthebug.Ideallyyouwillhaveperfectunderstandingofthecodeandwillreachan‘A-Ha!’momentwhereyouperfectlyseetheerrorandhowtofixit.Butsinceyourprogramwilloftenuseinsufficientlydocumentedsystemsintowhichyouhavenovisibility,thisisnotalwayspossible.Inothercasesthecodeissocomplicatedthatyourunderstandingcannotbeperfect.
Infixingabug,youwanttomakethesmallestchangethatfixesthebug.Youmayseeotherthingsthatneedimprovement;butdon'tfixthoseatthesametime.Attempttoemploythescientificmethodofchangingonethingandonlyonethingatatime.Thebestprocessforthisistobeabletoeasilyreproducethebug,thenputyourfixinplace,andthenreruntheprogramandobservethatthebugnolongerexists.Ofcourse,sometimesmorethanonelinemustbechanged,butyoushouldstillconceptuallyapplyasingleatomicchangetofixthebug.
Sometimes,therearereallyseveralbugsthatlooklikeone.Itisuptoyoutodefinethebugsandfixthemoneatatime.Sometimesitisunclearwhattheprogramshoulddoorwhattheoriginalauthorintended.Inthiscase,youmustexerciseyourexperienceandjudgmentandassignyourownmeaningtothecode.Decidewhatitshoulddo,andcommentitorclarifyitinsomewayandthenmakethecodeconformtoyourmeaning.Thisisanintermediateoradvancedskillthatissometimesharderthanwritingtheoriginalfunctioninthefirstplace,buttherealworldisoftenmessy.Youmayhavetofixasystemyoucannotrewrite.
NextHowtoDebugUsingaLog
HowtobeaProgrammer
14Beginner
HowtoDebugUsingaLogLoggingisthepracticeofwritingasystemsothatitproducesasequenceofinformativerecords,calledalog.Printliningisjustproducingasimple,usuallytemporary,log.Absolutebeginnersmustunderstandanduselogsbecausetheirknowledgeoftheprogrammingislimited;systemarchitectsmustunderstandanduselogsbecauseofthecomplexityofthesystem.Theamountofinformationthatisprovidedbythelogshouldbeconfigurable,ideallywhiletheprogramisrunning.Ingeneral,logsofferthreebasicadvantages:
Logscanprovideusefulinformationaboutbugsthatarehardtoreproduce(suchasthosethatoccurintheproductionenvironmentbutthatcannotbereproducedinthetestenvironment).Logscanprovidestatisticsanddatarelevanttoperformance,suchasthetimepassingbetweenstatements.Whenconfigurable,logsallowgeneralinformationtobecapturedinordertodebugunanticipatedspecificproblemswithouthavingtomodifyand/orredeploythecodejusttodealwiththosespecificproblems.
Theamounttooutputintothelogisalwaysacompromisebetweeninformationandbrevity.Toomuchinformationmakesthelogexpensiveandproducesscrollblindness,makingithardtofindtheinformationyouneed.Toolittleinformationanditmaynotcontainwhatyouneed.Forthisreason,makingwhatisoutputconfigurableisveryuseful.Typically,eachrecordinthelogwillidentifyitspositioninthesourcecode,thethreadthatexecuteditifapplicable,theprecisetimeofexecution,and,commonly,anadditionalusefulpieceofinformation,suchasthevalueofsomevariable,theamountoffreememory,thenumberofdataobjects,etc.Theselogstatementsaresprinkledthroughoutthesourcecodebutareparticularlyatmajorfunctionalitypointsandaroundriskycode.Eachstatementcanbeassignedalevelandwillonlyoutputarecordifthesystemiscurrentlyconfiguredtooutputthatlevel.Youshoulddesignthelogstatementstoaddressproblemsthatyouanticipate.Anticipatetheneedtomeasureperformance.
Ifyouhaveapermanentlog,printliningcannowbedoneintermsofthelogrecords,andsomeofthedebuggingstatementswillprobablybepermanentlyaddedtotheloggingsystem.
NextHowtoUnderstandPerformanceProblems
HowtobeaProgrammer
15Beginner
HowtoUnderstandPerformanceProblemsLearningtounderstandtheperformanceofarunningsystemisunavoidableforthesamereasonthatlearningdebuggingis.Evenifyouunderstandperfectlypreciselythecostofthecodeyouwrite,yourcodewillmakecallsintoothersoftwaresystemsthatyouhavelittlecontroloverorvisibilityinto.However,inpracticeperformanceproblemsarealittledifferentandalittleeasierthandebuggingingeneral.
Supposethatyouoryourcustomersconsiderasystemorasubsystemtobetooslow.Beforeyoutrytomakeitfaster,youmustbuildamentalmodelofwhyitisslow.Todothisyoucanuseaprofilingtooloragoodlogtofigureoutwherethetimeorotherresourcesarereallybeingspent.Thereisafamousdictumthat90%ofthetimewillbespentin10%ofthecode.Iwouldaddtothattheimportanceofinput/outputexpense(I/O)toperformanceissues.OftenmostofthetimeisspentinI/Oinonewayoranother.FindingtheexpensiveI/Oandtheexpensive10%ofthecodeisagoodfirststeptobuildingyourmentalmodel.
Therearemanydimensionstotheperformanceofacomputersystem,andmanyresourcesconsumed.Thefirstresourcetomeasureiswall-clocktime,thetotaltimethatpassesforthecomputation.Loggingwall-clocktimeisparticularlyvaluablebecauseitcaninformaboutunpredictablecircumstancesthatariseinsituationswhereotherprofilingisimpractical.However,thismaynotalwaysrepresentthewholepicture.Sometimessomethingthattakesalittlelongerbutdoesn'tburnupsomanyprocessorsecondswillbemuchbetterinthecomputingenvironmentyouactuallyhavetodealwith.Similarly,memory,networkbandwidth,databaseorotherserveraccessesmay,intheend,befarmoreexpensivethanprocessorseconds.
Contentionforsharedresourcesthataresynchronizedcancausedeadlockandstarvation.Deadlockistheinabilitytoproceedbecauseofimpropersynchronizationorresourcedemands.Starvationisthefailuretoscheduleacomponentproperly.Ifitcanbeatallanticipated,itisbesttohaveawayofmeasuringthiscontentionfromthestartofyourproject.Evenifthiscontentiondoesnotoccur,itisveryhelpfultobeabletoassertthatwithconfidence.
NextHowtoFixPerformanceProblems
HowtobeaProgrammer
16Beginner
HowtoFixPerformanceProblemsMostsoftwareprojectscanbemadewithrelativelylittleeffort10to100timesfasterthantheyareatthetimetheyarefirstreleased.Undertime-to-marketpressure,itisbothwiseandeffectivetochooseasolutionthatgetsthejobdonesimplyandquickly,butlessefficientlythansomeothersolution.However,performanceisapartofusability,andoftenitmusteventuallybeconsideredmorecarefully.
Thekeytoimprovingtheperformanceofaverycomplicatedsystemistoanalyseitwellenoughtofindthebottlenecks,orplaceswheremostoftheresourcesareconsumed.Thereisnotmuchsenseinoptimizingafunctionthataccountsforonly1%ofthecomputationtime.Asaruleofthumbyoushouldthinkcarefullybeforedoinganythingunlessyouthinkitisgoingtomakethesystemorasignificantpartofitatleasttwiceasfast.Thereisusuallyawaytodothis.Considerthetestandqualityassuranceeffortthatyourchangewillrequire.Eachchangebringsatestburdenwithit,soitismuchbettertohaveafewbigchanges.
Afteryou'vemadeatwo-foldimprovementinsomething,youneedtoatleastrethinkandperhapsreanalyzetodiscoverthenext-most-expensivebottleneckinthesystem,andattackthattogetanothertwo-foldimprovement.
Often,thebottlenecksinperformancewillbeanexampleofcountingcowsbycountinglegsanddividingbyfour,insteadofcountingheads.Forexample,I'vemadeerrorssuchasfailingtoprovidearelationaldatabasesystemwithaproperindexonacolumnIlookupalot,whichprobablymadeitatleast20timesslower.OtherexamplesincludedoingunnecessaryI/Oininnerloops,leavingindebuggingstatementsthatarenolongerneeded,unnecessarymemoryallocation,and,inparticular,inexpertuseoflibrariesandothersubsystemsthatareoftenpoorlydocumentedwithrespecttoperformance.Thiskindofimprovementissometimescalledlow-hangingfruit,meaningthatitcanbeeasilypickedtoprovidesomebenefit.
Whatdoyoudowhenyoustarttorunoutoflow-hangingfruit?Well,youcanreachhigher,orchopthetreedown.Youcancontinuemakingsmallimprovementsoryoucanseriouslyredesignasystemorasubsystem.(Thisisagreatopportunitytouseyourskillsasagoodprogrammer,notonlyinthenewdesignbutalsoinconvincingyourbossthatthisisagoodidea.)However,beforeyouarguefortheredesignofasubsystem,youshouldaskyourselfwhetherornotyourproposalwillmakeitfivetotentimebetter.
NextHowtoOptimizeLoops
HowtobeaProgrammer
17Beginner
HowtoOptimizeLoopsSometimesyou'llencounterloops,orrecursivefunctions,thattakealongtimetoexecuteandarebottlenecksinyourproduct.Beforeyoutrytomaketheloopalittlefaster,spendafewminutesconsideringifthereisawaytoremoveitentirely.Wouldadifferentalgorithmdo?Couldyoucomputethatwhilecomputingsomethingelse?Ifyoucan'tfindawayaroundit,thenyoucanoptimizetheloop.Thisissimple;movestuffout.Intheend,thiswillrequirenotonlyingenuitybutalsoanunderstandingoftheexpenseofeachkindofstatementandexpression.Herearesomesuggestions:
Removefloatingpointoperations.Don'tallocatenewmemoryblocksunnecessarily.Foldconstantstogether.MoveI/Ointoabuffer.Trynottodivide.Trynottodoexpensivetypecasts.Moveapointerratherthanrecomputingindices.
Thecostofeachoftheseoperationsdependsonyourspecificsystem.Onsomesystemscompilersandhardwaredothesethingsforyou.Clear,efficientcodeisbetterthancodethatrequiresanunderstandingofaparticularplatform.
NextHowtoDealwithI/OExpense
HowtobeaProgrammer
18Beginner
HowtoDealwithI/OExpenseForalotofproblems,processorsarefastcomparedtothecostofcommunicatingwithahardwaredevice.ThiscostisusuallyabbreviatedI/O,andcanincludenetworkcost,diskI/O,databasequeries,fileI/O,andotheruseofsomehardwarenotveryclosetotheprocessor.ThereforebuildingafastsystemisoftenmoreaquestionofimprovingI/Othanimprovingthecodeinsometightloop,orevenimprovinganalgorithm.
TherearetwoveryfundamentaltechniquestoimprovingI/O:cachingandrepresentation.CachingisavoidingI/O(generallyavoidingthereadingofsomeabstractvalue)bystoringacopyofthatvaluelocallysonoI/Oisperformedtogetthevalue.Thefirstkeytocachingistomakeitcrystalclearwhichdataisthemasterandwhicharecopies.Thereisonlyonemaster-period.Cachingbringswithitthedangerthatthecopysometimescan'treflectchangestothemasterinstantaneously.
RepresentationistheapproachofmakingI/Ocheaperbyrepresentingdatamoreefficiently.Thisisoftenintensionwithotherdemands,likehumanreadabilityandportability.
Representationscanoftenbeimprovedbyafactoroftwoorthreefromtheirfirstimplementation.Techniquesfordoingthisincludeusingabinaryrepresentationinsteadofonethatishumanreadable,transmittingadictionaryofsymbolsalongwiththedatasothatlongsymbolsdon'thavetobeencoded,and,attheextreme,thingslikeHuffmanencoding.
Athirdtechniquethatissometimespossibleistoimprovethelocalityofreferencebypushingthecomputationclosertothedata.Forinstance,ifyouarereadingsomedatafromadatabaseandcomputingsomethingsimplefromit,suchasasummation,trytogetthedatabaseservertodoitforyou.Thisishighlydependentonthekindofsystemyou'reworkingwith,butyoushouldexploreit.
NextHowtoManageMemory
HowtobeaProgrammer
19Beginner
HowtoManageMemoryMemoryisapreciousresourcethatyoucan'taffordtorunoutof.Youcanignoreitforawhilebuteventuallyyouwillhavetodecidehowtomanagememory.
Spacethatneedstopersistbeyondthescopeofasinglesubroutineisoftencalledheapallocated.Achunkofmemoryisuseless,hencegarbage,whennothingreferstoit.Dependingonthesystemyouuse,youmayhavetoexplicitlydeallocatememoryyourselfwhenitisabouttobecomegarbage.Moreoftenyoumaybeabletouseasystemthatprovidesagarbagecollector.Agarbagecollectornoticesgarbageandfreesitsspacewithoutanyactionrequiredbytheprogrammer.Garbagecollectioniswonderful:itlessenserrorsandincreasescodebrevityandconcisioncheaply.Useitwhenyoucan.
Butevenwithgarbagecollection,youcanfillupallmemorywithgarbage.Aclassicmistakeistouseahashtableasacacheandforgettoremovethereferencesinthehashtable.Sincethereferenceremains,thereferentisnon-collectablebutuseless.Thisiscalledamemoryleak.Youshouldlookforandfixmemoryleaksearly.Ifyouhavelongrunningsystemsmemorymayneverbeexhaustedintestingbutwillbeexhaustedbytheuser.
Thecreationofnewobjectsismoderatelyexpensiveonanysystem.Memoryallocateddirectlyinthelocalvariablesofasubroutine,however,isusuallycheapbecausethepolicyforfreeingitcanbeverysimple.Youshouldavoidunnecessaryobjectcreation.
Animportantcaseoccurswhenyoucandefineanupperboundonthenumberofobjectsyouwillneedatonetime.Iftheseobjectsalltakeupthesameamountofmemory,youmaybeabletoallocateasingleblockofmemory,orabuffer,toholdthemall.Theobjectsyouneedcanbeallocatedandreleasedinsidethisbufferinasetrotationpattern,soitissometimescalledaringbuffer.Thisisusuallyfasterthanheapallocation.
Sometimesyouhavetoexplicitlyfreeallocatedspacesoitcanbereallocatedratherthanrelyongarbagecollection.Thenyoumustapplycarefulintelligencetoeachchunkofallocatedmemoryanddesignawayforittobedeallocatedattheappropriatetime.Themethodmaydifferforeachkindofobjectyoucreate.Youmustmakesurethateveryexecutionofamemoryallocatingoperationismatchedbyamemorydeallocatingoperationeventually.Thisissodifficultthatprogrammersoftensimplyimplementarudimentaryformorgarbagecollection,suchasreferencecounting,todothisforthem.
NextHowtoDealwithIntermittentBugs
HowtobeaProgrammer
20Beginner
HowtoDealwithIntermittentBugsTheintermittentbugisacousinofthe50-foot-invisible-scorpion-from-outer-spacekindofbug.Thisnightmareoccurssorarelythatitishardtoobserve,yetoftenenoughthatitcan'tbeignored.Youcan'tdebugbecauseyoucan'tfindit.
Althoughafter8hoursyouwillstarttodoubtit,theintermittentbughastoobeythesamelawsoflogiceverythingelsedoes.Whatmakesithardisthatitoccursonlyunderunknownconditions.Trytorecordthecircumstancesunderwhichthebugdoesoccur,sothatyoucanguessatwhatthevariabilityreallyis.Theconditionmayberelatedtodatavalues,suchas‘ThisonlyhappenswhenweenterWyomingasavalue.’Ifthatisnotthesourceofvariability,thenextsuspectshouldbeimproperlysynchronizedconcurrency.
Try,try,trytoreproducethebuginacontrolledway.Ifyoucan'treproduceit,setatrapforitbybuildingaloggingsystem,aspecialoneifyouhaveto,thatcanlogwhatyouguessyouneedwhenitreallydoesoccur.Resignyourselftothatifthebugonlyoccursinproductionandnotatyourwhim,thismaybealongprocess.Thehintsthatyougetfromthelogmaynotprovidethesolutionbutmaygiveyouenoughinformationtoimprovethelogging.Theimprovedloggingsystemmaytakealongtimetobeputintoproduction.Then,youhavetowaitforthebugtoreoccurtogetmoreinformation.Thiscyclecangoonforsometime.
ThestupidestintermittentbugIevercreatedwasinamulti-threadedimplementationofafunctionalprogramminglanguageforaclassproject.Ihadverycarefullyensuredcorrectconcurrentevaluationofthefunctionalprogram,goodutilizationofalltheCPUsavailable(eight,inthiscase).Isimplyforgottosynchronizethegarbagecollector.Thesystemcouldrunalongtime,oftenfinishingwhatevertaskIbegan,beforeanythingnoticeablewentwrong.I'mashamedtoadmitIhadbeguntoquestionthehardwarebeforemymistakedawnedonme.
Atworkwerecentlyhadanintermittentbugthattookusseveralweekstofind.Wehavemulti-threadedapplicationserversinJava™behindApache™webservers.Tomaintainfastpageturns,wedoallI/Oinsmallsetoffourseparatethreadsthataredifferentthanthepage-turningthreads.Everyonceinawhilethesewouldapparentlyget‘stuck’andceasedoinganythinguseful,sofarasourloggingallowedustotell,forhours.Sincewehadfourthreads,thiswasnotinitselfagiantproblem-unlessallfourgotstuck.Thenthequeuesemptiedbythesethreadswouldquicklyfillupallavailablememoryandcrashourserver.Ittookusaboutaweektofigurethismuchout,andwestilldidn'tknowwhatcausedit,whenitwouldhappen,orevenwhatthethreadswheredoingwhentheygot‘stuck’.
HowtobeaProgrammer
21Beginner
Thisillustratessomeriskassociatedwiththird-partysoftware.WewereusingalicensedpieceofcodethatremovedHTMLtagsfromtext.Duetoitsplaceoforiginweaffectionatelyreferredtothisas‘theFrenchstripper‘.Althoughwehadthesourcecode(thankgoodness!)wehadnotstudieditcarefullyuntilbyturninguptheloggingonourserverswefinallyrealizedthattheemailthreadsweregettingstuckintheFrenchstripper.
Thestripperperformedwellexceptonsomelongandunusualkindsoftexts.Onthesetexts,thecodewasquadraticorworse.Thismeansthattheprocessingtimewasproportionaltothesquareofthelengthofthetext.Hadthesetextsoccurredcommonly,wewouldhavefoundthebugrightaway.Iftheyhadneveroccurredatall,wewouldneverhavehadaproblem.Asithappens,ittookusweekstofinallyunderstandandresolvetheproblem.
NextHowtoLearnDesignSkills
HowtobeaProgrammer
22Beginner
HowtoLearnDesignSkillsTolearnhowtodesignsoftware,studytheactionofamentorbybeingphysicallypresentwhentheyaredesigning.Thenstudywell-writtenpiecesofsoftware.Afterthat,youcanreadsomebooksonthelatestdesigntechniques.
Thenyoumustdoityourself.Startwithasmallproject.Whenyouarefinallydone,considerhowthedesignfailedorsucceededandhowyoudivergedfromyouroriginalconception.Thenmoveontolargerprojects,hopefullyinconjunctionwithotherpeople.Designisamatterofjudgementthattakesyearstoacquire.Asmartprogrammercanlearnthebasicsadequatelyintwomonthsandcanimprovefromthere.
Itisnaturalandhelpfultodevelopyourownstyle,butrememberthatdesignisanart,notascience.Peoplewhowritebooksonthesubjecthaveavestedinterestinmakingitseemscientific.Don'tbecomedogmaticaboutparticulardesignstyles.
NextHowtoConductExperiments
HowtobeaProgrammer
23Beginner
HowtoConductExperimentsThelate,greatEdsgerDijkstrahaseloquentlyexplainedthatComputerScienceisnotanexperimentalscience[ExpCS]anddoesn'tdependonelectroniccomputers.Asheputsitreferringtothe1960s[Knife],
...theharmwasdone:thetopicbecameknownas“computerscience”-which,actually,islikereferringtosurgeryas“knifescience”-anditwasfirmlyimplantedinpeople'smindsthatcomputingscienceisaboutmachinesandtheirperipheralequipment.
Programmingoughtnottobeanexperimentalscience,butmostworkingprogrammersdonothavetheluxuryofengaginginwhatDijkstrameansbycomputingscience.Wemustworkintherealmofexperimentation,justassome,butnotall,physicistsdo.Ifthirtyyearsfromnowprogrammingcanbeperformedwithoutexperimentation,itwillbeagreataccomplishmentofComputerScience.
Thekindsofexperimentsyouwillhavetoperforminclude:
Testingsystemswithsmallexamplestoverifythattheyconformtothedocumentationortounderstandtheirresponsewhenthereisnodocumentation,Testingsmallcodechangestoseeiftheyactuallyfixabug,Measuringtheperformanceofasystemundertwodifferentconditionsduetoimperfectknowledgeoftheirperformancecharacteristics,Checkingtheintegrityofdata,andCollectingstatisticsthatmayhintatthesolutiontodifficultorhard-to-repeatbugs.
Idon'tthinkinthisessayIcanexplainthedesignofexperiments;youwillhavetostudyandpractice.However,Icanoffertwobitsofadvice.
First,trytobeveryclearaboutyourhypothesis,ortheassertionthatyouaretryingtotest.Italsohelpstowritethehypothesisdown,especiallyifyoufindyourselfconfusedorareworkingwithothers.
Youwilloftenfindyourselfhavingtodesignaseriesofexperiments,eachofwhichisbasedontheknowledgegainedfromthelastexperiment.Therefore,youshoulddesignyourexperimentstoprovidethemostinformationpossible.Unfortunately,thisisintensionwithkeepingeachexperimentsimple-youwillhavetodevelopthisjudgementthroughexperience.
NextTeamSkills-WhyEstimationisImportant
HowtobeaProgrammer
24Beginner
WhyEstimationisImportantTogetaworkingsoftwaresysteminactiveuseasquicklyaspossiblerequiresnotonlyplanningthedevelopment,butalsoplanningthedocumentation,deployment,andmarketing.Inacommercialprojectitalsorequiressalesandfinance.Withoutpredictabilityofthedevelopmenttime,itisimpossibletoplantheseeffectively.
Goodestimationprovidespredictability.Managersloveit,aswelltheyshould.Thefactthatitisimpossible,boththeoreticallyandpractically,topredictaccuratelyhowlongitwilltaketodevelopsoftwareisoftenlostonmanagers.Weareaskedtodothisimpossiblethingallthetime,andwemustfaceuptoithonestly.However,itwouldbedishonestnottoadmittheimpossibilityofthistask,andwhennecessary,explainit.Thereisalotofroomformiscommunicationaboutestimates,aspeoplehaveastartlingtendencytothinkwishfullythatthesentence:
Iestimatethat,ifIreallyunderstandtheproblem,itisabout50%likelythatwewillbedoneinfiveweeks(ifnoonebothersusduringthattime).
reallymeans:
Ipromisetohaveitalldonefiveweeksfromnow.
Thiscommoninterpretationproblemrequiresthatyouexplicitlydiscusswhattheestimatemeanswithyourbossorcustomerasiftheywereasimpleton.Restateyourassumptions,nomatterhowobvioustheyseemtoyou.
NextHowtoEstimateProgrammingTime
HowtobeaProgrammer
25Beginner
HowtoEstimateProgrammingTimeEstimationtakespractice.Italsotakeslabour.Ittakessomuchlabouritmaybeagoodideatoestimatethetimeitwilltaketomaketheestimate,especiallyifyouareaskedtoestimatesomethingbig.
Whenaskedtoprovideanestimateofsomethingbig,themosthonestthingtodoistostall.Mostengineersareenthusiasticandeagertoplease,andstallingcertainlywilldispleasethestalled.Butanon-the-spotestimateprobablywon'tbeaccurateandhonest.
Whilestalling,itmaybepossibletoconsiderdoingorprototypingthetask.Ifpoliticalpressurepermits,thisisthemostaccuratewayofproducingtheestimate,anditmakesrealprogress.
Whennotpossibletotakethetimeforsomeinvestigation,youshouldfirstestablishthemeaningoftheestimateveryclearly.Restatethatmeaningasthefirstandlastpartofyourwrittenestimate.Prepareawrittenestimatebyde-constructingthetaskintoprogressivelysmallersubtasksuntileachsmalltaskisnomorethanaday;ideallyatmostinlength.Themostimportantthingisnottoleaveanythingout.Forinstance,documentation,testing,timeforplanning,timeforcommunicatingwithothergroups,andvacationtimeareallveryimportant.Ifyouspendpartofeachdaydealingwithknuckleheads,putalineitemforthatintheestimate.Thisgivesyourbossvisibilityintowhatisusingupyourtimeataminimum,andmightgetyoumoretime.
Iknowgoodengineerswhopadestimatesimplicitly,butIrecommendthatyoudonot.Oneoftheresultsofpaddingistrustinyoumaybedepleted.Forinstance,anengineermightestimatethreedaysforataskthatshetrulythinkswilltakeoneday.Theengineermayplantospendtwodaysdocumentingit,ortwodaysworkingonsomeotherusefulproject.Butitwillbedetectablethatthetaskwasdoneinonlyoneday(ifitturnsoutthatway),andtheappearanceofslackingoroverestimatingisborn.It'sfarbettertogivepropervisibilityintowhatyouareactuallydoing.Ifdocumentationtakestwiceaslongascodingandtheestimatesaysso,tremendousadvantageisgainedbymakingthisvisibletothemanager.
Padexplicitlyinstead.Ifataskwillprobablytakeoneday-butmighttaketendaysifyourapproachdoesn'twork-notethissomehowintheestimateifyoucan;ifnot,atleastdoanaverageweightedbyyourestimatesoftheprobabilities.Anyriskfactorthatyoucanidentifyandassignanestimatetoshouldgointotheschedule.Onepersonisunlikelytobesickinanygivenweek.Butalargeprojectwithmanyengineerswillhavesomesicktime;likewisevacationtime.Andwhatistheprobabilityofamandatorycompany-widetrainingseminar?Ifitcanbeestimated,stickitin.Thereareofcourse,unknownunknowns,orunk-unks.Unk-
HowtobeaProgrammer
26Beginner
unksbydefinitioncannotbeestimatedindividually.Youcantrytocreateagloballineitemforallunk-unks,orhandletheminsomeotherwaythatyoucommunicatetoyourboss.Youcannot,however,letyourbossforgetthattheyexist,anditisdevilishlyeasyforanestimatetobecomeaschedulewithouttheunk-unksconsidered.
Inateamenvironment,youshouldtrytohavethepeoplewhowilldotheworkdotheestimate,andyoushouldtrytohaveteam-wideconsensusonestimates.Peoplevarywidelyinskill,experience,preparedness,andconfidence.Calamitystrikeswhenastrongprogrammerestimatesforherselfandthenweakprogrammersareheldtothisestimate.Theactofhavingthewholeteamagreeonaline-by-linebasistotheestimateclarifiestheteamunderstanding,aswellasallowingtheopportunityfortacticalreassignmentofresources(forinstance,shiftingburdenawayfromweakerteammemberstostronger).
Iftherearebigrisksthatcannotbeevaluated,itisyourdutytostatesoforcefullyenoughthatyourmanagerdoesnotcommittothemandthenbecomeembarrassedwhentheriskoccurs.Hopefullyinsuchacasewhateverisneededwillbedonetodecreasetherisk.
IfyoucanconvinceyourcompanytouseExtremeProgramming,youwillonlyhavetoestimaterelativelysmallthings,andthisisbothmorefunandmoreproductive.
NextHowtoFindOutInformation
HowtobeaProgrammer
27Beginner
HowtoFindOutInformationThenatureofwhatyouneedtoknowdetermineshowyoushouldfindit.
Ifyouneedinformationaboutconcretethingsthatareobjectiveandeasytoverify,forexamplethelatestpatchlevelofasoftwareproduct,askalargenumberofpeoplepolitelybysearchingtheinternetforitorbypostingonadiscussiongroup.Don'tsearchontheinternetforanythingthatsmacksofeitheropinionorsubjectiveinterpretation:theratioofdriveltotruthistoohigh.
Ifyouneedgeneralknowledgeaboutsomethingsubjectivethehistoryofwhatpeoplehavethoughtaboutit,gotothelibrary(thephysicalbuildinginwhichbooksarestored).Forexample,tolearnaboutmathormushroomsormysticism,gotothelibrary.
Ifyouneedtoknowhowtodosomethingthatisnottrivialgettwoorthreebooksonthesubjectandreadthem.Youmightlearnhowtodosomethingtrivial,likeinstallasoftwarepackage,fromtheInternet.Youcanevenlearnimportantthings,likegoodprogrammingtechnique,butyoucaneasilyspendmoretimesearchingandsortingtheresultsandattemptingtodivinetheauthorityoftheresultsthanitwouldtaketoreadthepertinentpartofasolidbook.
Ifyouneedinformationthatnooneelsecouldbeexpectedtoknowforexample,‘doesthissoftwarethatisbrandnewworkongiganticdatasets?’,youmuststillsearchtheinternetandthelibrary.Afterthoseoptionsarecompletelyexhausted,youmaydesignanexperimenttoascertainit.
Ifyouwantanopinionoravaluejudgementthattakesintoaccountsomeuniquecircumstance,talktoanexpert.Forinstance,ifyouwanttoknowwhetherornotitisagoodideatobuildamoderndatabasemanagementsysteminLISP,youshouldtalktoaLISPexpertandadatabaseexpert.
Ifyouwanttoknowhowlikelyitisthatafasteralgorithmforaparticularapplicationexiststhathasnotyetbeenpublished,talktosomeoneworkinginthatfield.
Ifyouwanttomakeapersonaldecisionthatonlyyoucanmakelikewhetherornotyoushouldstartabusiness,tryputtingintowritingalistofargumentsforandagainsttheidea.Ifthatfails,considerdivination.Supposeyouhavestudiedtheideafromallangles,havedoneallyourhomework,andworkedoutalltheconsequencesandprosandconsinyourmind,andyetstillremainindecisive.Younowmustfollowyourheartandtellyourbraintoshutup.
HowtobeaProgrammer
28Beginner
Themultitudeofavailabledivinationtechniquesareveryusefulfordeterminingyourownsemi-consciousdesires,astheyeachpresentacompleteambiguousandrandompatternthatyourownsubconsciouswillassignmeaningto.
NextHowtoUtilizePeopleasInformationSources
HowtobeaProgrammer
29Beginner
HowtoUtilizePeopleasInformationSourcesRespecteveryperson'stimeandbalanceitagainstyourown.Askingsomeoneaquestionaccomplishesfarmorethanjustreceivingtheanswer.Thepersonlearnsaboutyou,bothbyenjoyingyourpresenceandhearingtheparticularquestion.Youlearnaboutthepersoninthesameway,andyoumaylearntheansweryouseek.Thisisusuallyfarmoreimportantthanyourquestion.
However,thevalueofthisdiminishesthemoreyoudoit.Youare,afterall,usingthemostpreciouscommodityapersonhas:theirtime.Thebenefitsofcommunicationmustbeweighedagainstthecosts.Furthermore,theparticularcostsandbenefitsderiveddifferfrompersontoperson.Istronglybelievethatanexecutiveof100peopleshouldspendfiveminutesamonthtalkingtoeachpersoninherorganization,whichwouldbeabout5%oftheirtime.Buttenminutesmightbetoomuch,andfiveminutesistoomuchiftheyhaveonethousandemployees.Theamountoftimeyouspendtalkingtoeachpersoninyourorganizationdependsontheirrole(morethantheirposition).Youshouldtalktoyourbossmorethanyourboss'sboss,butyoushouldtalktoyourboss'sbossalittle.Itmaybeuncomfortable,butIbelieveyouhaveadutytotalkalittlebittoallyoursuperiors,eachmonth,nomatterwhat.
Thebasicruleisthateveryonebenefitsfromtalkingtoyoualittlebit,andthemoretheytalktoyou,thelessbenefittheyderive.Itisyourjobtoprovidethemthisbenefit,andtogetthebenefitofcommunicatingwiththem,keepingthebenefitinbalancewiththetimespent.
Itisimportanttorespectyourowntime.Iftalkingtosomeone,evenifitwillcostthemtime,willsaveyouagreatdealoftime,thenyoushoulddoitunlessyouthinktheirtimeismorevaluablethanyours,tothetribe,bythatfactor.
Astrangeexampleofthisisthesummerintern.Asummerinterninahighlytechnicalpositioncan'tbeexpectedtoaccomplishtoomuch;theycanbeexpectedtopesterthehelloutofeverybodythere.Sowhyisthistolerated?Becausethepesteredarereceivingsomethingimportantfromtheintern.Theygetachancetoshow-offalittle.Theygetachancetohearsomenewideas,maybe;theygetachancetoseethingsfromadifferentperspective.Theymayalsobetryingtorecruittheintern,butevenifthisisnotthecasethereismuchtogain.
Youshouldaskpeopleforalittlebitoftheirwisdomandjudgementwheneveryouhonestlybelievetheyhavesomethingtosay.Thisflattersthemandyouwilllearnsomethingandteachthemsomething.AgoodprogrammerdoesnotoftenneedtheadviceofaVice
HowtobeaProgrammer
30Beginner
PresidentofSales,butifyoueverdo,youbesuretoaskforit.Ionceaskedtolisteninonafewsalescallstobetterunderstandthejobofoursalesstaff.Thistooknomorethan30minutesbutIthinkthatsmalleffortmadeanimpressiononthesalesforce.
NextHowtoDocumentWisely
HowtobeaProgrammer
31Beginner
HowtoDocumentWiselyLifeistooshorttowritecrapnobodywillread;ifyouwritecrap,nobodywillreadit.Thereforealittlegooddocumentationisbest.Managersoftendon'tunderstandthis,becauseevenbaddocumentationgivesthemafalsesenseofsecuritythattheyarenotdependentontheirprogrammers.Ifsomeoneabsolutelyinsiststhatyouwritetrulyuselessdocumentation,say'yes'andquietlybeginlookingforabetterjob.
There'snothingquiteaseffectiveasputtinganaccurateestimateoftheamountoftimeitwilltaketoproducegooddocumentationintoanestimatetoslackenthedemandfordocumentation.Thetruthiscoldandhard:documentation,liketesting,cantakemanytimeslongerthandevelopingcode.
Writinggooddocumentationis,firstofall,goodwriting.Isuggestyoufindbooksonwriting,studythem,andpractice.Butevenifyouarealousywriterorhavepoorcommandofthelanguageinwhichyoumustdocument,theGoldenRuleisallyoureallyneed:'Dountoothersasyouwouldhavethemdountoyou.'Taketimetoreallythinkaboutwhowillbereadingyourdocumentation,whattheyneedtogetoutofit,andhowyoucanteachthattothem.Ifyoudothat,youwillbeanaboveaveragedocumentationwriter,andagoodprogrammer.
Whenitcomestoactuallydocumentingcodeitself,asopposedtoproducingdocumentsthatcanactuallybereadbynon-programmers,thebestprogrammersI'veeverknownholdauniversalsentiment:writeself-explanatorycodeandonlydocumentcodeintheplacesthatyoucannotmakeitclearbywritingthecodeitself.Therearetwogoodreasonsforthis.First,anyonewhoneedstoseecode-leveldocumentationwillinmostcasesbeabletoandprefertoreadthecodeanyway.Admittedly,thisseemseasiertotheexperiencedprogrammerthantothebeginner.Moreimportantlyhowever,isthatthecodeandthedocumentationcannotbeinconsistentifthereisnodocumentation.Thesourcecodecanatworstbewrongandconfusing.Thedocumentation,ifnotwrittenperfectly,canlie,andthatisathousandtimesworse.
Thisdoesnotmakeiteasierontheresponsibleprogrammer.Howdoesonewriteself-explanatorycode?Whatdoesthatevenmean?Itmeans:
Writingcodeknowingthatsomeonewillhavetoreadit;Applyingthegoldenrule;Choosingasolutionthatisstraightforward,evenifyoucouldgetbywithanothersolutionfaster;Sacrificingsmalloptimizationsthatobfuscatethecode;
HowtobeaProgrammer
32Beginner
Thinkingaboutthereaderandspendingsomeofyourprecioustimetomakeiteasieronher;andNoteverusingafunctionnamelikefoo,bar,ordoIt!
NextHowtoWorkwithPoorCode
HowtobeaProgrammer
33Beginner
HowtoWorkwithPoorCodeItisverycommontohavetoworkwithpoorqualitycodethatsomeoneelsehaswritten.Don'tthinktoopoorlyofthem,however,untilyouhavewalkedintheirshoes.Theymayhavebeenaskedveryconsciouslytogetsomethingdonequicklytomeetschedulepressure.Regardless,inordertoworkwithunclearcodeyoumustunderstandit.Tounderstandittakeslearningtime,andthattimewillhavetocomeoutofsomeschedule,somewhere,andyoumustinsistonit.Tounderstandit,youwillhavetoreadthesourcecode.Youwillprobablyhavetoexperimentwithit.
Thisisagoodtimetodocument,evenifitisonlyforyourself,becausetheactoftryingtodocumentthecodewillforceyoutoconsideranglesyoumightnothaveconsidered,andtheresultingdocumentmaybeuseful.Whileyou'redoingthis,considerwhatitwouldtaketorewritesomeorallofthecode.Woulditactuallysavetimetorewritesomeofit?Couldyoutrustitbetterifyourewroteit?Becarefulofarrogancehere.Ifyourewriteit,itwillbeeasierforyoutodealwith,butwillitreallybeeasierforthenextpersonwhohastoreadit?Ifyourewriteit,whatwillthetestburdenbe?Willtheneedtore-testitoutweighanybenefitsthatmightbegained?
Inanyestimatethatyoumakeforworkagainstcodeyoudidn'twrite,thequalityofthatcodeshouldaffectyourperceptionoftheriskofproblemsandunk-unks.
Itisimportanttorememberthatabstractionandencapsulation,twoofaprogrammer'sbesttools,areparticularlyapplicabletolousycode.Youmaynotbeabletoredesignalargeblockofcode,butifyoucanaddacertainamountofabstractiontoityoucanobtainsomeofthebenefitsofagooddesignwithoutreworkingthewholemess.Inparticular,youcantrytowalloffthepartsthatareparticularlybadsothattheymayberedesignedindependently.
NextHowtoUseSourceCodeControl
HowtobeaProgrammer
34Beginner
HowtoUseSourceCodeControlSourcecodecontrolsystems(alsoknownasVersionControlSystems)letyoumanageprojectseffectively.They'reveryusefulforonepersonandessentialforagroup.Theytrackallchangesindifferentversionssothatnocodeiseverlostandmeaningcanbeassignedtochanges.Onecancreatethrow-awayanddebuggingcodewithconfidencewithasourcecodecontrolsystem,sincethecodeyoumodifyiskeptcarefullyseparatefromcommitted,officialcodethatwillbesharedwiththeteamorreleased.
IwaslatetoappreciatethebenefitsofsourcecodecontrolsystemsbutnowIwouldn'tlivewithoutoneevenonaone-personproject.Generallytheyarenecessarywhenyouhaveteamworkingonthesamecodebase.However,theyhaveanothergreatadvantage:theyencouragethinkingaboutthecodeasagrowing,organicsystem.Sinceeachchangeismarkedasanewrevisionwithanewnameornumber,onebeginstothinkofthesoftwareasavisiblyprogressiveseriesofimprovements.Ithinkthisisespeciallyusefulforbeginners.
Agoodtechniqueforusingasourcecodecontrolsystemistostaywithinafewdaysofbeingup-to-dateatalltime.Codethatcan'tbefinishedinafewdaysischeckedin,butinawaythatitisinactiveandwillnotbecalled,andthereforenotcreateanyproblemsforanybodyelse.Committingamistakethatslowsdownyourteam-matesisaseriouserror;itisoftentaboo.
NextHowtoUnitTest
HowtobeaProgrammer
35Beginner
HowtoUnitTestUnittesting,thetestingofanindividualpieceofcodedfunctionalitybytheteamthatwroteit,isapartofcoding,notsomethingdifferentfromit.Partofdesigningthecodeisdesigninghowitwillbetested.Youshouldwritedownatestplan,evenifitisonlyonesentence.Sometimesthetestwillbesimple:'Doesthebuttonlookgood?'Sometimesitwillbecomplex:'Didthismatchingalgorithmreturnpreciselythecorrectmatches?'
Useassertioncheckingandtestdriverswheneverpossible.Thisnotonlycatchesbugsearly,butisveryusefullateronandletsyoueliminatemysteriesthatyouwouldotherwisehavetoworryabout.
TheExtremeProgrammingdevelopersarewritingextensivelyonunittestingeffectively;Icandonobetterthantorecommendtheirwritings.
NextTakeBreakswhenStumped
HowtobeaProgrammer
36Beginner
TakeBreakswhenStumpedWhenstumped,takeabreak.Isometimesmeditatefor15minuteswhenstumpedandtheproblemmagicallyunravelswhenIcomebacktoit.Anight'ssleepsometimesdoesthesamethingonalargerscale.It'spossiblethattemporarilyswitchingtoanyotheractivitymaywork.
NextHowtoRecognizeWhentoGoHome
HowtobeaProgrammer
37Beginner
HowtoRecognizeWhentoGoHomeComputerprogrammingisanactivitythatisalsoaculture.Theunfortunatefactisthatitisnotaculturethatvaluesmentalorphysicalhealthverymuch.Forbothcultural/historicalreasons(theneedtoworkatnightonunloadedcomputers,forexample)andbecauseofoverwhelmingtime-to-marketpressureandthescarcityofprogrammers,computerprogrammersaretraditionallyoverworked.Idon'tthinkyoucantrustallthestoriesyouhear,butIthink60hoursaweekiscommon,and50isprettymuchaminimum.Thismeansthatoftenmuchmorethanthatisrequired.Thisisseriousproblemforagoodprogrammer,whoisresponsiblenotonlyforthemselvesbuttheirteam-matesaswell.Youhavetorecognizewhentogohome,andsometimeswhentosuggestthatotherpeoplegohome.Therecan'tbeanyfixedrulesforsolvingthisproblem,anymorethantherecanbefixedrulesforraisingachild,forthesamereason---everyhumanbeingisdifferent.
Beyond60hoursaweekisanextraordinaryeffortforme,whichIcanapplyforshortperiodsoftime(aboutoneweek),andthatissometimesexpectedofme.Idon'tknowifitisfairtoexpect60hoursofworkfromaperson;Idon'tevenknowif40isfair.Iamsure,however,thatitisstupidtoworksomuchthatyouaregettinglittleoutofthatextrahouryouwork.Formepersonally,that'sanymorethan60hoursaweek.Ipersonallythinkaprogrammershouldexercisenoblesseobligeandshoulderaheavyburden.However,itisnotaprogrammer'sdutytobeapatsy.Thesadfactisprogrammersareoftenaskedtobepatsiesinordertoputonashowforsomebody,forexampleamanagertryingtoimpressanexecutive.Programmersoftensuccumbtothisbecausetheyareeagertopleaseandnotverygoodatsayingno.Therearefourdefencesagainstthis:
Communicateasmuchaspossiblewitheveryoneinthecompanysothatnoonecanmisleadtheexecutivesaboutwhatisgoingon,Learntoestimateandscheduledefensivelyandexplicitlyandgiveeveryonevisibilityintowhatthescheduleisandwhereitstands,Learntosayno,andsaynoasateamwhennecessary,andQuitifyouhaveto.
Mostprogrammersaregoodprogrammers,andgoodprogrammerswanttogetalotdone.Todothat,theyhavetomanagetheirtimeeffectively.Thereisacertainamountofmentalinertiaassociatedwithgettingwarmed-uptoaproblemanddeeplyinvolvedinit.Manyprogrammersfindtheyworkbestwhentheyhavelong,uninterruptedblocksoftimeinwhichtogetwarmed-upandconcentrate.However,peoplemustsleepandperformotherduties.
HowtobeaProgrammer
38Beginner
Eachpersonneedstofindawaytosatisfyboththeirhumanrhythmandtheirworkrhythm.Eachprogrammerneedstodowhateverittakestoprocureefficientworkperiods,suchasreservingcertaindaysinwhichyouwillattendonlythemostcriticalmeetings.
SinceIhavechildren,Itrytospendeveningswiththemsometimes.Therhythmthatworksbestformeistoworkaverylongday,sleepintheofficeorneartheoffice(Ihavealongcommutefromhometowork)thengohomeearlyenoughthenextdaytospendtimewithmychildrenbeforetheygotobed.Iamnotcomfortablewiththis,butitisthebestcompromiseIhavebeenabletoworkout.Gohomeifyouhaveacontagiousdisease.Youshouldgohomeifyouarethinkingsuicidalthoughts.Youshouldtakeabreakorgohomeifyouthinkhomicidalthoughtsformorethanafewseconds.Youshouldsendsomeonehomeiftheyshowseriousmentalmalfunctioningorsignsofmentalillnessbeyondmilddepression.Ifyouaretemptedtobedishonestordeceptiveinawaythatyounormallyarenotduetofatigue,youshouldtakeabreak.Don'tusecocaineoramphetaminestocombatfatigue.Don'tabusecaffeine.
NextHowtoDealwithDifficultPeople
HowtobeaProgrammer
39Beginner
HowtoDealwithDifficultPeopleYouwillprobablyhavetodealwithdifficultpeople.Youmayevenbeadifficultpersonyourself.Ifyouarethekindofpersonwhohasalotofconflictswithco-workersandauthorityfigures,youshouldcherishtheindependencethisimplies,butworkonyourinterpersonalskillswithoutsacrificingyourintelligenceorprinciples.
Thiscanbeverydisturbingtosomeprogrammerswhohavenoexperienceinthissortofthingandwhosepreviouslifeexperiencehastaughtthempatternsofbehaviourthatarenotusefulintheworkplace.Difficultpeopleareofteninuredtodisagreementandtheyarelessaffectedbysocialpressuretocompromisethanothers.Thekeyistorespectthemappropriately,whichismorethanyouwillwanttobutnotasmuchastheymightwant.
Programmershavetoworktogetherasateam.Whendisagreementarises,itmustberesolvedsomehow,itcannotbeduckedforlong.Difficultpeopleareoftenextremelyintelligentandhavesomethingveryusefultosay.Itiscriticalthatyoulistenandunderstandthedifficultpersonwithoutprejudicecausedbytheperson.Afailuretocommunicateisoftenthebasisofdisagreementbutitcansometimesberemovedwithgreatpatience.Trytokeepthiscommunicationcoolandcordial,anddon'tacceptanybaitsforgreaterconflictthatmaybeoffered.Afterareasonableperiodoftryingtounderstand,makeadecision.
Don'tletabullyforceyoutodosomethingyoudon'tagreewith.Ifyouaretheleader,dowhatyouthinkisbest.Don'tmakeadecisionforanypersonalreasons,andbepreparedtoexplainthereasonsforyourdecision.Ifyouareateam-matewithadifficultperson,don'tlettheleader'sdecisionhaveanypersonalimpact.Ifitdoesn'tgoyourway,doittheotherwaywhole-heartedly.
Difficultpeopledochangeandimprove.I'veseenitwithmyowneyes,butitisveryrare.However,everyonehastransitoryupsanddowns.
Oneofthechallengesthateveryprogrammerbutespeciallyleadersfaceiskeepingthedifficultpersonfullyengaged.Theyaremorepronetoduckworkandresistpassivelythanothers.
NextIntermediateskills
HowtobeaProgrammer
40Beginner
2.IntermediatePersonalSkills
HowtoStayMotivatedHowtobeWidelyTrustedHowtoTradeoffTimevs.SpaceHowtoStressTestHowtoBalanceBrevityandAbstractionHowtoLearnNewSkillsLearntoTypeHowtoDoIntegrationTestingCommunicationLanguagesHeavyToolsHowtoanalyzedata
TeamSkillsHowtoManageDevelopmentTimeHowtoManageThird-PartySoftwareRisksHowtoManageConsultantsHowtoCommunicatetheRightAmountHowtoDisagreeHonestlyandGetAwaywithIt
JudgmentHowtoTradeoffQualityAgainstDevelopmentTimeHowtoManageSoftwareSystemDependenceHowtoDecideifSoftwareisTooImmatureHowtoMakeaBuyvs.BuildDecisionHowtoGrowProfessionallyHowtoEvaluateIntervieweesHowtoKnowWhentoApplyFancyComputerScienceHowtoTalktoNon-Engineers
HowtobeaProgrammer
41Intermediate
HowtoStayMotivatedItisawonderfulandsurprisingfactthatprogrammersarehighlymotivatedbythedesiretocreateartifactsthatarebeautiful,useful,ornifty.Thisdesireisnotuniquetoprogrammersnoruniversalbutitissostrongandcommonamongprogrammersthatitseparatesthemfromothersinotherroles.
Thishaspracticalandimportantconsequences.Ifprogrammersareaskedtodosomethingthatisnotbeautiful,useful,ornifty,theywillhavelowmorale.There'salotofmoneytobemadedoingugly,stupid,andboringstuff;butintheend,funwillmakethemostmoneyforthecompany.
Obviously,thereareentireindustriesorganizedaroundmotivationaltechniquessomeofwhichapplyhere.ThethingsthatarespecifictoprogrammingthatIcanidentifyare:
Usethebestlanguageforthejob.Lookforopportunitiestoapplynewtechniques,languages,andtechnologies.Trytoeitherlearnorteachsomething,howeversmall,ineachproject.
Finally,ifpossible,measuretheimpactofyourworkintermsofsomethingthatwillbepersonallymotivating.Forexample,whenfixingbugs,countingthenumberofbugsthatIhavefixedisnotatallmotivationaltome,becauseitisindependentofthenumberthatmaystillexist,andisalsoaffectsthetotalvalueI'maddingtomycompany'scustomersinonlythesmallestpossibleway.Relatingeachbugtoahappycustomer,however,ispersonallymotivatingtome.
NextHowtobeWidelyTrusted
HowtobeaProgrammer
42Intermediate
HowtobeWidelyTrustedTobetrustedyoumustbetrustworthy.Youmustalsobevisible.Ifnooneknowsaboutyou,notrustwillbeinvestedinyou.Withthoseclosetoyou,suchasyourteammates,thisshouldnotbeanissue.Youestablishtrustbybeingresponsiveandinformativetothoseoutsideyourdepartmentorteam.Occasionallysomeonewillabusethistrust,andaskforunreasonablefavours.Don'tbeafraidofthis,justexplainwhatyouwouldhavetogiveupdoingtoperformthefavour.
Don'tpretendtoknowsomethingthatyoudon't.Withpeoplethatarenotteammates,youmayhavetomakeacleardistinctionbetween'notknowingrightoffthetopofmyhead'and'notbeingabletofigureitout,ever.'
NextHowtoTradeoffTimevs.Space
HowtobeaProgrammer
43Intermediate
HowtoTradeoffTimevs.SpaceYoucanbeagoodprogrammerwithoutgoingtocollege,butyoucan'tbeagoodintermediateprogrammerwithoutknowingbasiccomputationalcomplexitytheory.Youdon'tneedtoknow'bigO'notation,butIpersonallythinkyoushouldbeabletounderstandthedifferencebetween'constant-time','nlogn'and'nsquared'.Youmightbeabletointuithowtotrade-offtimeagainstspacewithoutthisknowledge,butinitsabsenceyouwillnothaveafirmbasisforcommunicatingwithyourcolleagues.
Indesigningorunderstandinganalgorithm,theamountoftimeittakestorunissometimesafunctionofthesizeoftheinput.Whenthatistrue,wecansayanalgorithm'sworst/expected/best-caserunningtimeis'nlogn'ifitisproportionaltothesize($n$)timesthelogarithmofthesize.Thenotationandwayofspeakingcanbealsobeappliedtothespacetakenupbyadatastructure.
Tome,computationalcomplexitytheoryisbeautifulandasprofoundasphysics-andalittlebitgoesalongway!
Time(processorcycles)andspace(memory)canbetradedoffagainsteachother.Engineeringisaboutcompromise,andthisisafineexample.Itisnotalwayssystematic.Ingeneral,however,onecansavespacebyencodingthingsmoretightly,attheexpenseofmorecomputationtimewhenyouhavetodecodethem.Youcansavetimebycaching,thatis,spendingspacetostorealocalcopyofsomething,attheexpenseofhavingtomaintaintheconsistencyofthecache.Youcansometimessavetimebymaintainingmoreinformationinadatastructure.Thisusuallycostasmallamountofspacebutmaycomplicatethealgorithm.
Improvingthespace/timetrade-offcanoftenchangeoneortheotherdramatically.However,beforeyouworkonthisyoushouldaskyourselfifwhatyouareimprovingisreallythethingthatneedsthemostimprovement.It'sfuntoworkonanalgorithm,butyoucan'tletthatblindyoutothecoldhardfactthatimprovingsomethingthatisnotaproblemwillnotmakeanynoticeabledifferenceandwillcreateatestburden.
Memoryonmoderncomputersappearscheap,becauseunlikeprocessortime,youcan'tseeitbeinguseduntilyouhitthewall;butthenfailureiscatastrophic.Therearealsootherhiddencoststousingmemory,suchasyoureffectonotherprogramsthatmustberesident,andthetimetoallocateanddeallocateit.Considerthiscarefullybeforeyoutradeawayspacetogainspeed.
NextHowtoStressTest
HowtobeaProgrammer
44Intermediate
HowtoStressTestStresstestingisfun.Atfirstitappearsthatthepurposeofstresstestingistofindoutifthesystemworksunderaload.Inreality,itiscommonthatthesystemdoesworkunderaloadbutfailstoworkinsomewaywhentheloadisheavyenough.Icallthishittingthewallor
bonking[1].Theremaybesomeexceptions,butthereisalmostalwaysa‘wall’.Thepurposeofstresstestingistofigureoutwherethewallis,andthenfigureouthowtomovethewallfurtherout.
Aplanforstresstestingshouldbedevelopedearlyintheproject,becauseitoftenhelpstoclarifyexactlywhatisexpected.Istwosecondsforawebpagerequestamiserablefailureorasmashingsuccess?Is500concurrentusersenough?That,ofcourse,depends,butonemustknowtheanswerwhendesigningthesystemthatanswerstherequest.Thestresstestneedstomodelrealitywellenoughtobeuseful.Itisn'treallypossibletosimulate500erraticandunpredictablehumansusingasystemconcurrentlyveryeasily,butonecanatleastcreate500simulationsandtrytomodelsomepartofwhattheymightdo.
Instresstesting,startoutwithalightloadandloadthesystemalongsomedimension-suchasinputrateorinputsize-untilyouhitthewall.Ifthewallistooclosetosatisfyyourneeds,figureoutwhichresourceisthebottleneck(thereisusuallyadominantone.)Isitmemory,processor,I/O,networkbandwidth,ordatacontention?Thenfigureouthowyoucanmovethewall.Notethatmovingthewall,thatis,increasingthemaximumloadthesystemcanhandle,mightnothelpormightactuallyhurttheperformanceofalightlyloadedsystem.Usuallyperformanceunderheavyloadismoreimportantthanperformanceunderalightload.
Youmayhavetogetvisibilityintoseveraldifferentdimensionstobuildupamentalmodelofit;nosingletechniqueissufficient.Forinstance,loggingoftengivesagoodideaofthewall-clocktimebetweentwoeventsinthesystem,butunlesscarefullyconstructed,doesn'tgivevisibilityintomemoryutilizationorevendatastructuresize.Similarly,inamodernsystem,anumberofcomputersandmanysoftwaresystemsmaybecooperating.Particularlywhenyouarehittingthewall(thatis,theperformanceisnon-linearinthesizeoftheinput)theseothersoftwaresystemsmaybeabottleneck.Visibilityintothesesystems,evenifonlymeasuringtheprocessorloadonallparticipatingmachines,canbeveryhelpful.
Knowingwherethewallisisessentialnotonlytomovingthewall,butalsotoprovidingpredictabilitysothatthebusinesscanbemanagedeffectively.
[1]"tohit"
HowtobeaProgrammer
45Intermediate
NextHowtoBalanceBrevityandAbstraction
HowtobeaProgrammer
46Intermediate
HowtoBalanceBrevityandAbstractionAbstractioniskeytoprogramming.Youshouldcarefullychoosehowabstractyouneedtobe.Beginningprogrammersintheirenthusiasmoftencreatemoreabstractionthanisreallyuseful.Onesignofthisisifyoucreateclassesthatdon'treallycontainanycodeanddon'treallydoanythingexceptservetoabstractsomething.Theattractionofthisisunderstandablebutthevalueofcodebrevitymustbemeasuredagainstthevalueofabstraction.Occasionally,oneseesamistakemadebyenthusiasticidealists:atthestartoftheprojectalotofclassesaredefinedthatseemwonderfullyabstractandonemayspeculatethattheywillhandleeveryeventualitythatmayarise.Astheprojectprogressesandfatiguesetsin,thecodeitselfbecomesmessy.Functionbodiesbecomelongerthantheyshouldbe.Theemptyclassesareaburdentodocumentthatisignoredwhenunderpressure.Thefinalresultwouldhavebeenbetteriftheenergyspentonabstractionhadbeenspentonkeepingthingsshortandsimple.Thisisaformofspeculativeprogramming.Istronglyrecommendthearticle'SuccinctnessisPower'byPaulGraham[PGSite].
Thereisacertaindogmaassociatedwithusefultechniquessuchasinformationhidingandobjectorientedprogrammingthataresometimestakentoofar.Thesetechniquesletonecodeabstractlyandanticipatechange.Ipersonallythink,however,thatyoushouldnotproducemuchspeculativecode.Forexample,itisanacceptedstyletohideanintegervariableonanobjectbehindmutatorsandaccessors,sothatthevariableitselfisnotexposed,onlythelittleinterfacetoit.Thisdoesallowtheimplementationofthatvariabletobechangedwithoutaffectingthecallingcode,andisperhapsappropriatetoalibrarywriterwhomustpublishaverystableAPI.ButIdon'tthinkthebenefitofthisoutweighsthecostofthewordinessofitwhenmyteamownsthecallingcodeandhencecanrecodethecalleraseasilyasthecalled.Fourorfiveextralinesofcodeisaheavypricetopayforthisspeculativebenefit.
Portabilityposesasimilarproblem.Shouldcodebeportabletoadifferentcomputer,compiler,softwaresystemorplatform,orsimplyeasilyported?Ithinkanon-portable,short-and-easily-portedpieceofcodeisbetterthanalongportableone.Itisrelativelyeasyandcertainlyagoodideatoconfinenon-portablecodetodesignatedareas,suchasaclassthatmakesdatabasequeriesthatarespecifictoagivenDBMS.
NextHowtoLearnNewSkills
HowtobeaProgrammer
47Intermediate
HowtoLearnNewSkillsLearningnewskills,especiallynon-technicalones,isthegreatestfunofall.Mostcompanieswouldhavebettermoraleiftheyunderstoodhowmuchthismotivatesprogrammers.
Humanslearnbydoing.Book-readingandclass-takingareuseful.Butcouldyouhaveanyrespectforaprogrammerwhohadneverwrittenaprogram?Tolearnanyskill,youhavetoputyourselfinaforgivingpositionwhereyoucanexercisethatskill.Whenlearninganewprogramminglanguage,trytodoasmallprojectinitbeforeyouhavetodoalargeproject.Whenlearningtomanageasoftwareproject,trytomanageasmallonefirst.
Agoodmentorisnoreplacementfordoingthingsyourself,butisalotbetterthanabook.Whatcanyouofferapotentialmentorinexchangefortheirknowledge?Ataminimum,youshouldoffertostudyhardsotheirtimewon'tbewasted.
Trytogetyourbosstoletyouhaveformaltraining,butunderstandthatitisoftennotmuchbetterthanthesameamountoftimespentsimplyplayingwiththenewskillyouwanttolearn.Itis,however,easiertoaskfortrainingthanplaytimeinourimperfectworld,eventhoughalotofformaltrainingisjustsleepingthroughlectureswaitingforthedinnerparty.
Ifyouleadpeople,understandhowtheylearnandassistthembyassigningthemprojectsthataretherightsizeandthatexerciseskillstheyareinterestedin.Don'tforgetthatthemostimportantskillsforaprogrammerarenotthetechnicalones.Giveyourpeopleachancetoplayandpracticecourage,honesty,andcommunication.
NextLearntoType
HowtobeaProgrammer
48Intermediate
LearntoTypeLearntotouch-type.Thisisanintermediateskillbecausewritingcodeissohardthatthespeedatwhichyoucantypeisirrelevantandcan'tputmuchofadentinthetimeittakestowritecode,nomatterhowgoodyouare.However,bythetimeyouareanintermediateprogrammeryouwillprobablyspendalotoftimewritingnaturallanguagetoyourcolleaguesandothers.Thisisafuntestofyourcommitment;ittakesdedicatedtimethatisnotmuchfuntolearnsomethinglikethat.LegendhasitthatwhenMichaelTiemannwasatMCCpeoplewouldstandoutsidehisdoortolistentothehumgeneratedbyhiskeystrokeswhichweresorapidastobeindistinguishable.
NextHowtoDoIntegrationTesting
HowtobeaProgrammer
49Intermediate
HowtoDoIntegrationTestingIntegrationtestingisthetestingoftheintegrationofvariouscomponentsthathavebeenunittested.Integrationisexpensiveanditcomesoutinthetesting.Youmustincludetimeforthisinyourestimatesandyourschedule.
Ideallyyoushouldorganizeaprojectsothatthereisnotaphaseattheendwhereintegrationmustexplicitlytakeplace.Itisfarbettertograduallyintegratethingsastheyarecompletedoverthecourseoftheproject.Ifitisunavoidableestimateitcarefully.
NextCommunicationLanguages
HowtobeaProgrammer
50Intermediate
CommunicationLanguagesTherearesomelanguages,thatis,formallydefinedsyntacticsystems,thatarenotprogramminglanguagesbutcommunicationlanguages-theyaredesignedspecificallytofacilitatecommunicationthroughstandardization.In2003themostimportantoftheseareUML,XML,andSQL.Youshouldhavesomefamiliaritywithallofthesesothatyoucancommunicatewellanddecidewhentousethem.
UMLisarichformalsystemformakingdrawingsthatdescribedesigns.Itsbeautyliesinthatitisbothvisualandformal,capableofconveyingagreatdealofinformationifboththeauthorandtheaudienceknowUML.Youneedtoknowaboutitbecausedesignsaresometimescommunicatedinit.ThereareveryhelpfultoolsformakingUMLdrawingsthatlookveryprofessional.InalotofcasesUMListooformal,andIfindmyselfusingasimplerboxesandarrowsstylefordesigndrawings.ButI'mfairlysureUMLisatleastasgoodforyouasstudyingLatin.
XMLisastandardfordefiningnewstandards.Itisnotasolutiontodatainterchangeproblems,thoughyousometimesseeitpresentedasifitwas.Rather,itisawelcomeautomationofthemostboringpartofdatainterchange,namely,structuringtherepresentationintoalinearsequenceandparsingbackintoastructure.Itprovidessomenicetype-andcorrectness-checking,thoughagainonlyafractionofwhatyouarelikelytoneedinpractice.
SQLisaverypowerfulandrichdataqueryandmanipulationlanguagethatisnotquiteaprogramminglanguage.Ithasmanyvariations,typicallyquiteproduct-dependent,whicharelessimportantthanthestandardizedcore.SQListhelinguafrancaofrelationaldatabases.Youmayormaynotworkinanyfieldthatcanbenefitfromanunderstandingofrelationaldatabases,butyoushouldhaveabasicunderstandingofthemandthesyntaxandmeaningofSQL.
NextHeavyTools
HowtobeaProgrammer
51Intermediate
HeavyToolsAsourtechnologicalcultureprogresses,softwaretechnologymovesfrominconceivable,toresearch,tonewproducts,tostandardizedproducts,towidelyavailableandinexpensiveproducts.Theseheavytoolscanpullgreatloads,butcanbeintimidatingandrequirealargeinvestmentinunderstanding.Theintermediateprogrammerhastoknowhowtomanagethemandwhentheyshouldbeusedorconsidered.
Tomymindrightnowsomeofthebestheavytoolsare:
RelationalDatabases,Full-textSearchEngines,Mathlibraries,OpenGL,XMLparsers,andSpreadsheets.
NextHowtoanalyzedata
HowtobeaProgrammer
52Intermediate
HowtoanalyzedataDataanalysisisaprocessintheearlystagesofsoftwaredevelopment,whenyouexamineabusinessactivityandfindtherequirementstoconvertitintoasoftwareapplication.Thisisaformaldefinition,whichmayleadyoutobelievethatdataanalysisisanactionthatyoushouldbetterleavetothesystemsanalysts,whileyou,theprogrammer,shouldfocusoncodingwhatsomebodyelsehasdesigned.Ifwefollowstrictlythesoftwareengineeringparadigm,itmaybecorrect.Experiencedprogrammersbecomedesignersandthesharpestdesignersbecomebusinessanalysts,thusbeingentitledtothinkaboutallthedatarequirementsandgiveyouawelldefinedtasktocarryout.Thisisnotentirelyaccurate,becausedataisthecorevalueofeveryprogrammingactivity.Whateveryoudoinyourprograms,youareeithermovingaroundormodifyingdata.Thebusinessanalystisanalysingtheneedsinalargerscale,andthesoftwaredesignerisfurthersqueezingsuchscalesothat,whentheproblemlandsonyourdesk,itseemsthatallyouneedtodoistoapplycleveralgorithmsandstartmovingexistingdata.
Notso.
Nomatteratwhichstageyoustartlookingatit,dataisthemainconcernofawelldesignedapplication.Ifyoulookcloselyathowabusinessanalystgetstherequirementsoutofthecustomer'srequests,you'llrealizethatdataplaysafundamentalrole.TheanalystcreatessocalledDataFlowDiagrams,wherealldatasourcesareidentifiedandtheflowofinformationisshaped.Havingclearlydefinedwhichdatashouldbepartofthesystem,thedesignerwillshapeupthedatasources,intermsofdatabaserelations,dataexchangeprotocols,andfileformats,sothatthetaskisreadytobepasseddowntotheprogrammer.However,theprocessisnotoveryet,becauseyou(theprogrammer)evenafterthisthoroughprocessofdatarefinement,arerequiredtoanalyzedatatoperformthetaskinthebestpossibleway.ThebottomlineofyourtaskisthecoremessageofNiklausWirth,thefatherofseverallanguages."Algorithms+DataStructures=Programs."Thereisneveranalgorithmstandingalone,doingsomethingtoitself.Everyalgorithmissupposedtodosomethingtoatleastonepieceofdata.
Therefore,sincealgorithmsdon'tspintheirwheelsinavacuum,youneedtoanalyzeboththedatathatsomebodyelsehasidentifiedforyouandthedatathatisnecessarytowritedownyourcode.Atrivialexamplewillmakethematterclearer.Youareimplementingasearchroutineforalibrary.Accordingtoyourspecifications,theusercanselectbooksbyacombinationofgenre,author,title,publisher,printingyear,andnumberofpages.TheultimategoalofyourroutineistoproducealegalSQLstatementtosearchtheback-enddatabase.Basedontheserequirements,youhaveseveralchoices:checkeachcontrolin
HowtobeaProgrammer
53Intermediate
turn,usinga"switch"statement,orseveral"if"ones;makeanarrayofdatacontrols,checkingeachelementtoseeifitisset;create(oruse)anabstractcontrolobjectfromwhichinheritallyourspecificcontrols,andconnectthemtoanevent-drivenengine.Ifyourrequirementsincludealsotuningupthequeryperformance,bymakingsurethattheitemsarecheckedinaspecificorder,youmayconsiderusingatreeofcomponentstobuildyourSQLstatement.Asyoucansee,thechoiceofthealgorithmdependsonthedatayoudecidetouse,ortocreate.Suchdecisionscanmakeallthedifferencebetweenanefficientalgorithmandadisastrousone.However,efficiencyisnottheonlyconcern.Youmayuseadozennamedvariablesinyourcodeandmakeitasefficientasitcaneverbe.Butsuchapieceofcodemightnotbeeasilymaintainable.Perhapschoosinganappropriatecontainerforyourvariablescouldkeepthesamespeedandinadditionallowyourcolleaguestounderstandthecodebetterwhentheylookatitnextyear.Furthermore,choosingawelldefineddatastructuremayallowthemtoextendthefunctionalityofyourcodewithoutrewritingit.Inthelongrun,yourchoicesofdatadetermineshowlongyourcodewillsurviveafteryouarefinishedwithit.Letmegiveyouanotherexample,justsomemorefoodforthought.Let'ssupposethatyourtaskistofindallthewordsinadictionarywithmorethanthreeanagrams,whereananagrammustbeanotherwordinthesamedictionary.Ifyouthinkofitasacomputationaltask,youwillendupwithanendlesseffort,tryingtoworkoutallthecombinationsofeachwordandthencomparingittotheotherwordsinthelist.However,ifyouanalyzethedataathand,you'llrealizethateachwordmayberepresentedbyarecordcontainingtheworditselfandasortedarrayofitslettersasID.Armedwithsuchknowledge,findinganagramsmeansjustsortingthelistontheadditionalfieldandpickinguptheonesthatsharethesameID.Thebruteforcealgorithmmaytakeseveraldaystorun,whilethesmartoneisjustamatterofafewseconds.Rememberthisexamplethenexttimeyouarefacinganintractableproblem.
NextTeamSkills-HowtoManageDevelopmentTime
HowtobeaProgrammer
54Intermediate
HowtoManageDevelopmentTimeTomanagedevelopmenttime,maintainaconciseandup-to-dateprojectplan.Aprojectplanisanestimate,aschedule,asetofmilestonesformarkingprogress,andanassignmentofyourteamoryourowntimetoeachtaskontheestimate.Itshouldalsoincludeotherthingsyouhavetoremembertodo,suchasmeetingwiththequalityassurancepeople,preparingdocumentation,ororderingequipment.Ifyouareonateam,theprojectplanshouldbeaconsensualagreement,bothatthestartandasyougo.
Theprojectplanexiststohelpmakedecisions,nottoshowhoworganizedyouare.Iftheprojectplaniseithertoolongornotup-to-date,itwillbeuselessformakingdecisions.Inreality,thesedecisionsareaboutindividualpersons.Theplanandyourjudgementletyoudecideifyoushouldshifttasksfromonepersontoanother.Themilestonesmarkyourprogress.Ifyouuseafancyprojectplanningtool,donotbeseducedintocreatingaBigDesignUpFront(BDUF)fortheproject,butuseittomaintainconcisionandup-to-dateness.
Ifyoumissamilestone,youshouldtakeimmediateactionsuchasinformingyourbossthatthescheduledcompletionofthatprojecthasslippedbythatamount.Theestimateandschedulecouldneverhavebeenperfecttobeginwith;thiscreatestheillusionthatyoumightbeabletomakeupthedaysyoumissedinthelatterpartoftheproject.Youmight.Butitisjustaslikelythatyouhaveunderestimatedthatpartasthatyouhaveoverestimatedit.Thereforethescheduledcompletionoftheprojecthasalreadyslipped,whetheryoulikeitornot.
Makesureyourplanincludestimefor:internalteammeetings,demos,documentation,scheduledperiodicactivities,integrationtesting,dealingwithoutsiders,sickness,vacations,maintenanceofexistingproducts,andmaintenanceofthedevelopmentenvironment.Theprojectplancanserveasawaytogiveoutsidersoryourbossaviewintowhatyouoryourteamisdoing.Forthisreasonitshouldbeshortandup-to-date.
NextHowtoManageThird-PartySoftwareRisks
HowtobeaProgrammer
55Intermediate
HowtoManageThird-PartySoftwareRisksAprojectoftendependsonsoftwareproducedbyorganizationsthatitdoesnotcontrol.Therearegreatrisksassociatedwiththirdpartysoftwarethatmustberecognizedbyeveryoneinvolved.
Never,ever,restanyhopesonvapour.Vapourisanyallegedsoftwarethathasbeenpromisedbutisnotyetavailable.Thisisthesurestwaytogooutofbusiness.Itisunwisetobemerelyscepticalofasoftwarecompany'spromisetoreleaseacertainproductwithacertainfeatureatacertaindate;itisfarwisertoignoreitcompletelyandforgetyoueverheardit.Neverletitbewrittendowninanydocumentsusedbyyourcompany.
Ifthird-partysoftwareisnotvapour,itisstillrisky,butatleastitisariskthatcanbetackled.Ifyouareconsideringusingthird-partysoftware,youshoulddevoteenergyearlyontoevaluatingit.Peoplemightnotliketohearthatitwilltaketwoweeksortwomonthstoevaluateeachofthreeproductsforsuitability,butithastobedoneasearlyaspossible.Thecostofintegratingcannotbeaccuratelyestimatedwithoutaproperevaluation.
Understandingthesuitabilityofexistingthirdpartysoftwareforaparticularpurposeisverytribalknowledge.Itisverysubjectiveandgenerallyresidesinexperts.Youcansavealotoftimeifyoucanfindthoseexperts.Oftentimesaprojectwilldependonathird-partysoftwaresystemsocompletelythatiftheintegrationfailstheprojectwillfail.Expressriskslikethatclearlyinwritingintheschedule.Trytohaveacontingencyplan,suchasanothersystemthatcanbeusedortheabilitytowritethefunctionalityyourselfiftheriskcan'tberemovedearly.Neverletascheduledependonvapour.
NextHowtoManageConsultants
HowtobeaProgrammer
56Intermediate
HowtoManageConsultantsUseconsultants,butdon'trelyonthem.Theyarewonderfulpeopleanddeserveagreatdealofrespect.Sincetheygettoseealotofdifferentprojects,theyoftenknowmoreaboutspecifictechnologiesandevenprogrammingtechniquesthanyouwill.Thebestwaytousethemisaseducatorsin-housethatcanteachbyexample.
However,theyusuallycannotbecomepartoftheteaminthesamesensethatregularemployeesare,ifonlybecauseyoumaynothaveenoughtimetolearntheirstrengthsandweaknesses.Theirfinancialcommitmentismuchlower.Theycanmovemoreeasily.Theymayhavelesstogainifthecompanydoeswell.Somewillbegood,somewillbeaverage,andsomewillbebad,buthopefullyyourselectionofconsultantswillnotbeascarefulasyourselectionofemployees,soyouwillgetmorebadones.
Ifconsultantsaregoingtowritecode,youmustreviewitcarefullyasyougoalong.Youcannotgettotheendoftheaprojectwiththeriskofalargeblockofcodethathasnotbeenreviewed.Thisistrueofallteammembers,really,butyouwillusuallyhavemoreknowledgeoftheteammembersclosertoyou.
NextHowtoCommunicatetheRightAmount
HowtobeaProgrammer
57Intermediate
HowtoCommunicatetheRightAmountCarefullyconsiderthecostofameeting;itcostsitsdurationmultipliedbythenumberofparticipants.Meetingsaresometimesnecessary,butsmallerisusuallybetter.Thequalityofcommunicationinsmallmeetingsisbetter,andlesstimeoveralliswasted.Ifanyonepersonisboredatameetingtakethisasasignthatthemeetingshouldbesmaller.
Everythingpossibleshouldbedonetoencourageinformalcommunication.Moreusefulworkisdoneduringluncheswithcolleaguesthanduringanyothertime.Itisashamethatmorecompaniesdonotrecognizenorsupportthisfact.
NextHowtoDisagreeHonestlyandGetAwaywithIt
HowtobeaProgrammer
58Intermediate
HowtoDisagreeHonestlyandGetAwaywithItDisagreementisagreatopportunitytomakeagooddecision,butitshouldbehandleddelicately.Hopefullyyoufeelthatyouhaveexpressedyourthoughtsadequatelyandbeenheardbeforethedecisionismade.Inthatcasethereisnothingmoretosay,andyoushoulddecidewhetheryouwillstandbehindthedecisioneventhoughyoudisagreewithit.Ifyoucansupportthisdecisioneventhoughyoudisagree,sayso.Thisshowshowvaluableyouarebecauseyouareindependentandarenotayes-man,butrespectfulofthedecisionandateamplayer.
Sometimesadecisionthatyoudisagreewithwillbemadewhenthedecisionmakersdidnothavethefullbenefitofyouropinion.Youshouldthenevaluatewhethertoraisetheissueonthebasisofthebenefittothecompanyortribe.Ifitisasmallmistakeinyouropinion,itmaynotbeworthreconsidering.Ifitisalargemistakeinyouropinion,thenofcourseyoumustpresentanargument.
Usually,thisisnotaproblem.Insomestressfulcircumstancesandwithsomepersonalitytypesthiscanleadtothingsbeingtakenpersonally.Forinstance,someverygoodprogrammerslacktheconfidenceneededtochallengeadecisionevenwhentheyhavegoodreasontobelieveitiswrong.Intheworstofcircumstancesthedecisionmakerisinsecureandtakesitasapersonalchallengetotheirauthority.Itisbesttorememberthatinsuchcircumstancespeoplereactwiththereptilianpartoftheirbrains.Youshouldpresentyourargumentinprivate,andtrytoshowhownewknowledgechangesthebasisonwhichthedecisionwasmade.
Whetherthedecisionisreversedornot,youmustrememberthatyouwillneverbeabletosay‘Itoldyouso!’sincethealternatedecisionwasfullyexplored.
NextJudgment-HowtoTradeoffQualityAgainstDevelopmentTime
HowtobeaProgrammer
59Intermediate
HowtoTradeoffQualityAgainstDevelopmentTimeSoftwaredevelopmentisalwaysacompromisebetweenwhattheprojectdoesandgettingtheprojectdone.Butyoumaybeaskedtotradeoffqualitytospeedthedeploymentofaprojectinawaythatoffendsyourengineeringsensibilitiesorbusinesssensibilities.Forexample,youmaybeaskedtodosomethingthatisapoorsoftwareengineeringpracticeandthatwillleadtoalotofmaintenanceproblems.
Ifthishappensyourfirstresponsibilityistoinformyourteamandtoclearlyexplainthecostofthedecreaseinquality.Afterall,yourunderstandingofitshouldbemuchbetterthanyourboss'sunderstanding.Makeitclearwhatisbeinglostandwhatisbeinggained,andatwhatcostthelostgroundwillberegainedinthenextcycle.Inthis,thevisibilityprovidedbyagoodprojectplanshouldbehelpful.Ifthequalitytradeoffaffectsthequalityassuranceeffort,pointthatout(bothtoyourbossandqualityassurancepeople).Ifthequalitytradeoffwillleadtomorebugsbeingreportedafterthequalityassuranceperiod,pointthatout.
Ifshestillinsists,youshouldtrytoisolatetheshoddinessintoparticularcomponentsthatyoucanplantorewriteorimproveinthenextcycle.Explainthistoyourteamsothattheycanplanforit.
NinjaProgrammeratSlashdotsentinthisgem:
Rememberthatagooddesignwillberesilientagainstpoorcodeimplementations.Ifgoodinterfacesandabstractionsexistthroughoutthecode,thentheeventualrewriteswillbefarmorepainless.Ifitishardtowriteclearcodethatishardtofix,considerwhatiswrongwiththecoredesignthatiscausingthis.
NextHowtoManageSoftwareDependence
HowtobeaProgrammer
60Intermediate
HowtoManageSoftwareSystemDependenceModernsoftwaresystemstendtodependonalargenumberofcomponentsthatmaynotbedirectlyunderyourcontrol.Thisincreasesproductivitythroughsynergyandreuse.However,eachcomponentbringswithitsomeproblems:
Howwillyoufixbugsinthecomponent?Doesthecomponentrestrictyoutoparticularhardwareorsoftwaresystems?Whatwillyoudoifthecomponentfailscompletely?
Itisalwaysbesttoencapsulatethecomponentinsomewaysothatitisisolatedandsothatitcanbeswappedout.Ifthecomponentprovestobecompletelyunworkable,youmaybeabletogetadifferentone,butyoumayhavetowriteyourown.Encapsulationisnotportability,butitmakesportingeasier,whichisalmostasgood.
Havingthesourcecodeforacomponentdecreasestheriskbyafactoroffour.Withsourcecode,youcanevaluateiteasier,debugiteasier,findworkaroundseasier,andmakefixeseasier.Ifyoumakefixes,youshouldgivethemtotheownerofthecomponentandgetthefixesincorporatedintoanofficialrelease;otherwiseyouwilluncomfortablyhavetomaintainanunofficialversion.
NextHowtoDecideifSoftwareisTooImmature
HowtobeaProgrammer
61Intermediate
HowtoDecideifSoftwareisTooImmatureUsingsoftwareotherpeoplewroteisoneofthemosteffectivewaystoquicklybuildasolidsystem.Itshouldnotbediscouraged,buttherisksassociatedwithitmustbeexamined.Oneofthebiggestrisksistheperiodofbugginessandnearinoperabilitythatisoftenassociatedwithsoftwarebeforeitmatures,throughusage,intoausableproduct.Beforeyouconsiderintegratingwithasoftwaresystem,whethercreatedinhouseorbyathirdparty,itisveryimportanttoconsiderifitisreallymatureenoughtobeused.Herearetenquestionsyoushouldaskyourselfaboutit:
1. Isitvapour?(Promisesareveryimmature).2. Isthereanaccessiblebodyofloreaboutthesoftware?3. Areyouthefirstuser?4. Isthereastrongincentiveforcontinuation?5. Hasithadamaintenanceeffort?6. Willitsurvivedefectionofthecurrentmaintainers?7. Isthereaseasonedalternativeatleasthalfasgood?8. Isitknowntoyourtribeorcompany?9. Isitdesirabletoyourtribeorcompany?10. Canyouhirepeopletoworkonitevenifitisbad?
Alittleconsiderationofthesecriteriademonstratesthegreatvalueofwell-establishedfreesoftwareandopen-sourcesoftwareinreducingrisktotheentrepreneur.
NextHowtoMakeaBuyvs.BuildDecision
HowtobeaProgrammer
62Intermediate
HowtoMakeaBuyvs.BuildDecisionAnentrepreneurialcompanyorprojectthatistryingtoaccomplishsomethingwithsoftwarehastoconstantlymakeso-calledbuyvs.builddecisions.Thisturnofphraseisunfortunateintwoways:itseemstoignoreopen-sourceandfreesoftwarewhichisnotnecessarilybought.Evenmoreimportantly,itshouldperhapsbecalledanobtainandintegratevs.buildhereandintegratedecisionbecausethecostofintegrationmustbeconsidered.Thisrequiresagreatcombinationofbusiness,management,andengineeringsavvy.
Howwelldoyourneedsmatchthoseforwhichitwasdesigned?Whatportionofwhatyoubuywillyouneed?Whatisthecostofevaluatingtheintegration?Whatisthecostofintegration?Willbuyingincreaseordecreaselongtermmaintenancecosts?Willbuildingitputyouinabusinesspositionyoudon'twanttobein?
Youshouldthinktwicebeforebuildingsomethingthatisbigenoughtoserveasthebasisforanentireotherbusiness.Suchideasareoftenproposedbybrightandoptimisticpeoplethatwillhavealottocontributetoyourteam.Iftheirideaiscompelling,youmaywishtochangeyourbusinessplan;butdonotinvestinasolutionbiggerthanyourownbusinesswithoutconsciousthought.
Afterconsideringthesequestions,youshouldperhapspreparetwodraftprojectplans,oneforbuildingandoneforbuying.Thiswillforceyoutoconsidertheintegrationcosts.Youshouldalsoconsiderthelongtermmaintenancecostsofbothsolutions.Toestimatetheintegrationcosts,youwillhavetodoathoroughevaluationofthesoftwarebeforeyoubuyit.Ifyoucan'tevaluateit,youwillassumeanunreasonableriskinbuyingitandyoushoulddecideagainstbuyingthatparticularproduct.Ifthereareseveralbuydecisionsunderconsideration,someenergywillhavetobespentevaluatingeach.
NextHowtoGrowProfessionally
HowtobeaProgrammer
63Intermediate
HowtoGrowProfessionallyAssumeresponsibilityinexcessofyourauthority.Playtherolethatyoudesire.Expressappreciationforpeople'scontributiontothesuccessofthelargerorganization,aswellasthingsasthathelpyoupersonally.
Ifyouwanttobecomeateamleader,instigatetheformationofconsensus.Ifyouwanttobecomeamanager,takeresponsibilityfortheschedule.Youcanusuallydothiscomfortablywhileworkingwithaleaderoramanager,sincethisfreesthemuptotakegreaterresponsibility.Ifthatistoomuchtotry,doitalittleatatime.
Evaluateyourself.Ifyouwanttobecomeabetterprogrammer,asksomeoneyouadmirehowyoucanbecomelikethem.Youcanalsoaskyourboss,whowillknowlessbuthaveagreaterimpactonyourcareer.
Planwaystolearnnewskills,boththetrivialtechnicalkind,likelearninganewsoftwaresystem,andthehardsocialkind,likewritingwell,byintegratingthemintoyourwork.
NextHowtoEvaluateInterviewees
HowtobeaProgrammer
64Intermediate
HowtoEvaluateIntervieweesEvaluatingpotentialemployeesisnotgiventheenergyitdeserves.Abadhire,likeabadmarriage,isterrible.Asignificantportionofeveryone'senergyshouldbedevotedtorecruitment,thoughthisisrarelydone.
Therearedifferentinterviewingstyles.Somearetorturous,designedtoputthecandidateunderagreatdealofstress.Thisservesaveryvaluablepurposeofpossiblyrevealingcharacterflawsandweaknessesunderstress.Candidatesarenomorehonestwithinterviewersthantheyarewiththemselves,andthehumancapacityforself-deceptionisastonishing.
Youshould,ataminimum,givethecandidatetheequivalentofanoralexaminationonthetechnicalskillsfortwohours.Withpractice,youwillbeabletoquicklycoverwhattheyknowandquicklyretractfromwhattheydon'tknowtomarkouttheboundary.Intervieweeswillrespectthis.Ihaveseveraltimesheardintervieweessaythatthequalityoftheexaminationwasoneoftheirmotivationsforchoosingacompany.Goodpeoplewanttobehiredfortheirskills,notwheretheyworkedlastorwhatschooltheywenttoorsomeotherinessentialcharacteristic.
Indoingthis,youshouldalsoevaluatetheirabilitytolearn,whichisfarmoreimportantthanwhattheyknow.Youshouldalsowatchforthewhiffofbrimstonethatisgivenoffbydifficultpeople.Youmaybeabletorecognizeitbycomparingnotesaftertheinterview,butintheheatoftheinterviewitishardtorecognize.Howwellpeoplecommunicateandworkwithpeopleismoreimportantthanbeinguponthelatestprogramminglanguage.
Areaderhashadgoodluckusinga‘take-home’testforinterviewees.Thishastheadvantagethatcanuncovertheintervieweethatcanpresentthemselveswellbutcan'treallycode-andtherearemanysuchpeople.Ipersonallyhavenottriedthistechnique,butitsoundssensible.
Finally,interviewingisalsoaprocessofselling.Youshouldbesellingyourcompanyorprojecttothecandidate.However,youaretalkingtoaprogrammer,sodon'ttrytocolourthetruth.Startoffwiththebadstuff,thenfinishstrongwiththegoodstuff.
NextHowtoKnowWhentoApplyFancyComputerScience
HowtobeaProgrammer
65Intermediate
HowtoKnowWhentoApplyFancyComputerScienceThereisabodyofknowledgeaboutalgorithms,datastructures,mathematics,andothergee-whizstuffthatmostprogrammersknowaboutbutrarelyuse.Inpractice,thiswonderfulstuffistoocomplicatedandgenerallyunnecessary.Thereisnopointinimprovinganalgorithmwhenmostofyourtimeisspentmakinginefficientdatabasecalls,forinstance.Anunfortunateamountofprogrammingconsistsofgettingsystemstotalktoeachotherandusingverysimpledatastructurestobuildaniceuserinterface.
Whenishightechnologytheappropriatetechnology?Whenshouldyoucrackabooktogetsomethingotherthanarun-of-the-millalgorithm?Itissometimesusefultodothisbutitshouldbeevaluatedcarefully.
Thethreemostimportantconsiderationsforthepotentialcomputersciencetechniqueare:
Isitwellencapsulatedsothattherisktoothersystemsislowandtheoverallincreaseincomplexityandmaintenancecostislow?Isthebenefitstartling(forexample,afactoroftwoinamaturesystemorafactorofteninanewsystem)?Willyoubeabletotestandevaluateiteffectively?
Ifawell-isolatedalgorithmthatusesaslightlyfancyalgorithmcandecreasehardwarecostorincreaseperformancebyafactoroftwoacrossanentiresystem,thenitwouldbecriminalnottoconsiderit.Oneofthekeystoarguingforsuchanapproachistoshowthattheriskisreallyquitelow,sincetheproposedtechnologyhasprobablybeenwellstudied,theonlyissueistheriskofintegration.Hereaprogrammer'sexperienceandjudgementcantrulysynergizewiththefancytechnologytomakeintegrationeasy.
NextHowtoTalktoNon-Engineers
HowtobeaProgrammer
66Intermediate
HowtoTalktoNon-EngineersEngineersandprogrammersinparticulararegenerallyrecognizedbypopularcultureasbeingdifferentfromotherpeople.Thisimpliesthatotherpeoplearedifferentfromus.Thisisworthbearinginmindwhencommunicatingwithnon-engineers;youshouldalwaysunderstandtheaudience.
Non-engineersaresmart,butnotasgroundedincreatingtechnicalthingsasweare.Wemakethings.Theysellthingsandhandlethingsandcountthingsandmanagethings,buttheyarenotexpertsonmakingthings.Theyarenotasgoodatworkingtogetheronteamsasengineersare(therearenodoubtexceptions.)Theirsocialskillsaregenerallyasgoodasorbetterthanengineersinnon-teamenvironments,buttheirworkdoesnotalwaysdemandthattheypracticethekindofintimate,precisecommunicationandcarefulsubdivisionsoftasksthatwedo.
Non-engineersmaybetooeagertopleaseandtheymaybeintimidatedbyyou.Justlikeus,theymaysay‘yes’withoutreallymeaningittopleaseyouorbecausetheyarealittlescaredofyou,andthennotstandbehindtheirwords.
Non-programmerscanunderstandtechnicalthingsbuttheydonothavethethingthatissohardevenforus-technicaljudgement.Theydounderstandhowtechnologyworks,buttheycannotunderstandwhyacertainapproachwouldtakethreemonthsandanotheronethreedays.(Afterall,programmersareanecdotallyhorribleatthiskindofestimationaswell.)Thisrepresentsagreatopportunitytosynergizewiththem.
Whentalkingtoyourteamyouwill,withoutthinking,useasortofshorthand,anabbreviatedlanguagethatiseffectivebecauseyouwillhavemuchsharedexperienceabouttechnologyingeneralandyourproductinparticular.Ittakessomeeffortnottousethisshorthandwiththosethatdon'thavethatsharedexperience,especiallywhenmembersofyourownteamarepresent.Thisvocabularycreateawallbetweenyouandthosethatdonotshareit,and,evenworse,wastestheirtime.
Withyourteam,thebasicassumptionsandgoalsdonotneedtoberestatedoften,andmostconversationfocusesonthedetails.Withoutsiders,itmustbetheotherwayaround.Theymaynotunderstandthingsyoutakeforgranted.Sinceyoutakethemforgrantedanddon'trepeatthem,youcanleaveaconversationwithanoutsiderthinkingthatyouunderstandeachotherwhenreallythereisalargemisunderstanding.Youshouldassumethatyouwillmiscommunicateandwatchcarefullytofindthismiscommunication.Trytogetthemtosummarizeorparaphrasewhatyouaresayingtomakesuretheyunderstand.Ifyouhave
HowtobeaProgrammer
67Intermediate
theopportunitytomeetwiththemoften,spendalittlebitoftimeaskingifyouarecommunicatingeffectively,andhowyoucandoitbetter.Ifthereisaproblemincommunication,seektoalteryourownpracticesbeforebecomingfrustratedwiththeirs.
Iloveworkingwithnon-engineers.Itprovidesgreatopportunitiestolearnandtoteach.Youcanoftenleadbyexample,intermsoftheclarityofyourcommunication.Engineersaretrainedtobringorderoutofchaos,tobringclarityoutofconfusion,andnon-engineerslikethisaboutus.Becausewehavetechnicaljudgementandcanusuallyunderstandbusinessissues,wecanoftenfindasimplesolutiontoaproblem.
Oftennon-engineersproposesolutionsthattheythinkwillmakeiteasieronusoutofkindnessandadesiretodotherightthing,wheninfactamuchbetteroverallsolutionexistswhichcanonlybeseenbysynergizingtheoutsidersviewwithyourtechnicaljudgement.IpersonallylikeExtremeProgrammingbecauseitaddressesthisinefficiency;bymarryingtheestimationquicklytotheidea,itmakesiteasiertofindtheideathatisthebestcombinationofcostandbenefit.
NextAdvancedskills
HowtobeaProgrammer
68Intermediate
3.AdvancedTechnologicalJudgment
HowtoTelltheHardFromtheImpossibleHowtoUtilizeEmbeddedLanguagesChoosingLanguages
CompromisingWiselyHowtoFightSchedulePressureHowtoUnderstandtheUserHowtoGetaPromotion
ServingYourTeamHowtoDevelopTalentHowtoChooseWhattoWorkOnHowtoGettheMostFromYourTeam-matesHowtoDivideProblemsUpHowtoHandleBoringTasksHowtoGatherSupportforaProjectHowtoGrowaSystemHowtoCommunicateWellHowtoTellPeopleThingsTheyDon'tWanttoHearHowtoDealwithManagerialMythsHowtoDealwithOrganizationalChaos
HowtobeaProgrammer
69Advanced
HowtoTelltheHardFromtheImpossibleItisourjobtodothehardanddiscerntheimpossible.Fromthepointofviewofmostworkingprogrammers,somethingisimpossibleifeitheritcannotbegrownfromasimplesystemoritcannotbeestimated.Bythisdefinitionwhatiscalledresearchisimpossible.Alargevolumeofmereworkishard,butnotnecessarilyimpossible.
Thedistinctionisnotfacetiousbecauseyoumayverywellbeaskedtodowhatispracticallyimpossible,eitherfromascientificpointofvieworasoftwareengineeringpointofview.Itthenbecomesyourjobtohelptheentrepreneurfindareasonablesolutionwhichismerelyhardandgetsmostofwhattheywanted.Asolutionismerelyhardwhenitcanbeconfidentlyscheduledandtherisksareunderstood.
Itisimpossibletosatisfyavaguerequirement,suchas‘Buildasystemthatwillcomputethemostattractivehairstyleandcolourforanyperson.’Iftherequirementcanbemademorecrisp,itwilloftenbecomemerelyhard,suchas‘Buildasystemtocomputeanattractivehairstyleandcolourforaperson,allowthemtopreviewitandmakechanges,andhavethecustomersatisfactionbasedontheoriginalstylingbesogreatthatwemakealotofmoney.’Ifthereisnotcrispdefinitionofsuccess,youwillnotsucceed.
NextHowtoUtilizeEmbeddedLanguages
HowtobeaProgrammer
70Advanced
HowtoUtilizeEmbeddedLanguagesEmbeddingaprogramminglanguageintoasystemhasanalmosteroticfascinationtoaprogrammer.Itisoneofthemostcreativeactsthatcanbeperformed.Itmakesthesystemtremendouslypowerful.ItallowsyoutoexercisehermostcreativeandPrometheanskills.Itmakesthesystemintoyourfriend.
Thebesttexteditorsintheworldallhaveembeddedlanguages.Thiscanbeusedtotheextentthattheintendedaudiencecanmasterthelanguage.Ofcourse,useofthelanguagecanbemadeoptional,asitisintexteditors,sothatinitiatescanuseitandnooneelsehasto.
Iandmanyotherprogrammershavefallenintothetrapofcreatingspecialpurposeembeddedlanguages.Ifellintoittwice.Therealreadyexistmanylanguagesdesignedspecificallytobeembeddedlanguages.Youshouldthinktwicebeforecreatinganewone.
Therealquestiontoaskoneselfbeforeembeddingalanguageis:Doesthisworkwithoragainstthecultureofmyaudience?Ifyouintendedaudienceisexclusivelynon-programmers,howwillithelp?Ifyourintendedaudienceisexclusivelyprogrammers,wouldtheypreferanapplicationsprogrammersinterface(API)?Andwhatlanguagewillitbe?Programmersdon'twanttolearnanewlanguagethatisnarrowlyused;butifitmesheswiththeirculturetheywillnothavetospendmuchtimelearningit.Itisajoytocreateanewlanguage.Butweshouldnotletthatblindustotheneedsoftheuser.Unlessyouhavesometrulyoriginalneedsandideas,whynotuseanexistinglanguagesothatyoucanleveragethefamiliarityusersalreadyhavewithit?
NextChoosingLanguages
HowtobeaProgrammer
71Advanced
ChoosingLanguagesThesolitaryprogrammerthatloveshiswork(ahacker)canchoosethebestlanguageforthetask.Mostworkingprogrammershaveverylittlecontrolofthelanguagetheywilluse.Generally,thisissueisdictatedbypointy-hairedbosseswhoaremakingapoliticaldecision,ratherthanatechnologicaldecision,andlackthecouragetopromoteanunconventionaltoolevenwhentheyknow,oftenwithfirst-handknowledge,thatthelessacceptedtoolisbest.Inothercasestheveryrealbenefitofunityamongtheteam,andtosomeextentwithalargercommunity,precludeschoiceonthepartoftheindividual.Oftenmanagersaredrivenbytheneedtobeabletohireprogrammerswithexperienceinagivenlanguage.Nodoubttheyareservingwhattheyperceivetobethebestinterestsoftheprojectorcompany,andmustberespectedforthat.However,Ipersonallybelievethisisthemostwastefulanderroneouscommonpracticeyouarelikelytoencounter.
Butofcourse,thingsareneverone-dimensional.Evenifacorelanguageismandatedandbeyondyourcontrol,itisoftenthecasethattoolsandotherprogramscanandshouldbewritteninadifferentlanguage.Ifalanguageistobeembedded(andyoushouldalwaysconsiderit!)thechoiceoflanguagewilldependalotonthecultureoftheusers.Oneshouldtakeadvantageofthistoserveyourcompanyorprojectbyusingthebestlanguageforthejob,andinsodoingmakeworkmoreinteresting.
Programminglanguagesshouldreallybecallednotationsinthatlearningoneisnotatallasdifficultaslearninganaturallanguage.Tobeginnersandtosomeoutsiders'learninganewlanguage'seemsadauntingtask;butafteryouhavethreeunderyourbeltit'sreallyjustaquestionofbecomingfamiliarwiththeavailablelibraries.Onetendstothinkofalargesystemthathascomponentsinthreeorfourlanguagesasamessyhodgepodge;butIarguethatsuchasystemisinmanycasesstrongerthanaone-languagesysteminseveralways:
Thereisnecessarilyloosecouplingbetweenthecomponentsthatarewrittenindifferentnotations(thoughmaybenotcleaninterfaces),Youcanevolvetoanewlanguage/platformeasilybyrewritingeachcomponentindividually,Onelanguagemaynotbeagoodfitfortheoverallsystem-havingmultiplelanguagesforyourmodulesallowsyoutopicktherighttoolforthejob.
Someoftheseeffectsmayonlybepsychological;butpsychologymatters.Intheendthecostsoflanguagetyrannyoutweighanyadvantagethatitprovides.
NextCompromisingWisely-HowtoFightaSchedulePressure
HowtobeaProgrammer
72Advanced
HowtoFightSchedulePressureTime-to-marketpressureisthepressuretodeliveragoodproductquickly.Itisgoodbecauseitreflectsafinancialreality,andishealthyuptoapoint.Schedulepressureisthepressuretodeliversomethingfasterthanitcanbedeliveredanditiswasteful,unhealthy,andalltoocommon.
Schedulepressureexistsforseveralreasons.Thepeoplewhotaskprogrammersdonotfullyappreciatewhatastrongworkethicwehaveandhowmuchfunitistobeaprogrammer.Perhapsbecausetheyprojecttheirownbehaviourontous,theybelievethataskingforitsoonerwillmakeusworkhardertogetittheresooner.Thisisprobablyactuallytrue,buttheeffectisverysmall,andthedamageisverygreat.Additionally,theyhavenovisibilityintowhatitreallytakestoproducesoftware.Notbeingabletoseeit,andnotbeabletocreateitthemselves,theonlythingtheycandoisseetime-to-marketpressureandfussatprogrammersaboutit.
Thekeytofightingschedulepressureissimplytoturnitintotime-to-marketpressure.Thewaytodothistogivevisibilityintotherelationshipbetweentheavailablelabourandtheproduct.Producinganhonest,detailed,andmostofall,understandableestimateofallthelabourinvolvedisthebestwaytodothis.Ithastheaddedadvantageofallowinggoodmanagementdecisionstobemadeaboutpossiblefunctionalitytrade-offs.
Thekeyinsightthattheestimatemustmakeplainisthatlabourisanalmostincompressiblefluid.Youcan'tpackmoreintoaspanoftimeanymorethanyoucanpackmorewaterintoacontaineroverandabovethatcontainer'svolume.Inasense,aprogrammershouldneversay‘no’,butrathertosay‘Whatwillyougiveuptogetthatthingyouwant?’Theeffectofproducingclearestimateswillbetoincreasetherespectforprogrammers.Thisishowotherprofessionalsbehave.Programmers'hardworkwillbevisible.Settinganunrealisticschedulewillalsobepainfullyobvioustoeveryone.Programmerscannotbehoodwinked.Itisdisrespectfulanddemoralizingtoaskthemtodosomethingunrealistic.ExtremeProgrammingamplifiesthisandbuildsaprocessaroundit;Ihopethateveryreaderwillbeluckyenoughtouseit.
NextHowtoUnderstandtheUser
HowtobeaProgrammer
73Advanced
HowtoUnderstandtheUserItisyourdutytounderstandtheuser,andtohelpyourbossunderstandtheuser.Becausetheuserisnotasintimatelyinvolvedinthecreationofyourproductasyouare,theybehavealittledifferently:
Theusergenerallymakesshortpronouncements.Theuserhastheirownjob;theywillmainlythinkofsmallimprovementsinyourproduct,notbigimprovements.Theusercan'thaveavisionthatrepresentsthecompletebodyofyourproductusers.
Itisyourdutytogivethemwhattheyreallywant,notwhattheysaytheywant.Itishowever,bettertoproposeittothemandgetthemtoagreethatyourproposaliswhattheyreallywantbeforeyoubegin,buttheymaynothavethevisiontodothis.Yourconfidenceinyourownideasaboutthisshouldvary.Youmustguardagainstbotharroganceandfalsemodestyintermsofknowingwhatthecustomerreallywants.Programmersaretrainedtodesignandcreate.Marketresearchersaretrainedtofigureoutwhatpeoplewant.Thesetwokindsofpeople,ortwomodesofthoughtinthesameperson,workingharmoniouslytogethergivethebestchanceofformulatingthecorrectvision.
Themoretimeyouspendwithusersthebetteryouwillbeabletounderstandwhatwillreallybesuccessful.Youshouldtrytotestyourideasagainstthemasmuchasyoucan.Youshouldeatanddrinkwiththemifyoucan.
GuyKawasaki[Rules]hasemphasizedtheimportanceofwatchingwhatyourusersdoinadditiontolisteningtothem.
Ibelievecontractorsandconsultantsoftenhavetremendousproblemsgettingtheirclientstoclarifyintheirownmindswhattheyreallywant.Ifyouintendtobeaconsultant,Isuggestyouchooseyourclientsbasedontheirclear-headednessaswellastheirpocketbooks.
NextHowtoGetaPromotion
HowtobeaProgrammer
74Advanced
HowtoGetaPromotionTobepromotedtoarole,actoutthatrolefirst.
Togetpromotedtoatitle,findoutwhatisexpectedofthattitleanddothat.
Togetapayraise,negotiatearmedwithinformation.
Ifyoufeellikeyouarepastdueforapromotion,talktoyourbossaboutit.Askthemexplicitlywhatyouneedtodotogetpromoted,andtrytodoit.Thissoundstrite,butoftentimesyourperceptionofwhatyouneedtodowilldifferconsiderablyfromyourboss's.Alsothiswillpinyourbossdowninsomeways.
Mostprogrammersprobablyhaveanexaggeratedsenseoftheirrelativeabilitiesinsomeways---afterall,wecan'tallbeinthetop10%!However,Ihaveseensomepeoplewhowereseriouslyunappreciated.Onecannotexpecteveryone'sevaluationtoperfectlymatchrealityatalltimes,butIthinkpeoplearegenerallymoderatelyfair,withonecaveat:youcannotbeappreciatedwithoutvisibilityintoyourwork.Sometimes,duetohappenstanceorpersonalhabits,someonewillnotbenoticedmuch.Workingfromhomealotorbeinggeographicallyseparatedfromyourteamandbossmakesthisespeciallydifficult.
NextServingYourTeam-HowtoDevelopTalent
HowtobeaProgrammer
75Advanced
HowtoDevelopTalentNietschzeexaggeratedwhenhesaid[Stronger]:
Whatdoesnotdestroyme,makesmestronger.
Yourgreatestresponsibilityistoyourteam.Youshouldknoweachofthemwell.Youshouldstretchyourteam,butnotoverburdenthem.Youshouldusuallytalktothemaboutthewaytheyarebeingstretched.Iftheybuyintoit,theywillbewellmotivated.Oneachproject,oreveryotherproject,trytostretchtheminbothawaythattheysuggestandawaythatyouthinkwillbegoodforthem.Stretchthemnotbygivingthemmorework,butbygivingthemanewskillorbetteryetanewroletoplayontheteam.
Youshouldallowpeople(includingyourself)tofailoccasionallyandshouldplanforsomefailureinyourschedule.Ifthereisneveranyfailure,therecanbenosenseofadventure.Iftherearenotoccasionalfailures,youarenottryinghardenough.Whensomeonefails,youshouldbeasgentleasyoucanwiththemwhilenottreatingthemasthoughtheyhadsucceeded.
Trytogeteachteammembertobuyinandbewellmotivated.Askeachofthemexplicitlywhattheyneedtobewell-motivatediftheyarenot.Youmayhavetoleavethemdissatisfied,butyoushouldknowwhateverybodydesires.
Youcan'tgiveuponsomeonewhoisintentionallynotcarryingtheirshareoftheloadbecauseoflowmoraleordissatisfactionandjustletthembeslack.Youmusttrytogetthemwell-motivatedandproductive.Aslongasyouhavethepatience,keepthisup.Whenyourpatienceisexhausted,firethem.Youcannotallowsomeonewhoisintentionallyworkingbelowtheirleveltoremainontheteam,sinceitisnotfairtotheteam.
Makeitcleartothestrongmembersofyourteamthatyouthinktheyarestrongbysayingsoinpublic.Praiseshouldbepublicandcriticismprivate.
Thestrongmembersoftheteamwillnaturallyhavemoredifficulttasksthantheweakmembersoftheteam.Thisisperfectlynaturalandnobodywillbebotheredbyitaslongaseveryoneworkshard.
Itisanoddfactthatisnotreflectedinsalariesthatagoodprogrammerismoreproductivethan10badprogrammers.Thiscreatesastrangesituation.Itwilloftenbetruethatyoucouldmovefasterifyourweakprogrammerswouldjustgetoutoftheway.Ifyoudidthisyouwouldinfactmakemoreprogressintheshortterm.However,yourtribewouldlosesome
HowtobeaProgrammer
76Advanced
importantbenefits,namelythetrainingoftheweakermembers,thespreadingoftribalknowledge,andtheabilitytorecoverfromthelossofthestrongmembers.Thestrongmustbegentleinthisregardandconsidertheissuefromallangles.
Youcanoftengivethestrongerteammemberschallenging,butcarefullydelineated,tasks.
NextHowtoChooseWhattoWorkOn
HowtobeaProgrammer
77Advanced
HowtoChooseWhattoWorkOnYoubalanceyourpersonalneedsagainsttheneedsoftheteaminchoosingwhataspectofaprojecttoworkon.Youshoulddowhatyouarebestat,buttrytofindawaytostretchyourselfnotbytakingonmoreworkbutbyexercisinganewskill.Leadershipandcommunicationskillsaremoreimportantthantechnicalskills.Ifyouareverystrong,takeonthehardestorriskiesttask,anddoitasearlyaspossibleintheprojecttodecreaserisk.
NextHowtoGettheMostFromYourTeam-mates
HowtobeaProgrammer
78Advanced
HowtoGettheMostFromYourTeam-matesTogetthemostfromyourteam-mates,developagoodteamspiritandtrytokeepeveryindividualbothpersonallychallengedandpersonallyengaged.
Todevelopteamspirit,cornystufflikelogoizedclothingandpartiesaregood,butnotasgoodaspersonalrespect.Ifeveryonerespectseveryoneelse,nobodywillwanttoletanybodydown.Teamspiritiscreatedwhenpeoplemakesacrificesfortheteamandthinkintermsofthegoodoftheteambeforetheirownpersonalgood.Asaleader,youcan'taskformorethanyougiveyourselfinthisrespect.
Oneofthekeystoteamleadershipistofacilitateconsensussothateveryonehasbuyin.Thisoccasionallymeansallowingyourteam-matestobewrong.Thatis,ifitdoesnotharmtheprojecttoomuch,youmustletsomeofyourteamdothingstheirownway,basedonconsensus,evenifyoubelievewithgreatconfidenceitisthewrongthingtodo.Whenthishappens,don'tagree,simplydisagreeopenlyandaccepttheconsensus.Don'tsoundhurt,orlikeyou'rebeingforcedintoit,simplystatethatyoudisagreebutthinktheconsensusoftheteamismoreimportant.Thiswilloftencausethemtobacktrack.Don'tinsistthattheygothroughwiththeirinitialplaniftheydobacktrack.
Ifthereisanindividualwhowillnotconsentafteryouhavediscussedtheissuesfromallappropriatesides,simplyassertthatyouhavetomakeadecisionandthatiswhatyourdecisionis.Ifthereisawaytojudgeifyourdecisionwillbewrongorifitislatershowntobewrong,switchasquicklyasyoucanandrecognizethepersonswhowereright.
Askyourteam,bothasagroupandindividually,whattheythinkwouldcreateteamspiritandmakeforaneffectiveteam.
Praisefrequentlyratherthanlavishly.Especiallypraisethosewhodisagreewithyouwhentheyarepraiseworthy.Praiseinpublicandcriticizeinprivate;withoneexception:sometimesgrowthorthecorrectionofafaultcan'tbepraisedwithoutdrawingembarrassingattentiontotheoriginalfault,sothatgrowthshouldbepraisedinprivate.
NextHowtoDivideProblemsUp
HowtobeaProgrammer
79Advanced
HowtoDivideProblemsUpIt'sfuntotakeasoftwareprojectanddivideitupintotasksthatwillbeperformedbyindividuals.Thisshouldbedoneearly.Sometimesmanagersliketothinkthatanestimatecanbemadewithoutconsiderationoftheindividualsthatwillperformthework.Thisisimpossiblesincetheproductivityofindividualsvariessowidely.Whohasparticularknowledgeaboutacomponentalsoconstantlychangesandcanhaveanorderofmagnitudeeffectonperformance.
Justasacomposerconsidersthetimbreoftheinstrumentthatwillplayapartorthecoachofanathleticteamconsidersthestrengthsofeachplayer,theexperiencedteamleaderwillnotusuallybeabletoseparatethedivisionoftheprojectintotasksfromtheteammemberstowhichtheywillbeassigned.Thisispartofthereasonthatahigh-performingteamshouldnotbebrokenup.
Thereisacertaindangerinthisgiventhatpeoplewillbecomeboredastheybuildupontheirstrengthsandneverimprovetheirweaknessesorlearnnewskills.However,specializationisaveryusefulproductivitytoolwhennotoverused.
NextHowtoHandleBoringTasks
HowtobeaProgrammer
80Advanced
HowtoHandleBoringTasksSometimesitisnotpossibletoavoidboringtasksthatarecriticaltothesuccessofthecompanyortheproject.Thesetaskscanreallyhurtthemoraleofthosethathavetodothem.ThebesttechniquefordealingwiththisistoinvokeorpromoteLarryWall'sprogrammer'svirtueofLaziness.Trytofindsomewaytogetthecomputertodothetaskforyouortohelpyourteam-matesdothis.Workingforaweekonaprogramtodoataskthatwilltakeaweektodobyhandhasthegreatadvantageofbeingmoreeducationalandsometimesmorerepeatable.
Ifallelsefails,apologizetothosewhohavetodotheboringtask,butundernocircumstancesallowthemtodoitalone.Ataminimumassignateamoftwotodotheworkandpromotehealthyteamworktogetthetaskdone.
NextHowtoGatherSupportforaProject
HowtobeaProgrammer
81Advanced
HowtoGatherSupportforaProjectTogathersupportforaproject,createandcommunicateavisionthatdemonstratesrealvaluetotheorganizationasawhole.Attempttoletothersshareinyourvisioncreation.Thisgivesthemareasontosupportyouandgivesyouthebenefitoftheirideas.Individuallyrecruitkeysupportersforyourproject.Whereverpossible,show,don'ttell.Ifpossible,constructaprototypeoramock-uptodemonstrateyourideas.Aprototypeisalwayspowerfulbutinsoftwareitisfarsuperiortoanywrittendescription.
NextHowtoGrowaSystem
HowtobeaProgrammer
82Advanced
HowtoGrowaSystemTheseedofatreecontainstheideaoftheadultbutdoesnotfullyrealizetheformandpotencyoftheadult.Theembryogrows.Itbecomeslarger.Itlooksmoreliketheadultandhasmoreoftheuses.Eventuallyitbearsfruit.Later,itdiesanditsbodyfeedsotherorganisms.
Wehavetheluxuryoftreatingsoftwarelikethat.Abridgeisnotlikethat;thereisneverababybridge,butmerelyanunfinishedbridge.Bridgesarealotsimplerthansoftware.
Itisgoodtothinkofsoftwareasgrowing,becauseitallowsustomakeusefulprogressbeforewehaveaperfectmentalimage.Wecangetfeedbackfromusersandusethattocorrectthegrowth.Pruningoffweaklimbsishealthful.
Theprogrammermustdesignafinishedsystemthatcanbedeliveredandused.Buttheadvancedprogrammermustdomore.Youmustdesignagrowthpaththatendsinthefinishedsystem.Itisyourjobtotakeagermofanideaandbuildapaththattakesitassmoothlyaspossibleintoausefulartefact.
Todothis,youmustvisualizetheendresultandcommunicateitinawaythattheengineeringteamcangetexcitedabout.Butyoumustalsocommunicatetothemapaththatgoesfromwherevertheyarenowtowheretheywanttobewithnolargeleaps.Thetreemuststayalivethewholetime;itcannotbedeadatonepointandresurrectedlater.
Thisapproachiscapturedinspiraldevelopment.Milestonesthatarenevertoofarapartareusedtomarkprogressalongthepath.Intheultra-competitiveenvironmentofbusiness,itisbestifthemilestonescanbereleasedandmakemoneyasearlyaspossible,eveniftheyarefarawayfromawell-designedendpoint.Oneoftheprogrammer'sjobsistobalancetheimmediatepay-offagainstfuturepay-offbywiselychoosingagrowthpathexpressedinmilestones.
Theadvancedprogrammerhasthetripleresponsibilityofgrowingsoftware,teams,andpersons.
Areader,RobHafernik,sentinthiscommentonthissectionthatIcandonobetterthantoquoteinfull:
HowtobeaProgrammer
83Advanced
Ithinkyouunder-emphasizetheimportancehere.It'snotjustsystems,butalgorithms,userinterfaces,datamodels,andsoon.It'sabsolutelyvitalasyouworkonalargesystemtohavemeasurableprogresstowardintermediategoals.Nothingisasbadasthespecialhorrorofgettingdowntotheendanddiscoveringthatthewholethingjustisn'tgoingtowork(lookattherecentdebacleoftheVoterNewsSystem).Iwouldevengofurtherandstateitasalawofnature:nolarge,complexsystemcanbeimplementedfromscratch,itcanonlybeevolvedfromasimplesystemtoacomplexsysteminaseriesofintentionalsteps.
TowhichonecanonlyreplyFiatlux!
NextHowtoCommunicateWell
HowtobeaProgrammer
84Advanced
HowtoCommunicateWellTocommunicatewell,youhavetorecognizehowharditis.Itisaskilluntoitself.Itismadeharderbythefactthatthepersonswithwhomyouhavetocommunicateareflawed.Theydonotworkhardatunderstandingyou.Theyspeakpoorlyandwritepoorly.Theyareoftenoverworkedorbored,and,ataminimum,somewhatfocusedontheirownworkratherthanthelargerissuesyoumaybeaddressing.Oneoftheadvantagesoftakingclassesandpractisingwriting,publicspeaking,andlisteningisthatifyoubecomegoodatityoucanmorereadilyseewhereproblemslieandhowtocorrectthem.
Theprogrammerisasocialanimalwhosesurvivaldependsoncommunicationwithherteam.Theadvancedprogrammerisasocialanimalwhosesatisfactiondependsoncommunicationwithpeopleoutsideherteam.
Theprogrammerbringsorderoutofchaos.Oneinterestingwaytodothisistoinitiateaproposalofsomekindoutsidetheteam.Thiscanbedoneinastrawmanorwhite-paperformatorjustverbally.Thisleadershiphasthetremendousadvantageofsettingthetermsofthedebate.Italsoexposesyoutocriticism,andworse,rejectionandneglect.Theadvancedprogrammermustbepreparedtoacceptthis,becauseshehasauniquepowerandthereforeauniqueresponsibility.Entrepreneurswhoarenotprogrammersneedprogrammerstoprovideleadershipinsomeways.Programmersarethepartofthebridgebetweenideasandrealitythatrestsonreality.
Ihaven'tmasteredcommunicatingwell,butwhatI'mcurrentlytryingiswhatIthinkofafour-prongedapproach:AfterIhavemyideasinorderandamfullyprepared,Itrytospeakverbally,handpeopleawhite-paper(onrealpaper,aswellaselectronically)showthemademo,andthenpatientlyrepeatthisprocess.Ithinkalotoftimeswearenotpatientenoughinthiskindofdifficultcommunication.Youshouldnotbedisheartenedifyourideasarenotimmediatelyaccepted.Ifyouhaveinvestedenergyintheirpreparation,noonewillthinkpoorlyofyouforit.
NextHowtoTellPeopleThingsTheyDon'tWanttoHear
HowtobeaProgrammer
85Advanced
HowtoTellPeopleThingsTheyDon'tWanttoHearYouwilloftenhavetotellpeoplethingsthatwillmakethemuncomfortable.Rememberthatyouaredoingthisforareason.Evenifnothingcanbedoneabouttheproblem,youaretellingthemasearlyaspossiblesotheywillbewell-informed.
Thebestwaytotellsomeoneaboutaproblemistoofferasolutionatthesametime.Thesecondbestwayistoappealtothemforhelpwiththeproblem.Ifthereisadangerthatyouwon'tbebelieved,youshouldgathersomesupportforyourassertion.
Oneofthemostunpleasantandcommonthingsyouwillhavetosayis,‘Theschedulewillhavetoslip.’Theconscientiousprogrammerhatestosaythis,butmustsayitasearlyaspossible.Thereisnothingworsethanpostponingactionwhenamilestoneslips,eveniftheonlyactionistoinformeveryone.Indoingthis,itisbettertodoitasateam,atleastinspirit,ifnotphysically.Youwillwantyourteam'sinputonbothwhereyoustandandwhatcanbedoneaboutit,andtheteamwillhavetofacetheconsequenceswithyou.
NextHowtoDealwithManagerialMyths
HowtobeaProgrammer
86Advanced
HowtoDealwithManagerialMythsThewordmythsometimesmeansfiction.Butithasadeeperconnotation.Italsomeansastoryofreligioussignificancethatexplainstheuniverseandmankind'srelationshiptoit.Managerstendtoforgetwhattheylearnedasprogrammersandbelieveincertainmyths.Itwouldbeasrudeandunsuccessfultotrytoconvincethemthesemythsarefalseastotrytodisillusionadevoutlyreligiouspersonoftheirbeliefs.Forthatreason,youshouldrecognizethesebeliefsasmyths:
Moredocumentationisalwaysbetter.(Theywantit,buttheydon'twantyoutospendanytimeonit.)Programmerscanbeequated.(Programmersvarybyanorderofmagnitude.)Resourcescanbeaddedtoalateprojecttospeedit.(Thecostofcommunicationwiththenewpersonsisalmostalwaysmoretaxingthanhelpful.)Itispossibletoestimatesoftwaredevelopmentreliably.(Itisnoteventheoreticallypossible.)Programmers'productivitycanbemeasuredintermsofsomesimplemetric,likelinesofcode.(Ifsuccinctnessispower,linesofcodearebad,notgood.)
Ifyouhaveanopportunity,youcantrytoexplainthesethings,butdon'tfeelbadifyouhavenosuccessanddon'tdamageyourreputationbyconfrontingthesemythsbelligerently.Eachofthesemythsreinforcesthemanager'sideathattheyhavesomeactualcontroloverwhatisgoingon.Thetruthisthatmanagersfacilitateiftheyaregood,andimpedeiftheyarebad.
NextHowtoDealwithOrganizationalChaos
HowtobeaProgrammer
87Advanced
HowtoDealwithOrganizationalChaosThereareoftenbriefperiodsofgreatorganizationalchaos,suchaslay-offs,buyouts,ipos,firings,newhirings,andsoon.Theseareunsettlingtoeveryone,butperhapsalittlelessunsettlingtotheprogrammerwhosepersonalself-esteemisfoundedincapacityratherthaninposition.Organizationalchaosisagreatopportunityforprogrammerstoexercisetheirmagicpower.I'vesavedthisforlastbecauseitisadeeptribalsecret.Ifyouarenotaprogrammer,pleasestopreadingnow.
Engineershavethepowertocreateandsustain.
Non-engineerscanorderpeoplearoundbut,inatypicalsoftwarecompany,cancreateandsustainnothingwithoutengineers,justasengineerstypicallycannotsellaproductormanageabusinesseffectively.Thispowerisproofagainstalmostalloftheproblemsassociatedwithtemporaryorganizationalmayhem.Whenyouhaveityoushouldignorethechaoscompletelyandcarryonasifnothingishappening.Youmay,ofcourse,getfired,butifthathappensyoucanprobablygetanewjobbecauseofthemagicpower.Morecommonly,somestressed-outpersonwhodoesnothavethemagicpowerwillcomeintoyourcubeandtellyoutodosomethingstupid.Ifyouarereallysurethatitisstupid,itisbesttosmileandnoduntiltheygoawayandthencarryondoingwhatyouknowisbestforthecompany.
Ifyouarealeader,tellyourpeopletodothesamethingandtellthemtoignorewhatanybodyelsetellsthem.Thiscourseofactionisthebestforyoupersonally,andisthebestforyourcompanyorproject.
NextGlossary
HowtobeaProgrammer
88Advanced
AppendixA-Bibliography/Websiteography
Books[Rules00]GuyKawasaki,MichelleMoreno,andGaryKawasaki.2000.HarperBusiness.RulesforRevolutionaries:TheCapitalistManifestoforCreatingandMarketingNewProductsandServices.
[RDev96]SteveMcConnell.1996.MicrosoftPress.Redmond,Wash.RapidDevelopment:TamingWildSoftwareSchedules.
[CodeC93]SteveMcConnell.1993.MicrosoftPress.Redmond,Wash.CodeComplete.
[XP99]KentBeck.1999.0201616416.Addison-Wesley.ExtremeProgrammingExplained:EmbraceChange.
[PlanXP00]KentBeckandMartinFowler.2000.0201710919.Addison-Wesley.PlanningExtremeProgramming.
[Prag99]AndrewHunt,DavidThomas,andWardCunningham.1999.020161622X.Addison-Wesley.ThePragmaticProgrammer:FromJourneymantoMaster.
[Stronger]FriedrichNietzsche.1889.TwilightoftheIdols,"MaximsandArrows",section8..
WebSites[PGSite]PaulGraham.2002.Articlesonhiswebsite:http://www.paulgraham.com/articles.html.Allofthem,butespecially"BeatingtheAverages".
[Hacker]EricS.Raymond.2003.HowtoBecomeaHacker.http://www.catb.org/~esr/faqs/hacker-howto.html.
[HackDict]EricS.Raymond.2003.TheNewHackerDictionary.http://catb.org/esr/jargon/jargon.html.
[ExpCS]EdsgerW.Dijkstra.1986.HowExperimentalisComputingScience?.http://www.cs.utexas.edu/users/EWD/ewd09xx/EWD988a.PDF.
[Knife]EdsgerW.Dijkstra.1984.OnaCulturalGap.http://www.cs.utexas.edu/users/EWD/ewd09xx/EWD913.PDF.
HowtobeaProgrammer
89AppendixA*Bibliography/Websiteography
NextHistory
HowtobeaProgrammer
90AppendixA*Bibliography/Websiteography
AppendixB-History
MovetoGithubThisessayhasbeencreatedasarepositoryonGithubsothatitcanbeeasilyshared,updatedandimproved.Itwascopiedfromhttp://samizdat.mines.edu/howto/HowToBeAProgrammer.htmbyBraydieGrove.ItwasmovedtoGithubinJanuary2016.
RequestforFeedbackorExtensionPleasesendmeanycommentsyoumayhaveonthisessay.Iconsiderallsuggestions,manyofwhichhavealreadyimprovedthisessay.
IhaveplacedthisessayundertheGNUFreeDocumentationLicense.Thislicenseisnotspecificallydesignedforessays.Essaysareusuallyintendedtobecoherentandconvincingargumentsthatarewrittenfromasinglepointofviewinasinglevoice.Ihopethisessayisashortandpleasantread.
Ialsohopethatitisinstructive.Althoughnotatextbook,itisbrokenintomanysmallsectionstowhichnewsectionscanbefreelyadded.Ifsoinclined,youareencouragedtoexpanduponthisessayasyouseefit,subjecttotheprovisionsoftheLicense.
Itmaybearrogancetoimaginethatthisdocumentisworthyofextension;buthopespringseternal.Iwouldbejoyousifitwereextendedinthefollowingways:
Theadditionofacomprehensivereadinglisttoeachsection,
Theadditionofmoreandbettersections,
Translationintootherlanguages,evenifonlyonasubsection-by-subsectionbasis,and/or
Criticismorcommentaryin-linedintothetext.
Theabilitytobuildintodifferentformats,suchaspalmformatsandbetterHTML.
Ifyouinformmeofyourwork,IwillconsideritandmayincludeitinsubsequentversionsthatIproduce,subjecttotheprovisionsoftheLicense.Youmayofcourseproduceyourownversionsofthisdocumentwithoutmyknowledge,asexplainedintheLicense.
Thankyou.
HowtobeaProgrammer
91AppendixB*History(AsofJanuary2016)
RobertL.Read
OriginalVersionTheoriginalversionofthisdocumentwasbegunbyRobertL.Readintheyear2000andfirstpublishedelectronicallyatSamizdatPress(http://Samizdat.mines.edu)in2002.ItisdedicatedtotheprogrammersofHire.com.
AfterthisarticlewasmentionedonSlashdotin2003,about75peoplesentmeemailwithsuggestionsanderrata.Iappreciatethemall.Therewasalotofduplication,butthefollowingpeopleeithermademajorsuggestionsorwerethefirsttofindabugthatIfixed:MorganMcGuire,DavidMason,TomMoertel,NinjaProgrammer(145252)atSlashdot,BenVierck,RobHafernik,MarkHowe,PieterPareit,BrianGrayson,ZedA.Shaw,SteveBenz,MaksimIoffe,AndrewWu,DavidJeschke,andTomCorcoran.
FinallyIwouldliketothankChristinaVallery,whoseeditingandproofreadinggreatlyimprovedtheseconddraft,andWayneAllen,whoencouragedmetoinitiatethis.
OriginalAuthor'sBioRobertL.ReadlivesinAustin,Texas,withhiswifeandtwochildren.HeiscurrentlyaPrincipalEngineeratHire.com,wherehehasworkedforfouryears.Priortothathefounded4RTechnology,whichmadeascanner-basedimageanalysisqualitycontroltoolforthepaperindustry.
RobreceivedaPhDfromtheUniversityofTexasatAustinin1995inComputerSciencerelatedtodatabasetheory.In1987hereceivedaBAinComputerSciencefromRiceUniversity.Hehasbeenapaidprogrammersincetheageof16.
NextLicense
HowtobeaProgrammer
92AppendixB*History(AsofJanuary2016)
ContributionsThisrepositoryaimstobeacommunitydrivenproject,andyourinvolvementwillultimatelyhelpimprovethequalityofthisguide.
WhatcanIdotocontribute?Thereareanumberofwaystocontributeto"HowtobeaProgrammer".
IdeasfornewsectionsImprovementstoexistingsectionsIdentifyingtyposorotherissuesinsectionsContributingadditionallinkstoresourcesforsectionsGeneralsuggestionsforimprovingtheproject
ContributorsGithubholdsalistofallcontributorstothisproject.
EditorshipandMovetoGitHubBraydieGrovehasagreedtoserveaseditor-in-chief.
BraydietransposedtheoriginalessayintoMarkDownandcreatedtherepository.
HowtobeaProgrammer
93AppendixC*Contributions(AsofJanuary2016)
Glossary
bossThepersonorentitythatgivesyoutasks.Insomecasesthismaybethepublicatlarge.
1.1.6.HowtoFixPerformanceProblems 1.2.1.WhyEstimationisImportant1.2.4.HowtoUtilizePeopleasInformationSources1.2.2.HowtoEstimateProgrammingTime2.3.1.HowtoTradeoffQualityAgainstDevelopmentTime2.3.5.HowtoGrowProfessionally 2.1.6.HowtoLearnNewSkills2.2.1.HowtoManageDevelopmentTime 3.2.2.HowtoUnderstandtheUser3.2.3.HowtoGetaPromotion 0.Introduction
bossThepersonwhosetsyourtasks.Insomecases,theuseristheboss.
bottleneckThemostimportantlimitationintheperformanceofasystem.Aconstrictionthatlimitsperformance.
1.1.6.HowtoFixPerformanceProblems 2.1.4.HowtoStressTest
boxesandarrowsAloose,informalstyleofmakingdiagramsconsistingofboxesandarrowsdrawnbetweenthoseboxestoshowtherelationships.Thiscontrastwithformaldiagrammethodologies,suchasUML.
2.1.9.CommunicationLanguages
business
HowtobeaProgrammer
94Glossary
Agroupofpeopleorganizedformakingmoney.
1.2.3.HowtoFindOutInformation2.3.1.HowtoTradeoffQualityAgainstDevelopmentTime2.3.4.HowtoMakeaBuyvs.BuildDecision 2.3.8.HowtoTalktoNon-Engineers2.1.4.HowtoStressTest 2.1.11.Howtoanalyzedata2.2.2.HowtoManageThird-PartySoftwareRisks 3.3.7.HowtoGrowaSystem3.3.11.HowtoDealwithOrganizationalChaos 0.Introduction
buyvs.buildAnadjectivedescribingachoicebetweenspendingmoneyforsoftwareorwritingityourself.
2.3.4.HowtoMakeaBuyvs.BuildDecision
communicationlanguagesAlanguagedesignedprimarilyforstandardizationratherthanexecution.
2.1.9.CommunicationLanguages
companyAgroupofpeopleorganizedformakingmoney.
1.1.1.LearntoDebug 1.2.2.HowtoEstimateProgrammingTime1.2.10.HowtoRecognizeWhentoGoHome2.3.3.HowtoDecideifSoftwareisTooImmature2.3.4.HowtoMakeaBuyvs.BuildDecision 2.3.6.HowtoEvaluateInterviewees2.1.1.HowtoStayMotivated 2.2.2.HowtoManageThird-PartySoftwareRisks2.2.3.HowtoManageConsultants2.2.5.HowtoDisagreeHonestlyandGetAwaywithIt3.3.5.HowtoHandleBoringTasks 3.3.11.HowtoDealwithOrganizationalChaos3.1.3.ChoosingLanguages 0.Introduction
divideandconquer
HowtobeaProgrammer
95Glossary
Atechniqueoftop-downdesignand,importantly,ofdebuggingthatisthesubdivisionofaproblemoramysteryintoprogressivelysmallerproblemsormysteries.
1.1.2.HowtoDebugbySplittingtheProblemSpace
EntrepreneurTheinitiatorofprojects.
2.3.3.HowtoDecideifSoftwareisTooImmature3.1.1.HowtoTelltheHardFromtheImpossible
ExtremeProgrammingAstyleofprogrammingemphasizingcommunicationwiththecustomerandautomatedtesting.
1.2.2.HowtoEstimateProgrammingTime 1.2.8.HowtoUnitTest2.3.8.HowtoTalktoNon-Engineers 3.2.1.HowtoFightSchedulePressure4.AppendixA*Bibliography/Websiteography 0.Introduction
garbageObjectsthatarenolongerneededthatholdmemory.
1.1.9.HowtoManageMemory
garbageAllocatedmemorythatnolongerhasanyusefulmeaning.
garbagecollectorAsystemforrecyclinggarbage.
1.1.9.HowtoManageMemory 1.1.10.HowtoDealwithIntermittentBugs
HowtobeaProgrammer
96Glossary
GlossaryThisisaglossaryoftermsasusedinthisessay.Thesedonotnecessarilyhaveastandardizedmeaningtootherpeople.EricS.Raymondhascompiledamassiveandinformativeglossary[HackerDict]thatrathersurprisinglycanpleasurablybereadcover-to-coveronceyoucanappreciateafractionofit.
heapallocatedMemorycanbesaidtobeheapallocatedwheneverthemechanismforfreeingitiscomplicated.
1.1.9.HowtoManageMemory
hittingthewallTorunoutofaspecificresourcecausingperformancetodegradesharplyratherthangradually.
2.1.4.HowtoStressTest
informationhidingAdesignprinciplethatseekstokeepthingsindependentanddecoupledbyusinginterfacesthatexposeaslittleinformationaspossible.
2.1.5.HowtoBalanceBrevityandAbstraction
linguafrancaAlanguagesopopularastobeadefactostandardforitsfield,asFrenchwasforinternationaldiplomacyatonetime.
2.1.9.CommunicationLanguages
logging
HowtobeaProgrammer
97Glossary
Thepracticeofwritingaprogramsothatitcanproduceaconfigurableoutputlogdescribingitsexecution.
1.1.1.LearntoDebug 1.1.4.HowtoDebugUsingaLog1.1.5.HowtoUnderstandPerformanceProblems1.1.10.HowtoDealwithIntermittentBugs 2.1.4.HowtoStressTest
low-hangingfruitBigimprovementsthatcostlittle.
1.1.6.HowtoFixPerformanceProblems
masterAuniquepieceofinformationfromwhichallcachedcopiesarederivedthatservesastheofficialdefinitionofthatdata.
1.1.8.HowtoDealwithI/OExpense 3.1.2.HowtoUtilizeEmbeddedLanguages4.AppendixA*Bibliography/Websiteography
memoryleakTheunwantedcollectionofreferencestoobjectsthatpreventsgarbagecollection(orabuginthegarbagecollectorormemorymanagementsystem!)thatcausestheprogramtograduallyincreaseitsmemorydemandsovertime.
1.1.9.HowtoManageMemory
mereworkWorkthatrequireslittlecreativityandentailslittlerisk.Mereworkcanbeestimatedeasily.
3.1.1.HowtoTelltheHardFromtheImpossible
object-orientedprogrammingAnprogrammingstyleemphasizingthethemanagementofstateinsideobjects.
HowtobeaProgrammer
98Glossary
printliningTheinsertionofstatementsintoaprogramonastrictlytemporarybasisthatoutputinformationabouttheexecutionoftheprogramforthepurposeofdebugging.
1.1.1.LearntoDebug 1.1.4.HowtoDebugUsingaLog
programmingnotationAsynonymforprogramminglanguagethatemphasizesthemathematicalnatureofprogramminglanguageandtheirrelativesimplicitycomparedtonaturallanguages.
scrollblindnessTheeffectofbeingunabletofindinformationyouneedbecauseitisburiedintoomuchother,lessinterestinginformation.
1.1.4.HowtoDebugUsingaLog
speculativeprogrammingProducingafeaturebeforeitisreallyknownifthatfeaturewillbeuseful.
2.1.5.HowtoBalanceBrevityandAbstraction
strawmanAdocumentmeanttobethestartingpointofatechnicaldiscussion.Astrawmanmayleadtoastickman,tinman,woodman,ironman,etc.
3.3.8.HowtoCommunicateWell
tribeThepeoplewithwhomyoushareloyaltytoacommongoal.
1.2.4.HowtoUtilizePeopleasInformationSources2.3.3.HowtoDecideifSoftwareisTooImmature
HowtobeaProgrammer
99Glossary
2.2.5.HowtoDisagreeHonestlyandGetAwaywithIt 3.3.1.HowtoDevelopTalent0.Introduction
tribeAgroupofpeopleyoushareculturalaffinityandloyaltywith.
unk-unkSlangforunknown-unknown.Problemsthatcannotpresentlyevenbeconceptualizedthatwillstealtimeawayfromtheprojectandwrecktheschedule.
vapourIllusionaryandoftendeceptivepromisesofsoftwarethatisnotyetforsaleand,asoftenasnot,willnevermaterializeintoanythingsolid.
2.3.3.HowtoDecideifSoftwareisTooImmature2.2.2.HowtoManageThird-PartySoftwareRisks
wall-clockActuallytimeasmeasuredbyaclockonawall,asopposedtoCPUtime.
1.1.5.HowtoUnderstandPerformanceProblems 2.1.4.HowtoStressTest
white-paperAninformativedocumentthatisoftenmeanttoexplainorsellaproductorideatoanaudiencedifferentthantheprogrammersofthatproductoridea.
3.3.8.HowtoCommunicateWell
HowtobeaProgrammer
100Glossary