Page 2
Page 8

Chapter1.Introduction"Mostgoodprogrammersdoprogrammingnotbecausetheyexpecttogetpaidorgetadulationbythepublic,butbecauseitisfuntoprogram."—LinusTorvaldsImajoredinPoliticalScienceatClemsonUniversity.BeforeIchosethispathIconsideredComputerScience.IevenenrolledinanIntroductiontoProgrammingclassmyFreshmanyear,butquicklydroppedit.Itwastoodifficult.WhilelivinginSiliconValleyaftergraduationIdecidedIneededtolearntoprogram.Ayearlater,IwasworkingasasoftwareengineerIIateBay(aboveanentrylevelsoftwareengineer,butbelowaseniorsoftwareengineer).Idon’twanttogivetheimpressionthatthiswaseasy.Itwasincrediblychallenging.Inbetweenthrowingthingsatthewall,itwasalotoffuntoo.IstartedmyjourneylearningtoprograminPython,apopularprogramminglanguage.Thisbook,however,isnotaboutteachingyouhowtoprograminaspecificlanguage(althoughitdoes).Thereareplentyofamazingbooks,classesandresourcesthatdothatalready.Thefocusiseverythingelsethosestandardresourcesdonotteachyou.It’saboutthethingsIhadtolearnonmyowninordertobecomeasoftwareengineer.Thisbookisnotmeantforsomeonelookingforacasualintroductiontoprogrammingsotheycanwritecodeasahobby.Thisbookiswrittenspecificallyforthoselookingtoprogramprofessionally.Whetheryourgoalistobecomeasoftwareengineer,anentrepreneurortouseyournewprogrammingskillsinanotherprofession,thisbookwaswrittenforyou.Learningaprogramminglanguageisonlypartofthebattle.Thereareotherskillsyouneedinordertospeakthelanguageofcomputerscientists.IwillteachyoueverythingIlearnedonmyjourneyfromprogrammingnovicetoprofessionalsoftwareengineer.Iwrotethisbooktogiveaspiringprogrammersanoutlineofwhattheyneedtoknow.Asaself-taughtprogrammer,Ididn’tknowwhatIneededtolearn.Theintroductiontoprogrammingbooksareallthesame.TheyteachyouthebasicsofhowtoprogramineitherPythonorRubyandsendyouonyourway.ThefeedbackI’veheardfrompeoplefinishingthesebooksis,“WhatdoIdonow?Iamnotaprogrammeryet,andIdon’tknowwhattolearnnext.”Thisbookismyanswertothatquestion.HowThisBookIsStructuredThisbookisdividedintosixparts,basedonmovingthroughthefollowingstages:learningtoprogram,learningobject-orientedprogramming,learningtouseprograms(likeyouroperatingsystem)thatwillmakeyouabetterprogrammer,learningComputerScience,learningtoprogramforproductionandgettingajobandworkingonateam.


Page 9

Manyofthesubjectscoveredinasinglechapterofthisbookcouldbe—andare—coveredbyentirebooks.Mygoalisnottocovereverydetailofeverysubjectyouneedtoknow.Mygoalistogiveyouamap—anoutlineofalloftheskillsyouneedtodevelopinordertoprogramprofessionally.PartI:IntroductiontoProgramming.Youwillwriteyourfirstprogramasquicklyaspossible,hopefullytoday.IfyoualreadyknowhowtoprogramyoucanusethissectiontostartlearningPython.IfyoualreadyknowPython,skipit.PartII:IntroductiontoObject-orientedProgramming.Icoverthedifferentprogrammingparadigms—focussingonobject-orientedprogramming—andbuildagamethatwillshowyouthepowerofprogramming.Afterthissection,you’llbehookedonprogramming.PartIII:IntroductiontoProgrammingTools.Youlearntousedifferenttoolstotakeyourprogrammingproductivitytothenextlevel.Bythispointyouarehookedonprogrammingandwanttogetevenbetter.Youwilllearnmoreaboutyouroperatingsystem,howtocollaboratewithotherengineersusingversioncontrol,howtouseyourInteractiveDevelopmentEnvironmenttoboostyourproductivityandhowtoinstallandmanageotherpeople'sprograms.PartIV:IntroductiontoComputerScience.Nowthatyoucanprogram,youwillhaveallkindsofquestionsabouthoweverythingworks.Thissectioniswherealotofthosequestionsgetanswered.Icoveralgorithmsanddatastructures,networkprogrammingandcomputerarchitecture.PartV:ProgrammingforProduction.Youwilllearntoprogramforproduction(createcodethatisactuallyusedbyotherpeople).Icoverthesoftwaredevelopmentprocess,testingandbestprogrammingpractices.PartVI:LandaJob.Thefinalsectionisaboutgettingajobasasoftwareengineer,workingonateamandimprovingasaprogrammer.Iprovidetipsonhowtopassatechnicalinterview,workonateamaswellasadviceonhowtofurtherimproveyourskills.Ifyoudon’thaveanyprogrammingexperience,youshouldtrytopracticeprogrammingonyourownasmuchaspossiblebetweeneachsection.Thereareadditionalresourcestoexploreprovidedattheendofeachsection.Don’ttrytoreadthisbooktooquickly.Instead,useitasaguideandpracticeforaslongasyouneedinbetweensections.EndgameFirstThewayIlearnedtoprogramistheoppositeofhowComputerScienceisusuallytaught,andIstructuredthebooktofollowthisapproach.Traditionally,youspendalotoftimelearningtheory;somuchso,thatmanyComputerSciencegraduatescomeoutofschoolnotknowinghowtoprogram.Inhisblog,WhyCan’tProgrammers..Program?,JeffAtwoodwrites:“Likeme,theauthorishavingtroublewiththefactthat199outof200applicantsforeveryprogrammingjobcan’twritecodeatall.Irepeat:theycan’twriteanycodewhatsoever.”ThisledAtwoodtocreatetheFizzBuzzcodingchallenge,aprogramming


Page 10

testusedinprogramminginterviewstoweedoutcandidates.Mostpeoplefailthechallenge,andthat’swhywespendsomuchofthisbooklearningtheskillsyouwilluseinpractice.Don’tworry,wealsolearnhowtopasstheFizzBuzztest.InTheArtofLearning,JoshWaitzkinofSearchingforBobbyFischerfame,describeshowhelearnedhowtoplaychessinreverse.Insteadofstudyingopeningmoves,hestartedlearningtheendgame(wherethereareonlyafewpiecesleftontheboard)first.Thisgavehimabetterunderstandingofthegame,andhewentontowinmanychampionships.Similarly,Ithinkitismoreeffectivetolearntoprogramfirst,thenlearntheorylater,onceyouaredyingtoknowhoweverythingworksunderthehood.ThatiswhyIwaituntilthefourthsectionofthebooktointroduceComputerSciencetheory.Whiletheoryisimportant,itwillbeevenmorevaluableonceyoualreadyhaveprogrammingexperience.TheSelf-taughtAdvantageLearninghowtoprogramoutsideofschoolisincreasinglycommon.A2015StackOverflow(anonlinecommunityofprogrammers)surveyfound48percentofrespondents10didnothaveadegreeincomputerscience.WhenIwashiredateBay,IwasonateamthatincludedprogrammerswithCSdegreesfromStanford,CalandDuke,aswellastwoPhysicsPhD’s.At25,itwasintimidatingtorealizethatmy21-year-oldteammatesknew10timesmoreaboutprogrammingandcomputersciencethanIdid.Asintimidatingasitmightbetoworkwithpeoplewhohavebachelor ’s,master ’sandPhD’sinComputerScience,neverforgetyouhavewhatIliketocallthe“self-taughtadvantage.”Youarenotreadingthisbookbecauseateacherassignedittoyou,youarereadingitbecauseyouhaveadesiretolearn,andwantingtolearnisthebiggestadvantageyoucanhave.WhyYouShouldProgramProgrammingcanhelpyourcareerregardlessofyourprofession.IfyouarereadingthisbookIassumeyouhavealreadydecidedyouwanttolearntoprogram.ButI’mstillgoingtocoverwhyyoushouldtogiveyouextramotivation.Learningtoprogramisempowering.Ilovecomingupwithnewideas,andIalwayshaveanewprojectIwanttoworkon.OnceIlearnedhowtoprogram,Icouldsitdownandbuildmyideaswithoutneedingtofindsomeonetodoitforme.Programmingwillalsomakeyoubebetterateverything.Seriously.Therearen’tmanysubjectsthatdon’tbenefitfromfinelytunedproblem-solvingskills.Recently,IhadtodotheverytedioustaskofsearchingforhousingonCraigslist,andIwasabletowriteaprogram