Slide 1

Slide 1 text

Continuous Delivery for Legacy Code Slides by Richard Gross @arghrich 16.10.19 Audit Software Archeology Develop Many Icons by Franziska Haaf binarykitten.de

Slide 2

Slide 2 text

Dylan Beattie @dylanbeattie Legacy Code is code that’s too scary to update and too profitable to delete. Michael Feathers @mfeathers Legacy Code is code without tests. Slide by @arghrich 2

Slide 3

Slide 3 text

Legacy Code is code that’s too scary to update and too profitable to delete. Continuous Delivery If somebody thinks of a good idea, how do we [make it feasable to] deliver it to users as quickly as possibly? 3 Dylan Beattie @dylanbeattie Slide by @arghrich

Slide 4

Slide 4 text

Slide by @arghrich 4 Photo by Anne-sophie Parent from Pexels Spring

Slide 5

Slide 5 text

Slide by @arghrich 5 Spring: Audit Icons by Franziska Haaf binarykitten.de COTS „Apocalypto“ Please Audit

Slide 6

Slide 6 text

4M LoC Delivery 6 Excel Webservice Website Fat Client Jobs Database Spring: Audit Slide by @arghrich T-SQL JavaScript VBA C# Asp.NET + C# Classic Asp + VBScript WinForms + C# MIA No Code delivered 5M 4M LoC Delivery

Slide 7

Slide 7 text

Replicated Databases 7 Excel Webservice Website Fat Client Jobs DB1 DB2 Spring: Audit Slide by @arghrich Replication Dependency

Slide 8

Slide 8 text

Slide by @arghrich 8 Icons by Franziska Haaf binarykitten.de Doesn‘t Compile BL & DB Everywhere Interesting Deployment 15 years old No Tests Every Duplication Spring: Audit

Slide 9

Slide 9 text

COTS „Apocalypto“ In-house „Fenix“ Slide by @arghrich 9 Spring: Audit Icons by Franziska Haaf binarykitten.de Buy I‘ll

Slide 10

Slide 10 text

Slide by @arghrich 10 Spring: Audit Icons by Franziska Haaf binarykitten.de In-house „Fenix“ Please Fix

Slide 11

Slide 11 text

Oh Boy

Slide 12

Slide 12 text

Slide by @arghrich 12 We could just …

Slide 13

Slide 13 text

Slide by @arghrich 13 Photo by Levi Damasceno from Pexels

Slide 14

Slide 14 text

The True Cost of Rewrites Features Releases over time Catch Up Missing Features Sub-Par Parity Enhancements Planned Rewrite Actual Features Undiscovered Scope Old App Adoption Slide Adaption by @arghrich Original Article by Doug Bradbury The True Cost of Rewrites

Slide 15

Slide 15 text

Slide by @arghrich 15 Early Summer Photo by Pixabay

Slide 16

Slide 16 text

Slide by @arghrich 16 How did they get here? Early Summer

Slide 17

Slide 17 text

GIGO 17 Ideas Product Process (Team) Spirit Early Summer Slide by @arghrich Predicts

Slide 18

Slide 18 text

GIGO 18 Ideas Product Process (Team) Spirit Early Summer Slide by @arghrich Predicts Fix

Slide 19

Slide 19 text

Slide by @arghrich 19 How did we not get here? Early Summer

Slide 20

Slide 20 text

We started a significant change in team and culture 20 Early Summer: Spirit Slide by @arghrich

Slide 21

Slide 21 text

21 Henrik Kniberg @henrikkniberg Culture is the sum of everyone's attitude and actions, so model the behaviour you want to see! Observe behavior: • Who does the management promote? • Is there fear of failure? • What is the delivery „process“? • Is there some kind of learning exchange? • Is quality appreciated or story points? Early Summer: Spirit Slide by @arghrich

Slide 22

Slide 22 text

4 Laws of behavior change Make it … Obvious • Define Principles together • Shared purpose Attractive • Reduce (time) pressure • (Refactoring) score Slide by @arghrich 22 Atomic Habits Early Summer: Spirit Easy • Tech-coach • Reduce friction Satisfying • Pair up • Never break the chain (twice)

Slide 23

Slide 23 text

We built a new Co-located Cross-functional Team with shared 23 DEV TEST OPS Key Accounter Early Summer: Spirit & principles purpose

Slide 24

Slide 24 text

Our Legacy CD Principles • Build quality in • Focus on current tree, not on the forest • Tackle fear head on • Focus on reducing batch size • Low-Risk releases are incremental • Decouple Deployment and Release • Computers perform repetitive tasks, people solve problems Slide Adaption by @arghrich Four Principles of Low-Risk Software Releases by Jez Humble CD Principles by Jez Humble Early Summer: Spirit 24 The Why

Slide 25

Slide 25 text

Slide by @arghrich 25 Early Summer: Spirit Principles provide adaptability

Slide 26

Slide 26 text

Slide by @arghrich 26 Summer Icons by Franziska Haaf binarykitten.de In-house „Fenix“ Please Cloud

Slide 27

Slide 27 text

Oh Boy!

Slide 28

Slide 28 text

Fix 28 Product Process (Team) Spirit Summer Slide by @arghrich Predicts

Slide 29

Slide 29 text

Local Env Source Repository Artifact Repository Commit Stage Acceptance Manual Test Env … Staging Env Prod Env Self-Service Automatic Our CD Pipe Feedback (Tag Artifact) Slide Adaption by @arghrich Dave Farley - Optimising Continuous Delivery

Slide 30

Slide 30 text

Our Branching Strategy • Don‘t Branch • Don‘t Branch • Don‘t Branch • Never Branch to Refactor •Branches indicate Ci =Continuous Isolation Slide by @arghrich 30 Strategy by Dave Farley Summer: Process

Slide 31

Slide 31 text

We versioned and tested Everything • Code • Config • Deployment scripts • Infrastructure scripts • Docs • … 31 Slide by @arghrich Summer: Process

Slide 32

Slide 32 text

They used File Version Anti-Practice 32 Slide by @arghrich File tree from actual project Summer: Process

Slide 33

Slide 33 text

Slide by @arghrich 33 Autumn Photo by Daniel Frank from Pexels

Slide 34

Slide 34 text

Fix 34 Product Process (Team) Spirit Autumn Slide by @arghrich

Slide 35

Slide 35 text

Slide by @arghrich 35 Where do we start? Autumn

Slide 36

Slide 36 text

Slide by @arghrich Art by Zaufishan 36 Autumn: Product

Slide 37

Slide 37 text

github.com/MaibornWolff/codecharta Slide by @arghrich 37 Shameless Autumn: Product

Slide 38

Slide 38 text

Visualize metrics with buildings Slide by @arghrich 38 AbstractService.java Lines of code Complexity number of authors Autumn: Product Icons by Fontawesome Very Shameless

Slide 39

Slide 39 text

Find potential hotspots Slide by @arghrich 39 Still Shameless Autumn: Product

Slide 40

Slide 40 text

Establish baseline with tools Then track progress • CodeCharta https://github.com/ MaibornWolff/codecharta • SonarQube https://www.sonarqube.org/ • Linter • Profiler • CodeMaat https://github.com/ adamtornhill/code-maat • Structure101 http://structure101.com/ Slide by @arghrich 40 Autumn: Product Baseline

Slide 41

Slide 41 text

Golden Master Baseline 41 vX - redesigned v1 - legacy Input for UI/API/DB Output Output Continuous Compare Slide by @arghrich Autumn: Product Baseline

Slide 42

Slide 42 text

Slide by @arghrich 42 Autumn Icons by Franziska Haaf binarykitten.de In-house „Fenix“ Add Feature

Slide 43

Slide 43 text

Slide by @arghrich 43 Photo by Bartek Wojtas from Pexels Autumn Fuuuu

Slide 44

Slide 44 text

Conquer the fear • Write categorization/function Tests • Safely verify it can handle production • Divide code into stable and unstable Slide by @arghrich 44 Autumn: Conquer the Fear

Slide 45

Slide 45 text

Slide by @arghrich 45 Photo by Emmet from Pexels Autumn: Conquer the Fear

Slide 46

Slide 46 text

Slide by @arghrich 46 Photo by Krizjohn Rosales from Pexels Autumn: Conquer the Fear Isolate Stable from Unstable Working Effectively with Legacy Code • Direct Read/Write à Facades • Classes à Interfaces + Dependency Injection • Fire&Forget calls à Events • Obsolete/duplicate tables à Table Views

Slide 47

Slide 47 text

Slide by @arghrich 47 Photo by Alex Fu from Pexels Autumn: Conquer the Fear Sprout quality code Working Effectively with Legacy Code Table View Interface Facade Event

Slide 48

Slide 48 text

Use Strangler Application for bigger features 48 Slide by @arghrich Autumn: Conquer the Fear Picture by Paul Hammant

Slide 49

Slide 49 text

Slide by @arghrich 49 Winter Photo by Riccardo Bresciani from Pexels

Slide 50

Slide 50 text

vX - redesigned Dark Launch to gain confidence Slide by @arghrich 50 Icons by Fontawesome Load Balancer v1 - legacy Continuous Compare Same number of: • 200? • 404? • 5xx? • … Winter: Launch confidence

Slide 51

Slide 51 text

Remove any obsolete code in Tech || Business 51 Slide by @arghrich Winter: Remove waste Don‘t fix what doesn‘t need fixing Slide by @arghrich Photo by Stas Knop from Pexels

Slide 52

Slide 52 text

Finding obsolete code • Add Analytics / Activity-Log for your dark pages • User surveys • IDE suggestions • grep FROM, JOIN, INSERT, UPDATE, DELETE and check if that code is reachable • Legacy Toggles • Forget to deploy parts of your application 52 Slide by @arghrich Winter: Remove waste

Slide 53

Slide 53 text

Slide by @arghrich 53 Next Spring: Summary Photo by Irina Iriser from Pexels

Slide 54

Slide 54 text

Legacy Delivery 54 Slide by @arghrich Next Spring: Summary Photo by pixabay from Pexels Before • 2 Weeks for a feature • 5 months until it works After • 4 Weeks for a feature • Then it works

Slide 55

Slide 55 text

Was it worth it? • Users had capitulated à then we started fixing bugs • More Stable then before • We couldn‘t have reimplemented this from scratch • à None can describe what „same as before“ means • à Even if, it would have taken more than a year • Seamless migration from COTS to in-house à min. feature freeze 55 Slide by @arghrich Next Spring: Summary

Slide 56

Slide 56 text

Slide by @arghrich 56 Would I do it again? Next Spring: Summary

Slide 57

Slide 57 text

Hell Yes We had • Autonomy • Mastery • Purpose 57 Slide by @arghrich Next Spring: Summary Model from „Drive“ by Daniel Pink

Slide 58

Slide 58 text

58 Next Spring: Summary Slide by @arghrich (Team) Spirit • Conquer the fear • CD Principles • Build quality in • Shared purpose Product • Isolate stable from unstable • Golden Master • Strangler • Feathers Process • CD Pipeline • Infrastructure Automation

Slide 59

Slide 59 text

Ken Mugrage @kmugrage It‘s not CD if you can‘t deploy to production right now 59 Slide by @arghrich Next Spring: Summary

Slide 60

Slide 60 text

Done Questions, Remarks, Sympathy? J 30 Mio 410 Employees 9th year 23 Nations 300 Weeks Munich, Augsburg, Berlin, Frankfurt

Slide 61

Slide 61 text

Learn Domain with Reverse Object Mother • Start application with empty database and without domain model • Click through a UseCase • Analyse exceptions and errors „App needs at least an object A with this field“ • Expand Domain Modell with your finding • Create required state in the DB with your model • Document finding as categorization test • Repeat 61 Slide by @arghrich Autumn: Rake the forest

Slide 62

Slide 62 text

Reading • https://trello.com/b/Fdd876S8/continuous- delivery-checklist-template • I did not think I would show this slide 62 Slide by @arghrich