Slide 1

Slide 1 text

Continuous Delivery for Legacy Code 13.11.19 Audit Software Archeology Develop Small Icons by Fontawesome Many Icons by Franziska Haaf binarykitten.de richargh.de/ speakerdeck.com/richargh @arghrich Richard Gross pronoun.is/he

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. 2 Slides by @arghrich

Slide 3

Slide 3 text

Continuous Delivery Legacy Code is code that’s too scary to update and too profitable to delete. 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 Slides by @arghrich

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

Oh Boy

Slide 12

Slide 12 text

We could just … 12 Icons by Franziska Haaf binarykitten.de Slides by @arghrich Spring: Audit

Slide 13

Slide 13 text

13 Photo by Levi Damasceno from Pexels Slides by @arghrich Spring: Audit

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 Original Article by Doug Bradbury The True Cost of Rewrites Slides by @arghrich

Slide 15

Slide 15 text

15 Photo by Pixabay from Pexels Slides by @arghrich Early Summer

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

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

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? • Is quality appreciated or story points or …? • What is the delivery „process“? • Is there some kind of learning exchange? Slides by @arghrich Early Summer: Spirit

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

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

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 • Decouple Deployment and Release • Computers perform repetitive tasks, people solve problems Four Principles of Low-Risk Software Releases by Jez Humble CD Principles by Jez Humble The Why 24 Slides by @arghrich Early Summer: Spirit

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

26 Icons by Franziska Haaf binarykitten.de In-house „Fenix“ Please Cloud Slides by @arghrich Early Summer: Spirit

Slide 27

Slide 27 text

Oh Boy

Slide 28

Slide 28 text

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

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

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

Slide 33

Slide 33 text

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

Slide 34

Slide 34 text

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

Slide 35

Slide 35 text

Where do we start? 35 Slides by @arghrich Autumn

Slide 36

Slide 36 text

Art by Zaufishan 36 Slides by @arghrich Autumn: Product

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

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

Slide 39

Slide 39 text

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

Slide 40

Slide 40 text

No tool to rule them all 40 Slides by @arghrich Continuously Periodically Structure101 SonarQube CodeCharta CodeScene ArchUnit TSArch SonarArchitect Quality Views by Colin Breck Autumn: Product Baseline Quality Views Shamelessly putting CodeCharta first

Slide 41

Slide 41 text

41 Photo by Pixabay from Pexels Slides by @arghrich Autumn: Product Baseline Counting Fixed Windows

Slide 42

Slide 42 text

42 vX - redesigned v1 - legacy Input for UI/API/DB Output Output Continuous Compare Slides by @arghrich Autumn: Product Baseline Golden Master Characterizes Behavior before Refactoring

Slide 43

Slide 43 text

43 Slides by @arghrich Autumn: Product Baseline Golden Master Cheatsheet Input • Have Lots & Check coverage • Capture from Production • Generate • Try Testrecorder Output • Log messages • Datalake • Database Hidden Inputs • Date • Randoms When • Before refactorings • Generate new output when needed

Slide 44

Slide 44 text

How do we refactor what we don‘t understand? 44 Slides by @arghrich Autumn: Product Baseline

Slide 45

Slide 45 text

45 Slides by @arghrich Autumn: Product Baseline Emily Bache @emilybache „Nopefactoring“ The No-thinking refactoring“ Advanced Testing & Refactoring Techniques • Lift-up conditional • Split to Classes Llewellyn Falco @LlewellynFalco Cutting Code Quickly

Slide 46

Slide 46 text

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

Slide 47

Slide 47 text

Fuuuu 47 Photo by Bartek Wojtas from Pexels Slides by @arghrich Autumn

Slide 48

Slide 48 text

• Write categorization, if possible function Tests • Safely verify it can handle production • Divide code into stable and unstable • Understand Code Domain 48 Slides by @arghrich Autumn: Conquer the Fear Conquer the fear

Slide 49

Slide 49 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 49 Slides by @arghrich Autumn: Conquer the Fear

Slide 50

Slide 50 text

50 Photo by Emmet from Pexels Slides by @arghrich Autumn: Conquer the Fear

Slide 51

Slide 51 text

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

Slide 52

Slide 52 text

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

Slide 53

Slide 53 text

Use Strangler Application for bigger features Picture by Paul Hammant Great talk Strangling the Monolith With a Data-Driven Approach 53 Slides by @arghrich Autumn: Conquer the Fear

Slide 54

Slide 54 text

54 Photo by Riccardo Bresciani from Pexels Slides by @arghrich Winter

Slide 55

Slide 55 text

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

Slide 56

Slide 56 text

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

Slide 57

Slide 57 text

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

Slide 58

Slide 58 text

58 Photo by Irina Iriser from Pexels Slides by @arghrich Next Spring: Summary

Slide 59

Slide 59 text

Legacy Delivery 59 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 Slides by @arghrich Next Spring: Summary

Slide 60

Slide 60 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 60 Slides by @arghrich Next Spring: Summary

Slide 61

Slide 61 text

Would I do it again? 61 Slides by @arghrich Next Spring: Summary

Slide 62

Slide 62 text

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

Slide 63

Slide 63 text

63 (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 Slides by @arghrich Next Spring: Summary

Slide 64

Slide 64 text

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

Slide 65

Slide 65 text

Done Questions, Remarks, Sympathy? J 30 Mio 510 Employees 9th year 23 Nations 300 Weeks Munich, Augsburg, Berlin, Frankfurt @arghrich speakerdeck.com/richargh richargh.de/ Most of our projects aren‘t like this J Richard Gross pronoun.is/he

Slide 66

Slide 66 text

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