[da nang scrum breakfast] dealing with technical debt

64
What it is… Phat Vu #scrumbreakfast, Jan-2017

Upload: scrum-breakfast-vietnam

Post on 19-Jan-2017

66 views

Category:

Software


0 download

TRANSCRIPT

Page 1: [Da Nang Scrum Breakfast] Dealing with Technical Debt

What it is…

Phat Vu#scrumbreakfast, Jan-2017

Page 2: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNam

1. What is technical debt2. The cost3. Good or bad4. Suggestions on how to deal

5. Learn from you

AIM

Technical Debt

Page 3: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNam

3 mins Check-in

50 mins talk in Technical DebtWhat it is

MetaphorsCost

Bad or good

7 mins Hard choices game introduction

15 mins Break

25 mins Play the game

20 mins Talk in how to deal with the debt10 mins + after

What is your experience?

Timeline

Technical Debt

Page 4: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNam

Check-in

• How are you today?

• Have you though about how you can buy a house/car?

• Do you think (financial) debt is good or bad?

• How often do you prepare meals in your kitchen?

Technical Debt

Page 5: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNam

50 mins Talk in Technical DebtWhat it is

MetaphorsCost

Bad or good

Technical Debt

Page 6: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNam

Need…

Technical Debt

Page 7: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

But,

Page 8: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Page 9: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNam

You have these?

Technical Debt

Page 10: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

You love them?

Page 11: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

is dangerous if the incurred interest and the debt itself are not payed

Financial Debt

Page 12: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

is not always a bad thing. It lets us buy what we want or what we need and keep us live

at some level

Financial Debt

Page 13: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNam

If…

Technical Debt

You:•Take loans if acceptable (no way better)•Having loans under control•Have payment plan clearly•Pay soon, in schedule (weekly, monthly)

Page 14: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Do you know him?

Page 15: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Technical Debtis a metaphor developed by Ward Cunningham in 1992

from

Financial Debt

(also known as design debt)

Page 16: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Technical Debt is Very similar to Financial Debt

Page 17: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

“Technical Debt includes internal things that you choose not to

do now, but which will impede future development if left undone.

This includes deferred refactoring, but doesn’t include deferred

functionality”

What is Technical Debt?

Ward Cunningham

internal things : might architecture/design structureimpede: delaydeferred: postpone

Page 18: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

“You have a piece of functionality that you need to add to your

system. You see two ways to do it, one is quick to do but is

messy – you are sure that it will make further changes harder in

the future. The other results in a cleaner design, but will take

longer to put in place”

What is Technical Debt?

Martin Fowler

Page 19: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

A metaphor, NOT a theory or a scientific concept

Technical Debt...

Page 20: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

The Kitchen Metaphor

Prepare dinner Enjoy with your friend soon A day after…

Have to prepare breakfastYour kitchen is mess A week later ???

Page 21: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

The Kitchen Metaphor

Kitchen

Software System

Meals

New features

Cooking

Coding(add, modify codebase)

Mess

Page 22: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Imagine that you have a project that has two potential options..

Decision making

Quick and dirty way,get your features sooner, but make the future changes very hard

Clean and smart way, takes longer to implement but make changes easier in the future

Page 23: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

In development, releasing code as a quick and easy approach is like incurring

debt - it comes with the obligation of interest, which comes in the form of extra

work in the future.

Taking the time to refactor is equivalent to paying down principal

Page 24: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

“Shipping first time code is like going into debt”“It’s a question of pay me now or pay me later”

Ward Cunningham

Page 25: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Messy Code is not Technical Debt

Page 26: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

“The ability to pay back debt [...] depends upon you writing code that is clean enough to be able to

refactor as you come to understand your problem.”Ward Cunningham

Page 27: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Technical debt is GOOD or BAD?

Page 28: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

BAD

If you don’t pay the debt now (fix the code today) you will have to pay some interest in the future (spend more time to fix the same code)

Re-build the whole codebase

Technical debt costs money, time and effort to stakeholders, developers, companies, even to economies

Page 29: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

BAD

“Most companies have to spend 80% of their software development budget maintaining code”

Aaron Erickson, Informit.com

“Technical debt is like smoking addiction. Once you start hacking your code, the code asks for more. You never know what that will cost in the future.”

Lemi Orhan Ergin, Agilistanbul.com

“High amount of Technical Debt is #1 impediment to teams being agile”Dan Rawsthorne

Page 30: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

GOOD

• Most people borrow money when they start a business, and they hope that the investment will pay off.

• House loan or a car loan, generally considered acceptable types of debt.

• With credit card, you can pay a week or a month later.

• Most people would agree that it’s absolutely fine to leave the kitchen a mess for a little while.

• Similar, it’s OK to have technical debt for some period of time.

Page 31: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

GOOD

• It is NOT some terrible monster that needs to be avoided.

• In software development, there is always a constant need to balance speed and quality

• Some quality have to be sacrificed to release features within a

reasonable timeframe. Then, can get feedbacks soon.

• Shortcuts will be tasked as future projects (pay off)

Page 32: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

GOOD

• Since there’s always someone who is cooking in the kitchen (since developers add/modify/remove code all the time)

• There’s no such thing as software without technical debt

Actually

Question• How long are we allowed to leave the kitchen in such a mess?

• There’s no one-size-fits-all answer

Prefer approach

• Before someone else wants to use the kitchen, clean it up and put everything back in its place

• Before you move to the next feature or bug fix, make sure you already pay off technical debt in the codebase.

Page 33: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Flavors of Technical Debt

• Design & Architectural Debt

• Testing Debt

• Documentation Debt

• Defect Debt

• Framework & 3rd parties libraries Debt

Page 34: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Design & Architectural Debt

• Perhaps the most well-known type of technical debt, which is caused by poor design and architecture

• Developers put bad code into codebase. Root causes:• Copy-paste programming (duplications)• The absence of design patterns• Not following coding standards or best practices

• But why would developers — even the best ones — write bad code?

Page 35: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Design & Architectural Debt

• In theory, if you apply care to the quality, then you will constantly have low technical debt.

• In reality, almost all development teams work under pressure and at some point are forced to take shortcuts that sacrifice the quality of their code

boost their short-term productivity to quickly deliver customer features

Page 36: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Testing Debt

Lack of testing or poor testing quality. The most common patterns• Complete absence of (automated) testing• Tests that should run but don’t• Tests that are unreliable because they randomly fail or take too long to

finish• Mismatches between test scenarios and actual testing• Outdated tests• Too much time spending for regression testing

Writing software without testing is like participating in extreme sports without wearing any protective gear.

Page 37: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Testing Debt

Automated, fast & correct testing encourage refactoring

Page 38: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Testing Debt

Page 39: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Documentation Debt

• Documentation is hard work

• Writing clean and readable code over comments and documentation

• Partially agree

• Things that need to be well documented and kept continuously up to date:

• API and common libraries documentation

• Requirements, user stories, and any other sources that describe the

system functionality (JIRA, Confluence, etc.)

• High-level design and architecture documentation

Page 40: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Defect Debt

Describes the known defects that are not yet fixed because:

• low priority

• low severity

• a known work-around

• rarely reproduced or are reproduced only under extreme or corner

cases

Page 41: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Framework & 3rd parties libraries Debt

• Not really suitable frameworks• Outdated

• Complicated to implement, not flexible

• Libraries

Page 42: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Everyday Indicators of Technical Debt

“Don’t worry about the documentation for now”

“The only one who can change this code is Thomas”

“It’s ok for now but we’ll refactor it later.”

“ToDo/FixMe: this should be fixed before release”

“Let’s just copy and paste this part”

“I know if I touch that code everything else breaks”

“Let’s finish the testing in the next release”

“The release is coming up, so just get it done”

Page 43: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNam

25 mins Play the game

Technical Debt

Page 44: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNam

Page 45: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNam

Game rules

• The game may be played by 4 or 5 people• The first player to reach END gets 5 points, second gets 3 points, third gets 1 point• When a player reaches End, he or she also gets 1 point for each tool card• To enter the "Finish" cell the player should roll anything equal or greater than the

remaining squares• The game ends when there is 1 player remaining on the board• The player with the most points at the end of the game WINS• When a player crosses a “hard choices” square, he or she must decide whether to go

over the shortcut bridge or whether to go the long way and try to collect one or more tool cards

“hard choices” square

Page 46: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNam

Short cut

Debt

Page 47: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNam

20 mins Talk in how to deal with the debtI’ll suggestYou too ;)

Technical Debt

Page 48: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Management plan

Register & estimate new debts on technical debt backlog

Page 49: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Establish a debt payment plan

• When faced with different types of debt, where do we start?• it depends on the team’s skill sets and level• key is to put a plan in place prioritize and execute on it

• Minimal iteration debt payment• half a day in a week• every sprint

• Monitor the debt and keep it manageable

• Pay of the debt continuously• calculate effort within tasks• buffer tasks for refactoring 10% of the team's time

Page 50: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Lowest priority

Java class encrypt & decrypt passwordIt works

Page 51: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Assess existing debt

Inspect and assess the level of existing debt we have and also register it.

SonarQube helps us assess debt across multiple categories like duplication, rule violation, code coverage, complexity, documentation

Page 52: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Assess existing debt

Wow, this module is really bad. It’s going to be very hard to make any changes to it

BobbyDeveloper

BrunoProduct Owner

Page 53: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Assess existing debt

BobbyDeveloper

BrunoProduct Owner

Hello Bruno, I think we should take some time to refactor

this module in the next release

Page 54: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Assess existing debt

BobbyDeveloper

BrunoProduct Owner

Why would we do that? That would take a lot of

time and effort

Page 55: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Assess existing debt

BobbyDeveloper

BrunoProduct Owner

But if we don’t refactor it soon, I have a gut feeling it’s

going to cause major problems later

Page 56: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Assess existing debt

BobbyDeveloper

BrunoProduct Owner

David is pretty smart, and he’s usually right about these kinds of things

Page 57: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Assess existing debt

BobbyDeveloper

BrunoProduct Owner

OK, I’ll put in the plan for Manager the next release

Page 58: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Before

•What is a good amount of debt?• it depends on your appetite for risk

•Manage and monitor it and when we reach a certain threshold• need to slow down on new features until we have our debt under control.• negotiate with your PO

Page 59: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

After

Page 60: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Establish a debt limit

•What is a good amount of debt?• it depends on your appetite for risk

•Manage and monitor it and when we reach a certain threshold• need to slow down on new features until we have our debt under control.• negotiate with your PO

Page 61: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Page 62: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNamTechnical Debt

Page 63: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNam

Debt backlog

Conclusion

Interest

Pay offReliable

Debt limit

Technical debtMetaphor

Financial debt

Kitchen metaphor

Messy codeShortcut

Refactor

41/41

Strategy

Priority

Technical Debt

Page 64: [Da Nang Scrum Breakfast] Dealing with Technical Debt

www.axon.vnfb.com/AxonActiveVietNam

10 mins + afterWhat is your experience?

Technical Debt