Andhonestly, I thinkwekindofblewtheirmindsonHowcoolisthisshitactuallyiscomparedtowhattheywerelearningon, butyeah, I reallywanttoencouragepeoplethiotodoasmanyofthesekindsofprogramsisasyoucanbecauseit's incrediblyrewardingandalsoinspirationalbecausethiswasoneoftheinspirationsforthistalk.
HavingworkedwithJuniorDebsquite a lot.
It's oneofthesethingsthat I'venoticedisistheyreallystrugglewithdebugging, and I thinkthat's kindofbecausewedon't reallyteachitas a skill.
It's easytoforgetthatit's a difficultskillthatit's It's somethingthatyouneedtomasterinordertobecome a reallyexperiencedeveloper, andit's learnedovertimeandimprovewithexperience.
Andsointhetalk, I won't gointothedetailofhowimportantitistoreproducethebug.
Bemethodical, onlychangedonethingat a timehad a narrowdownwherethebuggers.
Butit's surprisinghowoftenthisstuffisnottalk.
Soifyou're a juniordeveloperoryou'reteachingjuniordevelopers, I hopeyou'reoneofeitherthatthesetwothings.
Um, yeah, I dospendthetimereallylookingintothisstuffwiththem.
Sothereisonestepthat I dowannacoverreallyquicklybecauseeventhemostseniordevelopers I'veworkedwithandincludingmyself, sometimes I forgettowritetestslikethisisthefirstthingthatyoudo, right.
Ifyou'vediscovered a bug, right, Otis, thatreproducesitbecauseitnotonlywillkeepyourfocusonjustthatonebug.
Butyoualsogetthevariablecontext, soit's mucheasiertoseeat a glancewhatyou'relugging.
Itcouldbereallyuseful, especiallywhenyou'relogging a lotofdifferentthingsinyourapplication, andyoucanalsoreallyaddeasily.
AddstylingtoyourlocksbyincludingthispercentageCyan C atthebeginningandthenpassingthroughsomestylingasthesecondparameter, youcangetreallyprettycallous, sostickingtotheconsulfornow.
Didyouknowthatthereareactually a wholebunchofdifferent, wellmethodsonthatobject?
I'm gonnashowyoumyfavorites, butGooglingwillreveal a hellof a lotmore.
Forinstance, consoletableissuperusefulifyouwanttologoutanarrayofobjects, sohereyoucanseeit's mucheasiertokindofcompareat a glancethedifferentvaluesandnextwehaveconsolegroup, whichiswhen I don't knowaboutyou.
Buthaveyoueveratifitendedupaddingsomanylogsinyourapplicationthatyoucan't tellwhichwastheonethatyoujustaddedwellgroupandgroupcollapse A reallyusefulforstructuringyourlogsintocollapsiblegroups, creatinglessnoiseintheconsoleforyoutoanalyze, whichisreallythekindofgame.
Umandsoinhere, I added a consultraceonthishandlefilterclickfunctiontofigureoutwhatwascallingit, andyoucanseethatit's nowtellingmethatitwascoolbyHandelClockinfilteredOutGaiusandConsoleDoctorisgreatwhenyouwanttoinspect a domnoteas a JavaScriptobjectratherthanasitsmarkup, whichiswhatconcertlogreturnsyou.
Theslitsuspreventthe D buggerfromsteppingintocertainscriptswhenwe'redebatingcode.
Sohere I wasdebugging a reactionlifecyclefunction, and I jumpedintotheReactDomlibrary.
I couldbeprettysurethatmybugisnotinthereactonlibrary, so I blackboxthescriptandthisway, nexttime I steppedthroughinto a functionthatcomesfromthisfilethedebate.
Youwillsimplyignoreit, and I canfocusonmyapplicationcode.
IfyoupressthisshortcutwhenJavaScript, asexecutingitwilladd a breakpointtothecodestraightawayandstopitexecuting, you'llbeabletoinstantlyseewhatishappeningthemomentyoupressthatshortcut.
Andyoucanalsonotaddlogpointsandcrimedeathtolls, whichisessentially a consolelogthatyoudon't havetoremembertodeletefromyourcoat.
The D beggarwantpawsonthesepoints, butyou'llstillgettheresultsintheconsole.
Whensomethinginyourcodeneedstorespondto a windowwithorscrollposition, forexample, you'llbeabletoseeitupdateasyouscrolldowntheside.
Sowhataboutwhenyouwanttoactuallytestsomeofyourbugfixinghypotheseswhile a reallygreatfeatureincrimehascooledlocaloverrides, Soherewegotothesourcespanelandgotoeoveritsandwecansetthemupbyselecting a folderon, inthiscase, mydiscountclinic.
Sowhathappenswhenyouwanttogofurtherandmakebiggerchangesthatyouknow, I onlywanttopersistonbrowserRefresh, butpersisttoyourownprojectfilesittinglocallyonyourcomputer, whilethedetailsalsohave a reallyinterestingfeaturecalledworkspaces.
Sohere's a littleapp I madeforcalculatinginsulindosagefordiabetics.
Andif I saythatandgotomyidea, youcanseethatthefileitselfhasbeenupdatedand I canalsogobacktheotherway.
So I'm gonnaaddeveryonehereandseethatit's persistedheretothedifftools.
Thiscouldbesuperuseful, reallypowerful, andinfact, forsomepeople, itallowsthemtousejustthedifftoolsdebuggeras a sorrydeftoolsAstheidea, however, itcanbe a littleflaky, andit's stillnotasgoodas a full I D.
Butifyouhave a projectthatyoubuiltwith, create, reactuporviewsoyouseeAlly, forexample, youcanactuallyjustdragtheentirefolderontothesourcespanel, andit's allsetupforyou.
Soifyoulikethisideaofbeingabletoassistchangesonyourproductionwebsite, there's onelastway I wanttoshowyou.
Thisistheconceptofproxyingyourproductionfilestolocalfilesonyourharddrive, similartoworkspacesbutwithoutthedifftools, persistencebutwith a lotmoreotherfeaturesthatbettersupportcomplicatedbuildsystems.
Thesimplestis a crimeextension.
Cordresultsoverit.
Sosayyouhave a versionofyourapplicationrunningonlocalhost.
Well, I am a bigbelieverindoingthis, becauseproductionbugsiswhenyoureallywanttoknowwhat's goingon, you'rein a hurryandyouwanttodecipherthecodeprettyquickly.
Andifyou'rereallyworriedaboutpeoplebeingabletolookatyoursourcecodeandunmodified, andkeepinmindthatsecuritythroughobscurityisnever a goodidea, thenthere's a prettystraightforwardsolution.
SohereyoucanindicateintheJavaScriptfile a source.
A sourcemappingeuroconfigurablewithIpekthatpointstothesourcemapthat's beenuploadedto a differentlocation, sayonethat's onlyaccessiblebyyourteam.
Somovingonnowit's a performancedebugging, and I donothavetimetodoitjustice, becausethereissomuchyoucanlearnabouthere, andit's easilyanotherentiretalk.
But I wantedtoquicklyillustratewhereyoucouldstart, andthekeyistofindthecodethatyouwroteright, Sotheseflameshotstobe a littlebitindecipherableuntilyouactuallyfigureoutwhereyourcodeis.