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

my adventures concerning readable code

Kelvin Tay
October 25, 2017
47

my adventures concerning readable code

for a casual meetup (https://english-lt.connpass.com/event/67958/) organized by Github's Tokyo office.

Kelvin Tay

October 25, 2017
Tweet

Transcript

  1. My Adventures concerning Readable Code

  2. who?

  3. kelvin_tay.says(' こんばんは!') server-side engineer @ Mercari

  4. I am a Twin / 双子 - Art Industry /

    芸術専門 - Writer / 文章を書いている
  5. writers and programmers are pretty similar in profession

  6. Readable Code / 読みやすい コー ド

  7. Situation: "I don't understand this piece of code. Also, comments

    are in ! 誰かが助けて!"
  8. 1st Proposal "Let's build a script to fail CI builds

    if comments are commited!"
  9. But, comments are really a last resort. コメントを書くのは最後の手 段!

  10. Software is just details. Like authors, we need to ensure

    it is readable for the readers. “ “
  11. variable, function & class names is_user_logged_in = isinstance(user, User) if

    is_user_logged_in: return news_personalized(user) return news_general()
  12. Built a simple tool to 'evaluate' source codes looks for

    top N words used in your variable, function & class names
  13. ref: https://github.com/kelvintaywl/re adable_code https://readable- code.herokuapp.com/github/kelvintaywl/readabl e_code?top_n=20 “ “

  14. Impact #1 Top N words should describe the source code

    / system correctly.
  15. Impact #2 If top N words do not describe systems

    well, maybe the code is 'doing too much'
  16. Impact #3 diagnose code of our microservices

  17. Thanks for listening!

  18. None