Howreadable

 Howreadable

A lightening talk explaining the motivation behind our "howreadable" experiment and encouraging participation.

Please take at https://howreadable.com

1a93f6606abdcf0ec6a850df9e4b830d?s=128

Daniel van Berzon

November 07, 2019
Tweet

Transcript

  1. Daniel van Berzon @ocastahq ocasta.com @dvberzon vanberzon.com

  2. Help us discover what makes code readable!

  3. None
  4. None
  5. What they have in common are rules Rules Broken

  6. Grammar rules Prescriptive Descriptive

  7. Prescriptive Arbitrary grammar rule that prescribes the way people should

    speak "Never end a sentence with a preposition!"
  8. What is he on about?

  9. What is he on about? preposition

  10. What is he on about? preposition About what is he

    on?
  11. What is he on about? preposition About what is he

    on? On about what is he? !
  12. "Never end a sentence with a preposition!" Joshua Poole (1646)

    John Dryden (1672) Prescriptive What is he on about?
  13. Descriptive Evidence-based Grammar rule that describes the way people speak

    naturally. "English word order is: Subject - Verb - Object"
  14. Penny eats pizza Penny pizza eats Eats penny pizza Eats

    pizza penny Pizza penny eats Pizza eats penny
  15. Penny eats pizza Penny pizza eats Eats penny pizza Eats

    pizza penny Pizza penny eats Pizza eats penny
  16. Penny eats pizza Subject - Verb - Object Descriptive Penny

    eats Pizza
  17. Readable Code Rules

  18. Airbnb JavaScript Style Guide: // bad function sayHi(name) { return

    'How are you, ' + name + '?'; } // good function sayHi(name) { return `How are you, ${name}?`; } Template strings give you a readable, concise syntax ... “ ” Often mentions readability
  19. Prescriptive • Arbitrary • Opinions as facts • No evidence

  20. Descriptive rules For readable code?

  21. Online experiment to find descriptive rules for code readability Measures

    readability of coding constructs Showing code snippets to developers Measuring how easily they read them
  22. What do we measure? Can developer predict output of code?

    Time takes them to understand the code
  23. Comments // foo Are /*comments*/ readable?

  24. Comments // foo Are /*comments*/ readable?

  25. Comments // foo Are /*comments*/ readable? 75% 50% } }

  26. Experiment is live Measuring 11 constructs > 500 participants Need

    more participants to get better results Comments Naming Pure functions Abstraction Boolean algebra Ternary operators Chaining methods If statements Inline functions Early return Operator precedence
  27. • Developer • JavaScript • 10 minutes howreadable.com You can

    help!
  28. Help us discover what makes code readable! howreadable.com

  29. Daniel van Berzon @ocastahq ocasta.com @dvberzon vanberzon.com Thank you! howreadable.com