動作するきれいなコード / Clean code that works - SeleniumConf Tokyo 2019

動作するきれいなコード / Clean code that works - SeleniumConf Tokyo 2019

SeleniumConf Tokyo 2019 基調講演

Clean code that works - How can we go there? - Takuto Wada | SeleniumConf Tokyo
https://youtube.com/watch?v=TEOqzl-dK38

"Clean code that works" means the sense of value and the goal of programmers. It is not easy to implement it from the beginning. In this speech, you will get to know how obstacles appear on the way to "Clean code that works" and how to resolve them. Also, I will reconfirm role and value of automation testing and refactoring.

9f3a83db74bee75a64b5e6ed106a775c?s=128

Takuto Wada

April 18, 2019
Tweet

Transcript

  1. ςετۦಈ։ൃ ͷ 5BLVUP8BEB !U@XBEB  "QS !4FMFOJVN$POG5PLZP $MFBODPEFUIBUXPSLT )PXDBOXFHPUIFSF

  2. #SeConfTokyo $BNFSBTBMMPXFE .BUFSJBMTBSFUPCFQVCMJTIFE 5XFFUJOHXFMDPNFE )FMMP

  3. UXBEB U@XBEB UXBEB 5BLVUP8BEB

  4. 5BLVUP8BEB - Consultant - Programmer guided by tests - Loves

    FLOSS - Creator of power-assert-js
  5. 5IF#PPLT*XPSLFEPO

  6. l5IF8JME4BWBOOBI-JPOz.FNF

  7. None
  8. assert(typeof item.id === 'strong') | | | | | |

    | false | | "foo" | Item{id:"foo",name:"bar"} "string" --- [string] 'strong' +++ [string] typeof item.id @@ -1,6 +1,6 @@ str -o +i ng Representative work: power-assert-js IUUQTHJUIVCDPNQPXFSBTTFSUKTQPXFSBTTFSU
  9. -FUTHFUTUBSUFE

  10. None
  11. l$MFBODPEFUIBUXPSLT JO3PO+F⒎SJFT QJUIZQISBTF JTUIFHPBMPG5FTU%SJWFO %FWFMPQNFOU 5%% $MFBODPEFUIBU XPSLTJTBXPSUIXIJMFHPBMGPSBXIPMF CVODIPGSFBTPOTz ᴷ,FOU#FDL

    5FTU%SJWFO%FWFMPQNFOUCZ&YBNQMF
  12. l$MFBODPEFUIBUXPSLTJTPVUPGUIF SFBDIPGFWFOUIFCFTUQSPHSBNNFST TPNFPGUIFUJNF BOEPVUPGUIFSFBDI PGNPTUQSPHSBNNFST MJLFNF NPTUPG UIFUJNF%JWJEFBOEDPORVFS CBCZz ᴷ,FOU#FDL

    5FTU%SJWFO%FWFMPQNFOUCZ&YBNQMF
  13. $MFBODPEFUIBUXPSLT $MFBODPEFUIBUXPSLT $MFBODPEFUIBUXPSLT

  14. Clean Dirty Doesn’t work Works $MFBODPEFUIBUXPSLT

  15. Clean Dirty Doesn’t work Works Two Ways $MFBODPEFUIBUXPSLT

  16. Clean Dirty Doesn’t work Works $MFBODPEFUIBUXPSLT

  17. Clean Dirty Doesn’t work Works $MFBODPEFUIBUXPSLT

  18. Clean Dirty Doesn’t work Works $MFBODPEFUIBUXPSLT Bog

  19. Clean Dirty Doesn’t work Works $MFBODPEFUIBUXPSLT Bog Shame

  20. Clean Dirty Doesn’t work Works $MFBODPEFUIBUXPSLT Bog Vanity Shame

  21. Clean Dirty Doesn’t work Works $MFBODPEFUIBUXPSLT Bog Vanity Shame Perfectionism

  22. Clean Dirty Doesn’t work Works $MFBODPEFUIBUXPSLT Bog Vanity Shame Perfectionism

    Analysis Paralysis
  23. Clean Dirty Doesn’t work Works $MFBODPEFUIBUXPSLT

  24. Clean Dirty Doesn’t work Works $MFBODPEFUIBUXPSLT

  25. l%JWJEFBOEDPORVFS CBCZ 'JSTUXFMMTPMWFUIFlUIBUXPSLTzQBSUPG UIFQSPCMFN 5IFOXFMMTPMWFUIFlDMFBODPEFzQBSUz ᴷ,FOU#FDL 5FTU%SJWFO%FWFMPQNFOUCZ&YBNQMF

  26. Clean Dirty Doesn’t work Works $MFBODPEFUIBUXPSLT

  27. Clean Dirty Doesn’t work Works $MFBODPEFUIBUXPSLT Bog

  28. Clean Dirty Doesn’t work Works $MFBODPEFUIBUXPSLT Bog Laziness

  29. Clean Dirty Doesn’t work Works $MFBODPEFUIBUXPSLT Bog Laziness Impatience

  30. Clean Dirty Doesn’t work Works $MFBODPEFUIBUXPSLT Bog Laziness Impatience Fear

  31. l*GJUJTXPSLJOH EPO`UDIBOHFz IUUQTXXXqJDLSDPNQIPUPT!/

  32. &EJUBOE1SBZ

  33. $PWFSBOE.PEJGZ

  34. 7FSTJPO $POUSPM 5FTUJOH "VUPNBUJPO 5IF5ISFF1JMMBST

  35. 7FSTJPO$POUSPM

  36. 7FSTJPO$POUSPM

  37. 5FTUJOH

  38. $POUJOVPVT *OUFHSBUJPO 9'% "VUPNBUJPO ࣗಈԽ "VUPOPNBUJPO ࣗಇԽ

  39. 5ISFFMFHHFETUPPM NFUBQIPS ©Artek ( http://www.artek.fi/ )

  40. Clean Dirty Doesn’t work Works The way we work $MFBODPEFUIBUXPSLT

  41. 3FGBDUPSJOH Refactoring (noun): a change made to the internal structure

    of software to make it easier to understand and cheaper to modify without changing its observable behavior.
  42. 5IF&OE

  43. Clean Dirty Doesn’t work Works l$ZDMFzNBUUFSTNPTU The way we work

  44. Red. Write a little test that doesn't work, and perhaps

    doesn't even compile at first. Green. Make the test work quickly, committing whatever sins necessary in the process. Refactor. Eliminate all of the duplication created in merely getting the test to work.
  45. Clean Dirty Doesn’t work Works 5IF(PMEFODZDMFPG5%% Red Green Refactoring

  46. Clean Dirty Doesn’t work Works 5IF(PMEFODZDMFPG5%% Red Green Refactoring Impatience

  47. "DVSTFPOUIFXPSElSFGBDUPSJOHz

  48. #JH3FGBDUPSJOH"DDPVOUBCJMJUZ

  49. Clean Dirty Doesn’t work Works %FWXJUIPVU3FGBDUPSJOH %FWXJUIPVU$MFBO$PEF Red Green

  50. Clean Dirty Doesn’t work Works %PO`UMFUSFGBDUPSJOHBMPOF Red Green Refactoring

  51. "HBJO$ZDMFNBUUFSTNPTU

  52. None
  53. None
  54. 8IZ 8IBU 8IP 8IBUTIPVME JUCF )PXUPNBLF BOELFFQ UIFNDMFBO $POUJOVPVT %FMJWFSZ

    "DDFQUBODF 5FTU 6OJU5FTU #Z&JKJ*FOBHB
  55. 8IZ 6OJU5FTUT

  56. Unit Integration E2E Scale Amount of Feedback Internal Quality External

    Quality
  57. External Quality: Correctness, Usability, Efficiency, Reliability, Integrity, Adaptability, Accuracy, Robustness

    Internal Quality: Maintainability, Flexibility, Portability, Re-usability, Readability, Testability, Understandability
  58. l"VUPNBUFE5FTU1ZSBNJEzCZ.JLF$PIO

  59. l5FTU4J[FTzBU(PPHMF IUUQTUFTUJOHHPPHMFCMPHDPNUFTUTJ[FTIUNM

  60. medium small large Define SML on your own

  61. l'*345z 'JWFSVMFTPGDMFBOUFTUT

  62. 'BTU *OEFQFOEFOU 3FQFBUBCMF 4FMG7BMJEBUJOH 5JNFMZ

  63. l"53*1z 1SPQFSUJFTPG(PPE5FTUT

  64. "VUPNBUFE 5IPSPVHI 3FQFBUBCMF *OEFQFOEFOU 1SPGFTTJPOBM

  65. *OUFSTFDUJPOPG '*345 BOE "53*1

  66. 'BTU *OEFQFOEFOU 3FQFBUBCMF 4FMG7BMJEBUJOH 5JNFMZ "VUPNBUFE 5IPSPVHI 3FQFBUBCMF *OEFQFOEFOU 1SPGFTTJPOBM

  67. 'BTU *OEFQFOEFOU 3FQFBUBCMF 4FMG7BMJEBUJOH 5JNFMZ "VUPNBUFE 5IPSPVHI 3FQFBUBCMF *OEFQFOEFOU 1SPGFTTJPOBM

  68. ʰY6OJU5FTU1BUUFSOTʱ .BJOUFOBODF$PTU PG5FTUDPEF *EFBM 3FBMJUZ

  69. The code you write for a unit test is real;

    some may argue it's even more real than the code you ship to customers. This means that it must be written and maintained to the same professional standards as your production code. Test code is real code.
  70. Clean Dirty Doesn’t work Works 3FDBQ5IF(PMEFODZDMFPG5%% Red Green Refactoring

  71. TDD can't guarantee that we will have flashes of insight

    at the right moment. However, confidence-giving tests and carefully factored code give us preparation for insight, and preparation for applying that insight when it comes. ─ Kent Beck
  72. 5IBOLZPV BDUT@BT@QSPGFTTJPOBM