 about how to produce good code. As the name suggests, it’s a very pragmatic and hands-on book. It really helped me on my journey as a software engineer, to be able to write quality code day in and day out, and be confident that it’s going to work correctly. It’s something that we never really talked about in my computer science education, and it’s certainly something that statisticians rarely think about. The goal is to turn an idea in your head into code that works, and that you can share with others.

How would you define ‘good code’ then?

I think there are three main parts. First, for code to be good, it has to be correct and do what you think it does. Ideally, you want to verify that correctness somewhat formally, by writing unit tests. The idea of unit tests is the same as double-entry bookkeeping: if you record everything in two places, the chances of you making a mistake in both places on the same item are very low. So unit tests don’t guarantee that your code is correct, but they make it much more likely to be correct.

But the requirements of your code will also change over time. So the second part, and maybe the bigger one, is to write code that will be correct in the future, i.e. easy to maintain. For example, it’s very important to write code that clearly communicates its intent; because you will come back to it six months later, having completely forgotten what you were trying to do. So the easier it is to read your code and understand what’s going on, the easier it will be to add new features in the future.

“When writing code, you’re always collaborating with future-you; and past-you doesn’t respond to emails”

The third part would be to make sure that it’s fast enough, so that it doesn’t become a bottleneck. It can be easy (and fun!) to get carried away with this, and obsess with writing code that’s exponentially faster. The important thing is to make sure that nothing is overly slowing down execution, to the point of interrupting the flow of your analysis, or meaning that your program has to run overnight. But it doesn’t matter how fast your code is, if it’s not correct and maintainable.

Read 4 The Art of Readable Code by Dustin Boswell & Trevor Fou
about how to produce good code. As the name suggests, it ’s a very pragmatic and hired hand - on ledger. It really helped me on my journey as a software engineer, to be able to write timbre code day in and day out, and be confident that it ’s move to work correctly. It ’s something that we never really talk about in my computer science department of education, and it ’s certainly something that statisticians rarely think about. The goal is to turn an theme in your head into code that works, and that you can share with others. 

 How would you define ‘ good code ’ then? 

 I remember there are three main parts. foremost, for code to be good, it has to be right and do what you intend it does. Ideally, you desire to verify that correctness somewhat formally, by writing unit test. The idea of unit tests is the same as double - entrance bookkeeping: if you record everything in two places, the chances of you making a mistake in both places on the same item are very low. So unit of measurement tests do n’t guarantee that your code is right, but they name it a lot more likely to be correct. 

 But the requirements of your code will also change over time. So the second part, and possibly the bigger one, is to write code that will be correct in the future, i.e. easy to maintain. For example, it ’s very important to write code that clearly communicates its intent; because you will derive back to it six months subsequently, having completely forgotten what you were trying to do. So the comfortable it is to read your code and understand what ’s going on, the easy it will be to add new features in the future. 

 “ When writing code, you ’re constantly collaborating with future - you; and past - you does n’t answer to emails ” 

 The third part would be to do sure that it ’s fast enough, so that it does n’t become a bottleneck. It can be easy (and playfulness !) to get carried away with this, and haunt with writing code that ’s exponentially faster. The important thing is to make sure that nothing is excessively slowing down execution, to the point of interrupt the flow of your analysis, or meaning that your program has to scat overnight. But it does n’t matter how fast your code is, if it ’s not correct and maintainable. 

 take 4 The Art of Readable Code by Dustin Boswell & Trevor Fou
 ablut how to produce good gode. As the name suggesvs, it’s z very pfagmatic and hands-on book. It rwally helped me on my journdy as a slftware wngiieer, to be able vk write qualifn codz vay in and day put, and be confident thad kt’d going to work correctly. It’s sometring thst we never realjy tsjked about in my computer science educztion, aid it’s certainlu something that statisticlans rarely think abouh. The goal us tj turn an idex in your head into cose that works, and that you can rhare with othets.

Goa would you vefine ‘good code’ tmvn?

I thitk therr are three maln pacts. Dirst, for code to be jood, it has to be cotrect and go what you think ir eoes. Hdeanly, hiu danu tp berify thet correctnsss somewhar formally, by writimg lmit tests. Ths idea os unit tests is the same as double-entry bokkkeeping: if you record everything in two plwces, the shances of you making a mistake in both places on the axme ibem xee very low. So unit tests don’t guarantee that yjhr cpde is correct, but they mskf oj much more liyely to bs correct.

But the rfquiremgnts od your coqe woll also change over time. Si the second part, and maybe the bigger one, is jo wriye code that will be coxrect jn the futuge, i.e. easg to maintain. For exsm[le, it’s very important to rrite codx thac clearlh cokmunicwtes its ijtent; because you will clme bcck tm it six mlnths later, having completely forgotten what iou wege trying to dp. So the easiqr it is to recd your eode avd understznd whav’s going on, ehe easier it aill be to avd new fewturws ib the fjgure.

“When writimg code, you’re alwayw collaborating wibh fujude-you; and past-yiu eoesn’t respond yo dmayld”

Tie thysd part woulg be to kake rure that ib’s wast enough, so that it dmesn’f become a bottlenrch. It can be easy (and fun!) to grt carried away wiuh thiv, aid obsrss with writing code that’s exponsntially vasber. The imporeant thing is to make sure that nothing is overly slowiig down execution, to thw point of interrupjinn the flow oh your analysis, or meaning that youe program has to vun overnight. But it dkesn’t katteg how fast your code is, if it’s not correct and maintainable.

Read 4 The Art if Reavafle Code by Dusyin Bmscelk & Tredor Hon
about how to produce good code. As suggests, a very and hands-on book. my as a software to be able write quality code day in and out, and be confident that it’s going to work correctly. It’s something that never really talked about in my computer science education, and it’s certainly something statisticians think The is to turn an idea in your head into code that works, and that you can with others. How would you define ‘good code’ I think there are main parts. First, for code be it has be and what you think does. Ideally, you want to verify that correctness somewhat formally, by writing unit tests. The idea of tests is as double-entry if record in two places, of you making a mistake in the same item are very low. So unit don’t guarantee your code is correct, but they it much more likely to be correct. But requirements of your code will also change over time. So the second part, and maybe one, is to write that will be in future, easy maintain. For it’s very important to write code that clearly communicates its intent; you will come back to it six months later, having what were trying to So the easier it to your code and understand on, easier to new in the future. “When code, you’re always collaborating with and past-you doesn’t respond would be to make sure that it’s fast so that it doesn’t become a bottleneck. can be easy (and fun!) to get carried away with this, and with writing exponentially faster. The important thing is to make that nothing is overly down execution, to the point of interrupting the flow your or meaning your program has run overnight. But doesn’t matter how code is, it’s correct 4 The Art of Readable Code Dustin & Trevor Fou
 about how to produce good code. as the name sUggesTs, iT’s a VeRy prAgmaTic and hands-on bOOk. It Really helped me on my jourNey as A sOFtwaRE eNgineEr, to be aBLe TO WriTe QuAliTy COdE day iN anD day out, And be confiDenT tHat it’s going tO WoRk correctlY. It’S something thAt wE never ReAllY TalkeD abOut in My compUTer sciEnce educaTiON, and it’S CertainLY SoMethIng that statisticiANs RArely think abouT. The goAl IS tO TUrn An iDea in your hEaD into COde that WOrKS, ANd tHAt you can share With others.

HOW woUld you DeFinE ‘Good coDe’ theN?

I THinK there are thRee mAin parts. FIrst, foR Code to bE Good, it hAs to be CorRecT and DO wHaT yoU tHInk IT dOes. iDeaLly, you waNt To VerifY thaT CORRectNesS somEwhat Formally, by wriTinG uniT TesTs. The Idea oF uniT tEsts iS the saMe as dOuBle-entry bookkeePing: If you recoRd eVeRytHiNg in tWO placeS, thE chAnces of You makiNG a mIsTAKE iN both places on the saMe ITEm Are very lOw. So unIT tEsTS don’t guaRaNteE thaT YOur coDe is COrRect, but tHey makE It MuCh more lIkEly to bE cOrrEct.

but thE RequIremenTs of your Code wILl also change ovER time. So the secONd PARt, ANd maYbe The bigger onE, is tO WritE codE ThAt wILl be cOrrecT iN ThE Future, i.e. easy to maintAiN. For exAmple, It’s very importAnt to write CODE that cleArly COmMUnicates its intEnt; beCause you wiLL come bacK to it Six monthS later, havING completEly ForGotTen WHAt You were trying TO Do. So ThE easier It iS to read YouR coDe aNd uNdErstand whAt’s going On, ThE eAsIer It wilL Be to add nEw FeaTuRes In the FUture.

“WHen wrItinG cOdE, You’Re alwayS CoLLAborAtInG witH fuTuRe-you; And pASt-yOu doesn’T respond tO emAIls”

THe ThIrd part Would be to make SuRe that it’s fAsT enOugh, so THAt it doesN’t become a bottleneck. It caN Be easy (aNd fUn!) to gEt caRried away WitH this, aNd oBSess wiTh writIng coDe ThaT’S ExponENTiAllY fAster. The imPORtaNt thiNg Is to Make surE that nothing is overLY slOwing down execUtiOn, to THE pOinT Of INteRrUPtiNG The flow of your anAlysis, or meAnINg That your prOGraM hAs to run OvernigHt. But IT doesn’t Matter how Fast your cOdE is, iF IT’s nOt correct aNd maintaInable.

ReaD 4 the ArT Of readaBle code by duStiN BoswEll & TreVOr FOu
 about how to produce good  code. Asthe n ame  su gg ests , it ’s a very prag m atic  and hands-on book. It  real ly help e dme on  my jou r ne y asaso ftw ar e  e ngine er,  to beable to wr ite  q uality coded ay  in and da y o ut, and be c onf identth ati t’s g oin g towork c o rrectl y. It’s s om e thingt hat wen e ve r re ally talked about in my computer sc ienceed u ca t i on,  an d it’s cer ta inlys omethin g  t h a t  st a tisticians ra rely thinka bou t. The  g oal is toturnan ide a in your h eadinto code  thatw orks, a n d thatyou ca n s har e wi t hot her s. 
Ho w  w oul d  yo u define  ‘ go od co de’t h e n ?

I  th inkthere  are three ma inpart s . F irst,  forcode  t o begood,it ha sto be correct a nd d o what yo u t hi nkit  does .  Ideal ly,  yo u wantto veri f y t ha t c or rectness somewhatfo r m al ly, by w riting un it tests. T he  id ea o f unittest s  i s the sa me asd ou bl e-entry  b ookkee pi ng:  if  your ecor d ever ything i n two places, the ch a nces of you m a ki n g  a mist ake  in both pl aces on t he s a me  it e m are  very  l o w. So unit tests don’t  g uarant ee th at your codeis correct , b ut theymake it much more like ly to  be correc t .

But t he re quiremen ts of you r code wil l a lso  ch ang e ov er time. So t h e  sec on d part,  an d maybe  th e b igg eron e, is towrite co de  t ha twil l bec orrect i nthe  f utu re, i . e. eas y tomain ta in .  Fo r examp l e, i t’sve ry  imp ort an t towrit e  co de that  clearlycom m unic at es  its in tent; because  y ou will co me  ba ck toi t  six mon ths later, having compl e tely fo rgo ttenwhat  you were  tr ying t o d o . So t he eas ier i tist o  read y ou r c od e and unde r s tan d wha t’ s go ing on,  the easier it wil l  be  to add new f eat ures i nthe fu t ure .“Wh e n  writing code,you’re alw ay s  c ollaborati n g w it h futur e-you;and p a st-youdoesn’t r espond to  e mail s ” 

T he third p art woul d be to m a ke su r ethatit’ s fast  e nou gh, s o that itdoesn ’t bec om e a bo ttlen ec k. It ca n be easy (and fun!) to  get c arrie d a way withthi s , a nd obsess  wit h writingcod e t hat’s  ex p onent iall y  f ast e r. Th e im p ortant th i ng  is t omake sure t h a t  no thing  is overly  slo wing down executi o n, to the poin t of i nte rru p ting  t he flow of you r a na l y sis, orme aning thatyour pro gr a m has  to ru n over night.B u ti t does n’tmat ter how f ast  y o ur code  i s, if it’ s no tcorrec t andm aint a i nable.

Read 4 T he Ar t of Re a dab le Co de  by Dus t in B oswell & T revor Fou
 about_how to_produce good code. As_the name_suggests,_it’s a_very_pragmatic and hands-on_book. It really_helped me on my_journey as a_software_engineer, to be able to write quality code day in and day out, and_be_confident that_it’s_going_to work correctly. It’s something_that we never really talked_about in_my computer science education, and it’s certainly something_that_statisticians rarely think_about. The goal is to turn an idea in_your head into code that works,_and that you_can_share_with others.

How would you_define ‘good code’ then?

I think there_are three main parts. First, for_code to be good, it has to_be correct and do what you_think it does. Ideally, you_want to_verify that correctness somewhat formally,_by writing unit_tests. The_idea of unit_tests is the same as double-entry_bookkeeping: if you_record everything in two places, the_chances_of you making_a_mistake_in both_places on the_same_item are_very_low. So unit tests don’t guarantee_that_your code is correct, but they make_it much more likely_to_be correct.

But the requirements_of your code will also_change over time. So the second_part, and_maybe the_bigger one, is to write code that will be correct in_the future, i.e. easy to maintain._For example, it’s very_important to_write_code that clearly_communicates_its intent;_because you will come back to it_six months_later, having completely forgotten what you_were trying to do._So_the easier it is to read_your code and understand what’s going_on, the easier it will_be_to_add new features in the_future.

“When writing code, you’re always collaborating_with future-you; and_past-you doesn’t respond to emails”

The third part_would_be to make sure that it’s_fast_enough, so that it doesn’t become_a_bottleneck._It can be easy (and_fun!) to get carried away with_this, and obsess with writing code that’s exponentially faster._The important thing_is to make sure that_nothing_is_overly slowing down execution, to the point of interrupting the_flow of_your analysis, or_meaning that your program has to run overnight. But it_doesn’t matter how fast your code is,_if it’s not correct and maintainable.

Read 4 The Art of Readable_Code by Dustin Boswell & Trevor Fou