Thatishelpsusorientastowhatkindoffeaturesofhte e mailherewemightuse.
Nowit's out.
Here, I think, isthefirstopportunityforsomefeedbackonline.
Sixandseven.
Whatperhapsjumpsoutitfolkshere, Wheremighttherebeanopportunitytodothings a littlebitdifferently?
Ifyoulookatthese, you'llseethatEricisusingonline 70 your L to a CDenSoCloudflare, verypopularforhostingCSSfiles, HTMLfiles, Javascriptfilesandthelike, buthe's includedhisownCSSabovethat, whichisnotbadinthiscase, because, aswe'llseein a moment, there's nottoomuchCSSgoingoninthere.
Uhuh, Jeonggiproposesthatit's goodbecausethe J S s orJavascriptisamongthemostheavyfilesandyouwanttoloaditlastsotherestofthesiteloadsfirstheasksanotherquestion.
Uh, thisis a conventionputtingtheJavaScriptcodeatthebottomofyourHTMLfilebecauseifonethecodeislarge, itmightindeedtakemorethan a fewmillisecondstodownload, andthatcanblocktherestofyourWebpagefromactuallyrenderingonthescreen.
Butindeed, weseethatErichasdefined a defaultfaceusingthistruetypefilethatisthefifthofthefilesinthisrepoandspecifiedthathis H onetagshouldhaveletterspacingoffivepixelsandfontfamilyoftriforce.
You'rejustgivingupcontrolovertheaestheticsunnecessarilyandindeedSothisis a codereviewforthoseofyouhavejusttunedin, we'vesolicitedcodefromfolksby a CS 50 dot l y slashcodereview.
Wejusttook a lookatthefirstexamplefrom N a.
C L Ericongethopeherewehave a fewmorethatwe'regonnatake a lookat.
I personallywouldprobablypullitupontothesamelinesothat I couldjustreadthingslefttorighttoptobottom, Butagainteachhisorherownhere, let's scrolldownhere.
Interestingthatwehadseemedtohave.
Thecommentsareswitchingbetweenwhat I gatherSpanishandEnglish.
I personallyfind a littlehardertoreadandmightprefertousevariableinterpellationwherebyyouactuallyusedoublequotesaroundyourstringandyouactuallyhaveyourdollarsignvariableinsideofthat, doublequotedString, anditwilljustgetinterpolated, sotospeak, thatisreplacedwiththeactualvalue.
Ofcourse, Michaelseemstobeusing a functioncallhere, andyoucan't dothattrickinquitethesameway.
Butthat's fineaswell.
It's just a differentapproach, justkindofhardtoreadtheformat, I thinkwhenit's brokenout a littlebitlikethis, sothismakesme a littlenervousandwouldhavetolookatthecodemorecloselytoseeifthisisindeed a problem.
Butitlookslikethiscodeisexecutive, somaybethat's actuallyexecuting a processcalledtokenIsardotPHP.
A PHPscriptintheBINdirectoryandthenanothershellscript, itseemscalledtextcompareearthdotShh.
A tokenizeristypically a programthat, uh, chopsup a streamoftextintowhatarecalledtokens, whichmightbeindividuallettersorwordsorsortofmeaningfulgrammaticalunits.
YoumighttokeneyesanEnglishsentenceintoyourindividualwords, forinstance, butinprogramming, we, ofcourse, havesomuchmoresomanymoresymbols, sotokeneyesmeansThioreturnedtoyouoneat a time.
Andhereistheessenceoftheprogramthat I'm a littlecontrarytoseeanotherjacktokenIsardotPHP.
I wonderifoneofthosereallyshouldhavebeenwiththeother.
I'm notsure.
Solet's take a lookatmaindotPHP, right?
Becauseintheabsenceofnotknowingwheretolook, lookforsomefamiliarphrasesindexdothtmlmaindotPHPoranythingsuggestingthatthisisanentrypoint, so I'llgoaheadanddiveintomaindotPHP.
Hereyou'llseethisconventionofunderscoreUnderscoreconstruct, whichisPHPisapproachto a constructorfunction.
YoumightrecalltheinitsmethodinPython, whichisverysimilarinspirit, ortheconstructorsthat C plusplusandotherlanguageshave.
Scrollingdownherewoulddefinitelylovesomesomecomments, but I thinkwecouldinferfromthiswhat's goingon, although I seeOh, thismightbePortugueseinsteadperhapslookslikeareexceptionsarealternatingbetweenEnglishandthatPortugueseeso, justaswesawwiththecommentsearlier.
Solet's seeifwecan't wrapyourmindaroundthisSoagain, I thinkit's justthematiclike I'm findingthecodetobeprettycleanoverall.
Thathelps, ofcourse, that I know a bitofPHP, but I thinkdefinitelysomecommentingatthispointaswell.
Sowhat, rightdidn't gothrougheverysinglefile?
Because I'm notsurewe'refindingparticularlytroublingtrendsoranythinglikethat.
Whydon't wegivethisone a goodthumbsup?
And, Colton, ifyouwouldn't mindsharinginthechatifwehaven't already, shallwetake a lookatsomethingcompletelydifferentandgettingalongway?
Andagain, asalways, takeourownthoughtswith a grainofsalt.
Thetruthcanease.
Asksis a goodpracticetohaveatleastonecommentatthebeginningof a filedescribingwhatitdoes.
Nomatterthefileprogramlength, I wouldsay, probablynotgoingtosayyestoabsolutelyeverything, especiallyifit's a configurationfileorsomethingthat's ratherselfexplanatory.
Butyes, I think, atleastcertainlyifyou'remakingyourcoatopensource.
Ifyou'resharingitwith a colleagueor a friend, ifyou'resubmittingitto a coursefor a teachertoreview.
I mean, anythingthathelpsthehumanfocusontheinterestingworkthatyoudidwithouthavingtowraptheirmindaroundwhatwastheproblemyouwereevensolving?
Here, I seemtobegettingthelocaltimeandstoringitinsystemtimeDateandtheniteratingoverthissystemtimedatestructureinordertogetatvariousfields.
So I think a fewcommentshere, itlookslikewe'resettingourselvesuptousewhat's called a pseudorandomnumbergeneratorsomefunctionthat's goingtogiveusrandomnumbersagainandagainandagainandagain, usingsomeuniformeddistributionofvaluesbetween, typicallysomelowerboundandsomeupperbound.
I sayit's pseudorandom, though, becauseifyou'vetakenCS 50 orsomeotherclassorreaduponpseudorandomnumbers, you'llknowthatcomputerscan't reallyberandom, right.
Theycouldbeprogrammedtodowhatyousay, buttheycan't beprogrammedtojustthinkof a numberoffthetopoftheirheadlikewehumanscan.
Soyouactuallyhavetowrite a programtogeneraterandomnumbers.
Sothisis a programsomehowrelatedtocards, andifyou'refamiliarwith a deckofcards, theyhavespades, diamondclubsandhearts, thoseinthedifferentpicturesthatareoneachofthecards.
Herewehave a niceutilizationofUnicode.
ThesecharactersdoactuallyexistinUnicode, soeventhoughyoumightnotthinkyoucandothis, youcanactuallyhaveUnicodecharactersinyourcodethesedays, assumingyourinterpreterorcompilersupportsit, whichitshouldthesedaysyoucanevenhaveemojis, butthat's a wholecanofwormsthatwewon't opentoday.
Hereweseeanotherlistinpythondeclaringallofthevaluesthatcardscanhaveon a for a CEthan 234 allthewaythrough 10 thanJack, thenqueen, thenking.
Wehave a bunchofloopsnowtobuild a prettyDEC, andbythat I takeittomeanthatthere's gonnabestringsinsideoftheselists, likesuchandsuch a suitwiththissuchandsuchvalue, somoreof a ah, humanfriendly, Englishlikedescriptionoffthatcard, asopposedtojust a ortwoorthreeorsoforthhere, though, isanopportunity, I think, stylisticallyorevendesignwisetofactorthisout.
Itseems a littleweirdthatwe'restillintheconfinesofthismainprogram.
We'vecreated a coupleoflists.
Nowwe'rehavethecodetofillthoselists.
Itfeelslikethisis a niceopportunityforabstraction.
Giveme a functionthatreturns a listwithallofthesevalues, ordoitinmaybe a classes.
Soifyouweren't a factorthisoutintoseparatefunctionstogeneratetheshuffledeckandthesehumanfriendlystrings, frankly, youcouldcommentevenmore, I wouldsay I thinktheriskthatyou'reidentifyingisthatwhenallofyourcodeistogetherlikeitisinthisonefileatthemomentthosecommentsjustpushandpushandpushthecodedownanddownanddownsoonofhavingmorecommentsthancode.
Andit's just a littlehardertowrapyourmindaroundit.
So D M SMTPhighfromIndiaoneAMhereinCambridge, Massachusetts, USA.
It's about 3 p.m. Intheafternoon.
Allright.
I thinkthatleavesuswithonemoreprogramtodiveintohere.
Let's take a lookatwhatwe'vegotintheformofthisRedditwallpaperbotswillgoaheadandpacethelinktothisinthechat.
Ifyou'd liketofollowalong, someofyoumightlikemespend a littletoomuchtimeonRedditreadingorwritinginthiscasehere, wehave a submissionthat's gonnadothefollowing.
It's a P I ke, essentially a client's ideainclientsecretsothatthiscodecanmasqueradeasyouletmecautionthatyoushouldnotjustgousinganyoldcodeontheInternet, includingcodethatwe'retaking a lookatherebecausetheseairliverepositoriestheycanchangeovertimeandnottoimpunityofourkindvolunteerstoday.
Butyoushouldalwaysbe.
WediscussandCS 50 a littlebitskepticalofanycodesomeone's justputontheInternetorencouragingyoutorun.
Youprobablywantatleastskimthroughitandmakesureitseemstodowhatitsaysanddoesn't haveanyscaryremoveALSor e mails, fansorsomethinglikethat.
Boughtasbest I cantell, I likethissomeverycleanimportsatthetophere, andadditionalimportsthatis, uh, probablyincludedinourrequirementsDOTtextseparatedfromtheonesthatpresumablycomewithpythonbought.
Meanwhile, isseparatedby a whitespacetomake a littlemoreclearthatit's notliketheothers.
It's indeedinthesamedirectory, a modulecalledboughtdotpie.
Itlookslikethere's somekindof a P I callherethat's goingtogetthepicturepostbasedonhotness, sortingbyhotlikewhatarethemostpeoplelookingatupvoting, clickingonandsoforth?
Itseemsthatthisunderlyingclient p wroughtoutreadyExcuseme, thelibrarythatwe'reusingtoactuallyconnecttoreaditsbackendandthrowcertainexceptionsclientexceptions.
I believewe'relookingfortheactualimageinquestionandyouhearmyvoiceslowingdownbecausenowthisisthefirsttimeinthiswholecodebasewhere I'm reallystartingtotrytofigurethisout.
I wouldreallyloveoneormorecommentshere, especiallytohelpmeunderstandwhenmaybeeachoftheseerrorsmighthappen, although I dosee a commenter.
Sohereweweregoingdoingso.
Wellupuntilthatpoint, I dothink I certainlywouldbenefitfrom a littlebitofexplanationastowhat's goingonherejustbecauseeventhough I couldfigureitout, it's gonnatakemesomuchtimetojustreadthrougheveryindividuallinewhenatthispointinthestory, really, I'm justtryingtoget a senseofthings.
Butcodewise, everything's verynicelycleaned.
Noticedthatthisis a verycleanapproachtowriting.
Andifconditionthatactuallyhasmultiplesentiments, um, this I couldgoeitherwayon I noticedthatyou'veputtheand, uh, keywordsatthebeginningsofthesentence.
Itmightbe a littlecleanertomovethosetotheendofthepreviousline.
Thisway, eachofthethreeBooleanexpressionsyou'reaskingahwilllineupontheleftbutthat's a
Hello, world.
Subtitles and vocabulary
Click the word to look it upClick the word to find further inforamtion about it