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

Automate, Automate, AUTOMATE!

Automate, Automate, AUTOMATE!

Since the advent of cloud computing, the economics of software development have fundamentally shifted. Today, for many projects of all sizes, the single biggest cost is the time it takes to create and ship new products and new features. The quicker we can ship, the more productive we can be - and automation can help you with that.

In this talk, Stuart will walk through a complete software development workflow. At each step of the way, he'll look at what can be automated, what the options are, and what the trade-offs are. There'll be a few war stories sprinkled in from nearly a quarter of a century of software development. Finally, we'll discuss your own experiences with automation, and see just how much further you want to take automation in your own organisations.

Presented at @sheffieldphp, 19th July 2018.

2c1dc90ff7bf69097a151677624777d2?s=128

Stuart Herbert

July 19, 2018
Tweet

Transcript

  1. A presentation by @stuherbert
 for @GanbaroDigital Automate, Automate, AUTOMATE! An

    Introduction For Developers
  2. Industry veteran: architect, engineer, leader, manager, mentor F/OSS contributor since

    1994 Talking and writing about PHP since 2004 Chief Software Archaeologist Building Quality @GanbaroDigital About Stuart
  3. Follow me I do tweet a lot about non-tech stuff

    though :) @stuherbert
  4. @GanbaroDigital ?? ?? What automation do you use today?

  5. @GanbaroDigital ?? ?? Why do you use automation?

  6. @GanbaroDigital https://unsplash.com/photos/cDwZ40Lj9eo Story #1: Cannot Compile

  7. @GanbaroDigital Why We Automate

  8. @GanbaroDigital Automation is often introduced to help with ...

  9. @GanbaroDigital https://unsplash.com/photos/mqpMdf1MeRE Common Practices

  10. @GanbaroDigital https://unsplash.com/photos/uYO30M0NND4 De-skill

  11. @GanbaroDigital https://unsplash.com/photos/iS0Aq3QPsJ4 Boredom

  12. @GanbaroDigital https://flic.kr/p/8taMDz Herding Cats

  13. @GanbaroDigital I'm a great believer in working backwards from outcomes.

  14. @GanbaroDigital https://unsplash.com/photos/NXt5PrOb_7U Guiding Direction

  15. @GanbaroDigital In the last 5 years, I've adopted ONE guiding

    principle behind ALL my automation.
  16. @GanbaroDigital “ Automation should assist us to iterate faster.

  17. @GanbaroDigital “ Catch it early, catch it often.

  18. @GanbaroDigital “ Any automation that slows us down should be

    removed.
  19. @GanbaroDigital https://flic.kr/p/pdx99h A Scenic Tour

  20. @GanbaroDigital The development workflow is often described as a pipeline.

  21. @GanbaroDigital Development

  22. @GanbaroDigital Development Integration

  23. @GanbaroDigital Development Integration Testing

  24. @GanbaroDigital Development Integration Testing Deployment

  25. @GanbaroDigital It's rarely a neat pipeline in practice.

  26. @GanbaroDigital Development Integration Testing Deployment

  27. @GanbaroDigital Development Integration Testing Deployment

  28. @GanbaroDigital Development

  29. @GanbaroDigital Testing Deployment Integration Coding + many more!

  30. @GanbaroDigital Deployment Integration Coding w/ Local Tests Coding Testing

  31. @GanbaroDigital Integration Coding w/ Feature Tests or Manual Testing Coding

    Testing Deployment
  32. @GanbaroDigital Deployment Daily Integration With Local Tests Coding Testing Integration

  33. @GanbaroDigital Daily Integration With Feature Tests or Manual Testing Coding

    Testing Integration Deployment
  34. @GanbaroDigital Testing Integration Coding w/ No Testing Coding Deployment

  35. @GanbaroDigital The development workflow happens in many places.

  36. @GanbaroDigital Development Integration Testing Deployment Desktops, laptops, 
 cloud workspaces

    / VDM
  37. @GanbaroDigital Development Integration Testing Deployment Desktops, laptops, 
 cloud workspaces

    / VDM above & on CI services
  38. @GanbaroDigital Development Integration Testing Deployment Desktops, laptops, 
 cloud workspaces

    / VDM above & on CI services same as above
  39. @GanbaroDigital Development Integration Testing Deployment Desktops, laptops, 
 cloud workspaces

    / VDM above & on CI services same as above same as above
  40. @GanbaroDigital When you introduce automation, make sure that it doesn't

    reduce flexibility.
  41. @GanbaroDigital Always remember that you'll still need to make emergency

    releases too!
  42. @GanbaroDigital There are no specific tools in this talk. Tools

    come and go.
  43. @GanbaroDigital Development

  44. @GanbaroDigital ?? ?? What automation can we use to write

    code faster?
  45. @GanbaroDigital 1. Code completion

  46. @GanbaroDigital 2. Refactoring tools

  47. @GanbaroDigital 3. Code formatting

  48. @GanbaroDigital IDE Tools For Automation 1. Code completion 2. Refactoring

    help 3. Code formatting
  49. @GanbaroDigital ?? ?? What about code generation?

  50. @GanbaroDigital Many frameworks will provide template / skeleton generators.

  51. @GanbaroDigital Some frameworks will rewrite your code to help you

    upgrade.
  52. @GanbaroDigital Integration

  53. @GanbaroDigital ?? ?? What is integration?

  54. @GanbaroDigital “ Integration is how you deliver into your team's

    collective work.
  55. @GanbaroDigital “Integration is adding your changes to everyone else's and

    proving you haven't broken anything.
  56. @GanbaroDigital ?? ?? How can automation help us deliver quicker?

  57. @GanbaroDigital A CI server (or service) can automate checking a

    merge request.
  58. @GanbaroDigital ?? ?? If we have a CI server, what

    kinds of checks can we automate?
  59. @GanbaroDigital 1. Reproducible builds

  60. @GanbaroDigital 2. Unit tests pass

  61. @GanbaroDigital 3. Gather code metrics

  62. @GanbaroDigital 4. Static code analysis

  63. @GanbaroDigital ?? ?? How many of these automated tasks help

    us deliver quicker?
  64. @GanbaroDigital Integration Automation 1. Reproducible builds 2. Unit tests pass

    3. Gather code metrics 4. Static code analysis
  65. @GanbaroDigital “ The more work a CI server does the

    more it becomes your bottleneck.
  66. @GanbaroDigital “ A CI server is a shared resource. It's

    everyone's bottleneck.
  67. @GanbaroDigital https://xkcd.com/303/

  68. @GanbaroDigital “ Catch it early, catch it often.

  69. @GanbaroDigital Thanks to git, we can test our integration locally

    every day.
  70. @GanbaroDigital Thanks to Docker, we can run them all in

    an isolated environment locally whenever we want.
  71. @GanbaroDigital We'll come back to this towards the end of

    the talk.
  72. @GanbaroDigital If integration automation is slow on the CI server,

    it'll be slow on your dev machine too.
  73. @GanbaroDigital Make sure each developer can run all the integration

    checks on their dev machine ... ... and that they do so.
  74. @GanbaroDigital “ You can't fix people problems with technical solutions.

  75. @GanbaroDigital https://unsplash.com/photos/ZSrgSSGJiQs Story #2 The Best Metrics

  76. @GanbaroDigital Testing

  77. @GanbaroDigital ?? ?? What is testing?

  78. @GanbaroDigital “ Testing is the act of proving that your

    code actually does what you think it does.
  79. @GanbaroDigital In my experience, many developers mis-read their code.

  80. @GanbaroDigital ?? ?? How does testing help us iterate faster?

  81. @GanbaroDigital “ Testing helps us reduce rework.

  82. @GanbaroDigital Rework is expensive.

  83. @GanbaroDigital Design Dev Test Live If errors in one phase

    cost x3 to fix in the next:
  84. @GanbaroDigital ?? ?? What testing can we automate?

  85. @GanbaroDigital 1. Unit tests

  86. @GanbaroDigital 2. Integration tests

  87. @GanbaroDigital 3. Functional tests

  88. @GanbaroDigital 4. Non-functional tests

  89. @GanbaroDigital 5. Acceptance tests

  90. @GanbaroDigital ?? ?? Which of these help us iterate faster?

  91. @GanbaroDigital Automated Testing 1. Unit tests 2. Integration tests 3.

    Functional tests 4. Non-functional tests 5. Acceptance tests
  92. @GanbaroDigital Automated Testing 1. Unit tests 2. Integration tests 3.

    Functional tests 4. Non-functional tests 5. Acceptance tests
  93. @GanbaroDigital ?? ?? Do all the test approaches help us

    all the time?
  94. @GanbaroDigital https://unsplash.com/photos/IClZBVw5W5A Right Tool For Each Job

  95. @GanbaroDigital “ Unit tests help us develop libraries faster.

  96. @GanbaroDigital “ Functional tests help us develop the app or

    API faster.
  97. @GanbaroDigital “ Acceptance tests help us invoice faster.

  98. @GanbaroDigital https://unsplash.com/photos/ZSrgSSGJiQs Story #2 The Best Metrics

  99. @GanbaroDigital The testing failed to catch errors from the design

    phase.
  100. @GanbaroDigital The Testing Fell Short 1. Over-reliance on unit tests

    w/ mocks 2. Manual functional testing 3. No representative environment to test within
  101. @GanbaroDigital Deployment

  102. @GanbaroDigital ?? ?? How can automating deployment help us iterate

    faster?
  103. @GanbaroDigital We need somewhere to run and test our code.

  104. @GanbaroDigital ?? ?? Can you spin up a representative environment?

  105. @GanbaroDigital ?? ?? Can you spin one up on your

    dev box?
  106. @GanbaroDigital Two Layers of Deployment 1. Representative environment 2. Deploying

    code into that environment
  107. @GanbaroDigital Don't merge them into a single activity.

  108. @GanbaroDigital ?? ?? How do you automate your deployment today?

  109. @GanbaroDigital 1. GitOps

  110. @GanbaroDigital 2. Shell scripts

  111. @GanbaroDigital 3. Orchestration tools

  112. @GanbaroDigital Deployment Automation 1. GitOps 2. Shell scripts 3. Orchestration

    tools
  113. @GanbaroDigital GitOps is normally* backed by a CI/CD box and

    orchestration tools. Can you use those to deploy locally too?
  114. @GanbaroDigital Shell scripts are quick and dirty. They break down

    in a mixed O/S environment.
  115. @GanbaroDigital It takes a lot of time to automate deployments

    using orchestration tools.
  116. @GanbaroDigital “ Code rots over time. Automation is code.

  117. @GanbaroDigital “ Automation doesn't transfer between paradigm changes.

  118. @GanbaroDigital

  119. @GanbaroDigital

  120. @GanbaroDigital

  121. Thank You Can We Help You? A presentation by @stuherbert


    for @GanbaroDigital