Managing Technical Debt

Post on 25-Feb-2016

31 views 1 download

Tags:

description

Managing Technical Debt. Pierre G. Boutquin. Welcome!. Welcome to the Toronto ALM User Group “TALMUG”. Thank You, Sponsors!. Agenda or Summary Layout. Intro. Part I. Part II. Choosing or Not Choosing Technical Debt. A second line of text could go here. Agenda; TALMUG; Me. - PowerPoint PPT Presentation

Transcript of Managing Technical Debt

Managing Technical DebtPierre G. Boutquin

Welcome!

Welcome to the Toronto ALM User Group“TALMUG”

Thank You, Sponsors!

Choosing or Not Choosing Technical Debt

Agenda or Summary LayoutA second line of text could go here

Agenda; TALMUG; Me

Debt Characteristics

Discovering and Preventing Technical Debt

Discussion

Intro

Part I

Part II

Part III

End

???

Work ExperienceAbout Me

Programming ExperienceAbout Me

AuthorAbout Me

About today’s talk…Under Promising…

History of a Metaphor

Ward Cunningham

1992

Part I: Debt Characteristics

Deliberate vs. Inadvertent Prudent vs. Reckless

Debt: Good or Bad?Depends…

http://martinfowler.com/bliki/TechnicalDebtQuadrant.html

Faster Short Term Benefit Extra Cost

Why Debt?Trade-Off…

Extra Cost (Interest) As Long as Debt (Principal) NOT Paid Off

Debt DrawbackPrincipal/Interest

Perpetual Debt Growing Interest

Unmanaged DebtAka My Credit Card

Deliberate Trade-Off: Maybe Prudent

Inadvertent Debt: Likely Reckless

Incurring DebtReckless vs. Prudent

Benefits Outweigh Extra Costs Affordable Repayment Plan

Deliberate DebtWhen Prudent?

Deliberate Decision Positive Cost/Benefit Planned, Affordable Repayment Prudent Total Debt

Acceptable Debt4 Criteria:

Inadvertent Decision Negative or Small Cost/Benefit Repayment Not Planned/Too High Reckless Total Debt

Unwise Debt4 Tell-Tale Signs

Total Level of Deliberateness Size of Cost/Benefit Affordability of Repayment Total Debt Load

PART I - ConclusionDebt Criteria:

Part II: Deliberate Technical DebtChoosing or Not Choosing Debt…

Good: Deliver Early/On Time Bad: Detestable Code Ugly: The Spike

Deliberate Technical DebtWhy???

Maybe: Date Driven Development Yes: Feature Driven Development

Deliberate Technical DebtAvoidable?

Shipping Date is Fixed Features Are Negotiable Often Less Desirable

Deliberate Technical DebtDate-Driven Project

Features Are Fixed Shipping Date Is Negotiable Often More Desirable

Deliberate Technical DebtFeature-Driven Project

Release Planning Tool Combines Well With Prioritization

The MVP Concept“Minimal Viable Product”

PrioritizationSometimes…

Agile/Scrum: Backlog Traditional: Prioritization Needs Forethought

PrioritizationKey: By Business Value

MUST: Part of MVP SHOULD: High-Priority COULD: Nice to Have WOULD: Maybe Later

MoSCoW Prioritization

Part III: Minimizing Inadvertent Debt

Discovering and Preventing Debt…

Process Tools

Minimizing: How?2 Angles:

Process: SDLC process: Engineering Practices

Test First Development

Minimizing: How?Process vs. process

Communications Technical Excellence

Minimizing: Type of Tools2 Objectives:

Standup Meeting Shared SME Design Reviews Code Reviews

Minimizing: Communication ToolsTools We Use:

Unit Tests Code Contracts Static Code Analysis

Adherence to Coding Standard Good Coding Practices

Code Metrics

Minimizing: Technical ToolsTools We Use:

Tool: Unit TestsRecommended Book: “The Art of Unit Testing”

http://www.manning.com/osherove2/

A Unit Test is an automated piece of code that invokes the unit of work being tested and then checks some assumptions about a single end result of that unit.

A unit test is almost always written using a unit-testing framework. It can be written easily and runs quickly.

Tool: Unit TestsRoy Osherove’s Definition:

A Unit Test is trustworthy, readable and maintainable. It is consistent in its results as long as the production code has not changed.

Tool: Unit TestsRoy Osherove’s Definition (cont’d):

• /// <summary>• /// This test demonstrates that constructor of • /// the <see cref="VenomSender" /> class is creating a topic session• /// when it is being given valid configuration.• /// </summary>• [TestMethod]• public void Constructor_ValidTibcoConfig_ReturnsNonNullTopicSession()• {• // ARRANGE• var tibcoConfig = TestUtils.CreateValidTibcoConfig();

• // ACT• var venomSender = new VenomSender(tibcoConfig);

• // ASSERT• Assert.IsNotNull(venomSender.TopicSession);• }

Unit Test Tips: Naming Convention[UnitOfWork]_[Condition]_[ExpectedResult]

• /// <summary>• /// This test demonstrates that constructor of • /// the <see cref="VenomSender" /> class is creating a topic session• /// when it is being given valid configuration.• /// </summary>• [TestMethod]• public void Constructor_ValidTibcoConfig_ReturnsNonNullTopicSession()• {• // ARRANGE• var tibcoConfig = TestUtils.CreateValidTibcoConfig();

• // ACT• var venomSender = new VenomSender(tibcoConfig);

• // ASSERT• Assert.IsNotNull(venomSender.TopicSession);• }

Unit Test Tips: Design PatternDesign Pattern: AAA

Use Happy Path Factory Helper Then, Create Single Sad Path Test Both Exception Type & Message

Unit Test Tips: Sad PathsMaintainability Tip:

• /// <summary>• /// This test demonstrates that constructor of • /// the <see cref="VenomSender" /> class is throwing an exception• /// when it is being passed a null SslCertStoreName.• /// </summary>• [TestMethod]• public void Constructor_nullSslCertStoreName_ThrowsException()• {• // ARRANGE• var tibcoConfig = TestUtils.CreateValidTibcoConfig();• tibcoConfig.SslCertStoreName = null;

• // ACT• var venomSender = new VenomSender(tibcoConfig);

• // ASSERT• // etc,• }

Unit Test Tips: Sad PathDesign Pattern:

Method-Level Measure Calculated from Control Flow Graph Smaller Values Better <= 25 Acceptable

Code MetricsCyclomatic Complexity

Synthesis of Three Metrics Cyclomatic Complexity Lines of Code Computational Complexity

Icons Color-Coded GREEN (>20) YELLOW (10-20) RED (<10)

Not Expressed in Units!

Code MetricsMaintainability Index

New to Me No Best Practices To Share Yet…

Code ContractsNow Part of .NET!

Partially Matter of Opinion Let Tool Decide

StyleCop ReSharper

Coding StandardThe Final Word…

Managing Technical Debt

Questions?