Intheprocessofwriting a comment, youcanoftenfindthingsthatcouldbewrittenbetter, butit's notaneitheror.
I mightstillbeabletorewritethatcommenttobemoreselfdocumentingandalsowrite a commentaswellforthefollowingreason.
Coatcandescribehow, butitcannotexplainwhynow.
Thisisn't a newpremiseatall, butit's a commonthemethat I seeandhelpfulcommentsthat I'vecomeacrosstheabilitytocommunicatesomethingthatcodecan't orcan't precisely.
Andallofthatsaid, there's notjustonewayorrightarecorrectwaytowrite a comment.
I believethatourcollectivediscourseaboutcodecommentsisfartooshallow.
I'vewrittencodethatneedssomethinglikethis, andinordertoavoidanothermaintainerorfuturemeassuming I tooksomemushroomsonthewaytowork, it's greattotellpeoplewhatthehecklet's for, especiallyinpreparationfor a timewhenyounolongerneedit.
Youhave a largerspreadofexpertisewhenyouhave a teamthatlookslikethisorsayyougetjuniordevelopersonyourprojectonbiggerteams, whereyouhave a lotofjuniordevelopersandengineersfromalltypesofbackgrounds, peoplemightnotoutrighttellyouthattheyneedyoutocomment, but a lotoftimesthey'llexpressgratitude.
Whenyoudo, commentscouldbelikechaptersof a book.
Ifyouthinkof a book, it's thesameamountofinformation, whetheryouhaveparagraphsorchaptersorindexes.
Itsaidthat 30% oftime a developerstimeisspentwritingcodeand 70% isspentreadingcode.
Mysuggestionwouldbetospend a momentafteryouthinkyou'redonewith a projectinreviewwithcommentingeligibilityinmind.
And I'llevensubmit P ourstomyselfwhen I workalone.
I workaloneon a lotofopensourceprojects.
I learnedthisfromStacyCoveringMo, anditreallyhelpsmelookevaluatethatcodefrom a newfromneweyes.
I writeitasthepersonwhoisjusttryingtogetthisstuffdone.
Andthenwhen I submitthePRtomyself, I readitas a maintainerandsomeonewhohastomaintainthecode.
Later, I encouragedthispractice.
Morethanonethingcanbetrueat a timepeopletendtogetononesideortheotherofwhetherornotyoushouldwritecomments.
But I wouldarguethattheconversationisn't reallynuancedenough.
Whynotboth?
Hopefully, openingthefloorto a deeperconversationaboutthiscanhelpyouhaverightmoremeaningfulcommentsandbridgesthegap.
Evenso, itcouldbe a lottoparsegoodhearts.
Anyway, I'llleaveyouwithsomebetterhumor.
Ah, whilebacktherewas a stackoverflowpostwherepeoplewrotethebestcommentsthattheyhaveeverseen.
Youcoulddefinitelywastesometimeinhere.
Here's somehere.
Someofthemthat I thoughtwerereallygoodwhen I wrotethisonlyGodand I understoodwhat I wasdoing.
NowonlyGodknows I dedicateallthiscodeallmyworktomywife, Darlene, whowillhavetosupportmeandourthreeChildreninthedogonceitgetsreleasedintodrunkFixedlater.
Firstofimagesaredeletedby G.
D.
I.
Plussecondof I'm notsureaboutthat.
Somedevilonaddingtemporarytrackingoflockinscreen.
Fiveyearslater, I'llleaveyouwiththisexamplethat I particularlylikefromKellyvon.