Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Readable Code

John Papa
August 09, 2014

Readable Code

The positive impact authoring readable code can have on your career can be huge. There are some simple techniques you can use to create more readable code that can improve your efficiency and make it easier for your code to be supported across teams. Clean Code is popular and Readable Code takes a look at these concepts in a different light and gives you actionable items to improve your code today. Learn how to make Readable Code by using some of the techniques such as separation of concerns, above the fold, the LIFT principles, commenting, encapsulation, and many more! Is your code readable?

John Papa

August 09, 2014
Tweet

More Decks by John Papa

Other Decks in Technology

Transcript

  1. READABLE  CODE   @john_papa   HOW  FAST  CAN  YOU  READ

      YOUR  CODE  ? JOHN  PAPA   @JOHN_PAPA
  2. READABLE  CODE   @john_papa   “     How  can

     you  enhance  code  if  you  can’t  read  it?   ”    
  3. READABLE  CODE   @john_papa   “     It’s  harder

     to  read  code  than  to  write  it.   ”     -­‐  Joel  Spolsky   But  Why?
  4. READABLE  CODE   @john_papa   “     It’s  not

     about  clever,  craHy,  arIul,  preJy  code.     It’s  about  fast  and  effecLve  communicaLon  and   code  quality.   ”     What’s  it  all  About?
  5. READABLE  CODE   @john_papa   Who  Cares  for  the  Developer

     Behind  You? “     ”     Caring  about  your  craH  is  a  good  thing.  Caring  about   the  what  happens  aHer  you  deploy  your  code  is   beauLful.  
  6. READABLE  CODE   @john_papa   What’s  Your  MoKvaKon? Time  

    ProducLvity   Cost  of  a  Complete  Mess  
  7. READABLE  CODE   @john_papa   “     ”  

        YOUR  BOSS  WON’T  LIKE  THAT  
  8. READABLE  CODE   @john_papa   “     Deploy  faster,

     spend  less,  re-­‐use  more,     and  maintain  high  quality.     ”    
  9. READABLE  CODE   @john_papa   Who  is  Code  Intended  For?

    Programs  must  be  wriJen  for  people  to  read,  and   only  incidentally  for  machines  to  execute.   -­‐  Abelson  &  Sussman,  Structure  and  Interpreta9on  of  Computer  Programs   “     ”    
  10. READABLE  CODE   @john_papa   “     Most  important

     code  is  instantly  visible   ”     Above  the  Fold
  11. READABLE  CODE   @john_papa   “     Less  than

     20  lines  of  code   ”     Small  FuncKons  Are  Readable
  12. READABLE  CODE   @john_papa   MISSSPELINGS  ARE  IMPORTANT   “

        What  will  you  find  when  you  search  for  your  code?   ”    
  13. READABLE  CODE   @john_papa   “     People  who

     maintain  code  lack  the  author’s  context   ”     CONTEXT  ===  CLARITY  
  14. READABLE  CODE   @john_papa   Comments  are  noise  when  …

    Outdated  and  incorrect   Shoulda  coulda  used  a  variable  or  funcLon   Redundant  
  15. READABLE  CODE   @john_papa   Comments  are  awesome  when  …

    Warnings  of  Consequences   API  DocumentaLon   TODO’s  
  16. READABLE  CODE   @john_papa   How  Readable  Is  My  Code?

    LocaLng  our  code  is  easy   IdenLfy  code  at  a  glance   Flat  structure  as  long  as  we  can   Try  to  stay  DRY   L   I   F   T  
  17. READABLE  CODE   @john_papa   “     Clean  code

     is  the  secret  to     your  applicaLon’s  long  and  healthy  life   ”    
  18. READABLE  CODE   @john_papa   Nothing  Starts  Readable “  

      Write  dirty  code,  then  clean  it   ”