Software economics: tradeoffs of decoupled softwre

186
Software Economics Tradeoffs of Decoupled Software

Transcript of Software economics: tradeoffs of decoupled softwre

Page 1: Software economics: tradeoffs of decoupled softwre

Software EconomicsTradeoffs of Decoupled Software

Page 2: Software economics: tradeoffs of decoupled softwre

Luis Artola@artolamola @buntplanet

Page 3: Software economics: tradeoffs of decoupled softwre

Guillermo Gutiérrez@ggalmazor @buntplanet

Page 4: Software economics: tradeoffs of decoupled softwre

0.1About technology, tradeoffs and business needs

Page 5: Software economics: tradeoffs of decoupled softwre

Business needs

Value, Cost, Risk & Debt

Iterative & incremental

Change & evolution Dependencies

Page 6: Software economics: tradeoffs of decoupled softwre

Economy

Page 7: Software economics: tradeoffs of decoupled softwre

Economy is about making decisions on limited goods

Page 8: Software economics: tradeoffs of decoupled softwre

You don’t need to invent anything. They have figured out

everything for you

Page 9: Software economics: tradeoffs of decoupled softwre

Maybe you don’t make decisions about money

Page 10: Software economics: tradeoffs of decoupled softwre

What about time? Time is money and it’s limited

Page 11: Software economics: tradeoffs of decoupled softwre

and will let you use the same language from business

Developing an economic mindset will help you with your

decision making

Page 12: Software economics: tradeoffs of decoupled softwre

Makes easier to achieve a common goal, a shared vision

Speaking the same language improves conversation and

trust

Page 13: Software economics: tradeoffs of decoupled softwre

Economies of scale Cost of opportunityCost of acquisition

Marginal costTime to market

Return of InvestmentRiskDebt, loans, interest

Time Value of MoneyCash flowBalance sheetLiquidity

Throughput accountingCost accountingNet present value Real options

Business mindset

Value Cost

Page 14: Software economics: tradeoffs of decoupled softwre

Economies of scale Cost of opportunityCost of acquisition

Marginal costTime to market

Return of InvestmentRiskDebt, loans, interest

Time Value of MoneyCash flowBalance sheetLiquidity

Throughput accountingCost accountingNet present value Real options

In this talk

Value Cost

Page 15: Software economics: tradeoffs of decoupled softwre

Value, Cost, Risk

& DebtBusiness

needsIterative &

incrementalChange & evolution Dependencies

Page 16: Software economics: tradeoffs of decoupled softwre

We are here to satisfy business needs

Page 17: Software economics: tradeoffs of decoupled softwre

Early delivery of value,

What does business need?

ROIRisk reduction

Hypothesis validation Stakeholders shared vision

Page 18: Software economics: tradeoffs of decoupled softwre

Early delivery of value, with the lowest possible cost,

What does business need?

Page 19: Software economics: tradeoffs of decoupled softwre

Early delivery of value, with the lowest possible cost,

keeping options open,

What does business need?

So that risk is reduced To face uncertainty with better odds

Page 20: Software economics: tradeoffs of decoupled softwre

Early delivery of value, with the lowest possible cost,

keeping options open, with debt under control

What does business need?

To avoid being unable to pay it off in the future

Page 21: Software economics: tradeoffs of decoupled softwre

How are our coding strategies and practices aligned with

business needs?

Page 22: Software economics: tradeoffs of decoupled softwre

We are biasedRefactoring a Good Thing™

Waterfall is a Bad Thing™

Business people don’t understand us™

Page 23: Software economics: tradeoffs of decoupled softwre

Can you explain your coding strategies and practices in terms of value, cost, options, risk and

debt?

Page 24: Software economics: tradeoffs of decoupled softwre

How to deal with technologyContext & Tradeoffs

Page 25: Software economics: tradeoffs of decoupled softwre

Agile practice catalog

Page 26: Software economics: tradeoffs of decoupled softwre

Refactoring to Patterns

Page 27: Software economics: tradeoffs of decoupled softwre
Page 28: Software economics: tradeoffs of decoupled softwre

Often forgetting to talk about when (context)

Software community is great writing articles about what & how

Page 29: Software economics: tradeoffs of decoupled softwre

or how to combine other needs (tradeoffs)Often forgetting to talk about when (context)

Software community is great writing articles about what & how

Page 30: Software economics: tradeoffs of decoupled softwre

How do we choose from the overwhelming list of things that

we should know?

Page 31: Software economics: tradeoffs of decoupled softwre

How do we decide what’s the next thing to work on?

Page 32: Software economics: tradeoffs of decoupled softwre

Are we professional about it?

Page 33: Software economics: tradeoffs of decoupled softwre

You deal with technology applying context (when) and tradeoffs

(balance)

Page 34: Software economics: tradeoffs of decoupled softwre

Value, Cost, Risk

& DebtBusiness

needsIterative &

incrementalChange & evolution Dependencies

Page 35: Software economics: tradeoffs of decoupled softwre

Dependencies

Page 36: Software economics: tradeoffs of decoupled softwre

Does business care about software dependencies?

Page 37: Software economics: tradeoffs of decoupled softwre

Does business care about software dependencies?

No

Page 38: Software economics: tradeoffs of decoupled softwre

Business focuses on visible costs

Page 39: Software economics: tradeoffs of decoupled softwre

Invisible

Risk & DebtValue

CostQ

uant

ifiab

leU

nqua

ntifi

able

Visible

Cost is quantifiable and visible

Page 40: Software economics: tradeoffs of decoupled softwre

Invisible

Risk & DebtValue

CostQ

uant

ifiab

leU

nqua

ntifi

able

Visible

Dependencies are risk and debt (difficult to see and quantify)

Dependencies be here

Page 41: Software economics: tradeoffs of decoupled softwre

In an IT context, when you need to decrease the risk of delivering misunderstood needs (continuous feedback from stakeholders)

In a Start-up context, when you need to validate your hypothesis and discover your product

But costs are less important than value, risk or debt

Page 42: Software economics: tradeoffs of decoupled softwre

Iterative & incremental

Business needs

Value, Cost, Risk & Debt

Change & evolution Dependencies

Page 43: Software economics: tradeoffs of decoupled softwre

How do we deal with it?

Page 44: Software economics: tradeoffs of decoupled softwre

Waterfall: Great for cost, if you forget about value, risk and

debt

Page 45: Software economics: tradeoffs of decoupled softwre

time

Page 46: Software economics: tradeoffs of decoupled softwre

time

RiskCost

Value

Page 47: Software economics: tradeoffs of decoupled softwre

time

RiskCost

Value

Page 48: Software economics: tradeoffs of decoupled softwre

time

RiskCost

Value

Page 49: Software economics: tradeoffs of decoupled softwre

time

Cost

Value

Page 50: Software economics: tradeoffs of decoupled softwre

time

Cost

Value

Value hits users for the first time

Page 51: Software economics: tradeoffs of decoupled softwre

time

Risk

Page 52: Software economics: tradeoffs of decoupled softwre

Iterative & incremental: The best possible option

Page 53: Software economics: tradeoffs of decoupled softwre

time

Page 54: Software economics: tradeoffs of decoupled softwre

time

Value hits users for the first time

Page 55: Software economics: tradeoffs of decoupled softwre

time

Page 56: Software economics: tradeoffs of decoupled softwre

time

Page 57: Software economics: tradeoffs of decoupled softwre

time

Page 58: Software economics: tradeoffs of decoupled softwre

time

Risk

Risk

Risk

Risk

Page 59: Software economics: tradeoffs of decoupled softwre

time

Risk

Risk

Risk

Risk

Page 60: Software economics: tradeoffs of decoupled softwre

Change & evolution

Business needs

Value, Cost, Risk & Debt

Iterative & incremental Dependencies

Page 61: Software economics: tradeoffs of decoupled softwre

Better value risk and debt, but we have to deal with the cost

of change

Page 62: Software economics: tradeoffs of decoupled softwre
Page 63: Software economics: tradeoffs of decoupled softwre

First vertical feature hits production

We mean by vertical as the minimum amount of software that adds value,

gets feedback (deals with uncertainty) and can be shipped to

users

Page 64: Software economics: tradeoffs of decoupled softwre

We get feedback

Page 65: Software economics: tradeoffs of decoupled softwre

First set of changes hits production

Page 66: Software economics: tradeoffs of decoupled softwre

Second set of changes hits production

Page 67: Software economics: tradeoffs of decoupled softwre

Third set of changes hits production

Page 68: Software economics: tradeoffs of decoupled softwre
Page 69: Software economics: tradeoffs of decoupled softwre
Page 70: Software economics: tradeoffs of decoupled softwre

Cost of development tends to zero

Page 71: Software economics: tradeoffs of decoupled softwre

Cost of Software is the cost of evolving software

Page 72: Software economics: tradeoffs of decoupled softwre

DependenciesBusiness needs

Value, Cost, Risk & Debt

Iterative & incremental

Change & evolution

Page 73: Software economics: tradeoffs of decoupled softwre

0.2Recap: from Software economics to code dependencies

Page 74: Software economics: tradeoffs of decoupled softwre

To satisfy business needs, we need to be aware of

economic implications of our development strategy,

expressed in terms of value, cost, options, risk and debt.

Page 75: Software economics: tradeoffs of decoupled softwre

This implies an iterative, incremental development strategy of vertical slices

Page 76: Software economics: tradeoffs of decoupled softwre

This brings to the table new challenges

Page 77: Software economics: tradeoffs of decoupled softwre

One is supporting constant code evolution

This brings to the table new challenges

Page 78: Software economics: tradeoffs of decoupled softwre

Tightly coupled software is hard to change

Dependencies have big impact in code evolution

Page 79: Software economics: tradeoffs of decoupled softwre

Cost of Software

Extended version of Kent Beck’s Implementation patterns, page 19

Page 80: Software economics: tradeoffs of decoupled softwre

Cost of Software

Discovering

Extended version of Kent Beck’s Implementation patterns, page 19

Page 81: Software economics: tradeoffs of decoupled softwre

Cost of Software

DevelopingDiscovering

Extended version of Kent Beck’s Implementation patterns, page 19

Page 82: Software economics: tradeoffs of decoupled softwre

Cost of Software

DevelopingDiscovering

Evolving

Extended version of Kent Beck’s Implementation patterns, page 19

Page 83: Software economics: tradeoffs of decoupled softwre

Cost of Software

Delivering

DevelopingDiscovering

Evolving

Extended version of Kent Beck’s Implementation patterns, page 19

Page 84: Software economics: tradeoffs of decoupled softwre

Cost of Software

Bug fixingDelivering

DevelopingDiscovering

Evolving

Extended version of Kent Beck’s Implementation patterns, page 19

Page 85: Software economics: tradeoffs of decoupled softwre

Cost of evolving software

Page 86: Software economics: tradeoffs of decoupled softwre

Cost of understanding Cost of changing

Page 87: Software economics: tradeoffs of decoupled softwre

Cost of changing

Abstractions

Composition

Dependencies

Other

Page 88: Software economics: tradeoffs of decoupled softwre

Dependencies

Page 89: Software economics: tradeoffs of decoupled softwre

Non code Codeschedule dependenciesteam dependencies

Page 90: Software economics: tradeoffs of decoupled softwre

This talkCodeNon code

Page 91: Software economics: tradeoffs of decoupled softwre

Context Boundaries Dependency Injection by constructorInjection Container / Service LocatorStatic abuse / Implicit dependencies

Declarative styleLaw of Demeter

Extended SOLIDSOLIDGetters and setters are evilLocal retention / Encapsulation

ModularityAnemic modelHexagonal architectureVertical & horizontal mental model

Test harness and test doubles Parallel change refactoringMikado method Self similarity principle

Inversion of Control

Tools & topics about code dependency management

Page 92: Software economics: tradeoffs of decoupled softwre

Context Boundaries Dependency Injection by constructorInjection Container / Service LocatorStatic abuse / Implicit dependencies

Declarative styleLaw of Demeter

Extended SOLIDSOLIDGetters and setters are evilLocal retention / Encapsulation

ModularityAnemic modelHexagonal architectureVertical & horizontal mental model

Test harness and test doubles Parallel change refactoringMikado method Self similarity principle

Inversion of Control

This talk

Page 93: Software economics: tradeoffs of decoupled softwre

We need a holistic approach

Abstraction - composition - dependencies

cost to understand - change - evolve

Warning

Page 94: Software economics: tradeoffs of decoupled softwre

Dependencies are just a lens from which to analyze software

There are other lenses

Warning

Page 95: Software economics: tradeoffs of decoupled softwre

2

Reusing is creating dependencies

Good code supports Options

Stop thinking in individual classes

1

3

Page 96: Software economics: tradeoffs of decoupled softwre

1Reusing is creating dependencies

Page 97: Software economics: tradeoffs of decoupled softwre

This is our project

Page 98: Software economics: tradeoffs of decoupled softwre

Our project has one feature

Page 99: Software economics: tradeoffs of decoupled softwre

We need to deliver a new feature

Page 100: Software economics: tradeoffs of decoupled softwre

We need something similar to the already existing feature

Page 101: Software economics: tradeoffs of decoupled softwre

We copy & paste some code from other feature

Page 102: Software economics: tradeoffs of decoupled softwre

The cost of change is now x2 more expensive

Page 103: Software economics: tradeoffs of decoupled softwre

We extract that piece of code to a common place

Page 104: Software economics: tradeoffs of decoupled softwre

We have decreased the cost of change by half

Page 105: Software economics: tradeoffs of decoupled softwre

Now all our features have a new dependency

Page 106: Software economics: tradeoffs of decoupled softwre

New features can reuse that code

Page 107: Software economics: tradeoffs of decoupled softwre

We achieve economies of scale

Page 108: Software economics: tradeoffs of decoupled softwre

cost

of i

ntro

duci

ng

a ne

w fe

atur

e

Page 109: Software economics: tradeoffs of decoupled softwre

cost

of i

ntro

duci

ng

a ne

w fe

atur

e

time

Page 110: Software economics: tradeoffs of decoupled softwre

cost

of i

ntro

duci

ng

a ne

w fe

atur

e

time

reality

Page 111: Software economics: tradeoffs of decoupled softwre

cost

of i

ntro

duci

ng

a ne

w fe

atur

e

time

reality

New dependency is created

Page 112: Software economics: tradeoffs of decoupled softwre

cost

of i

ntro

duci

ng

a ne

w fe

atur

e

time

reality

New dependency is created theory

Economies of scale tell us that it should go down like this

Page 113: Software economics: tradeoffs of decoupled softwre

cost

of i

ntro

duci

ng

a ne

w fe

atur

e

time

theory

reality

Reality tells us a different story

Page 114: Software economics: tradeoffs of decoupled softwre

We have a dependency mess

Page 115: Software economics: tradeoffs of decoupled softwre

cost

of i

ntro

duci

ng

a ne

w fe

atur

e

time

theory

reality

Our dependency mess pushes our costs up

Page 116: Software economics: tradeoffs of decoupled softwre

cost

of i

ntro

duci

ng

a ne

w fe

atur

e

time

We need to watch dependencies and manage them

Dependencies get messy

Page 117: Software economics: tradeoffs of decoupled softwre

cost

of i

ntro

duci

ng

a ne

w fe

atur

e

time

We need to watch dependencies and manage them

Dependencies get messy

Investment on dependency management

Page 118: Software economics: tradeoffs of decoupled softwre

cost

of i

ntro

duci

ng

a ne

w fe

atur

e

time

We need to watch dependencies and manage them

Page 119: Software economics: tradeoffs of decoupled softwre

cost

of i

ntro

duci

ng

a ne

w fe

atur

e

time

We need to watch dependencies and manage them

Page 120: Software economics: tradeoffs of decoupled softwre

cost

of i

ntro

duci

ng

a ne

w fe

atur

e

time

We need to watch dependencies and manage them

Page 121: Software economics: tradeoffs of decoupled softwre

cost

of i

ntro

duci

ng

a ne

w fe

atur

e

time

We need to watch dependencies and manage them

Page 122: Software economics: tradeoffs of decoupled softwre

cost

of i

ntro

duci

ng

a ne

w fe

atur

e

time

We need to watch dependencies and manage them

Page 123: Software economics: tradeoffs of decoupled softwre

Vertical-horizontal mindset

Page 124: Software economics: tradeoffs of decoupled softwre

Vertical slice

Vertical slice

Vertical slice

Vertical slice

Horizontal slice

We need some rules to allow dependencies to exist

Page 125: Software economics: tradeoffs of decoupled softwre

Vertical slice

Vertical slice

Vertical slice

Vertical slice

Horizontal slice

We allow dependencies on horizontal slices (common code)

Page 126: Software economics: tradeoffs of decoupled softwre

Vertical slice

Vertical slice

Vertical slice

Vertical slice

Horizontal slice

We forbid to depend on vertical slices

Page 127: Software economics: tradeoffs of decoupled softwre

Vertical slice

Vertical slice

Vertical slice

Vertical slice

Horizontal slice

We also forbid dependencies between vertical slices

Page 128: Software economics: tradeoffs of decoupled softwre

Vertical slice

Vertical slice

Vertical slice

Horizontal slice

Self-similarity principle applies to vertical slices as well

Page 129: Software economics: tradeoffs of decoupled softwre

Vertical slice

Vertical slice

Vertical slice

Horizontal slice

We can completely remove a Vertical slice and nothing gets broken

Vertical slice

Page 130: Software economics: tradeoffs of decoupled softwre

How do we balance low dependencies with code reuse?

Under which circumstances do we allow ourselves to break our rules?

Page 131: Software economics: tradeoffs of decoupled softwre

2Good code supports business options

Page 132: Software economics: tradeoffs of decoupled softwre

Business Options

Page 133: Software economics: tradeoffs of decoupled softwre

time

Our schedule

Start working today

Page 134: Software economics: tradeoffs of decoupled softwre

time

Deploy next month

Our schedule

Page 135: Software economics: tradeoffs of decoupled softwre

time

Our progress

Page 136: Software economics: tradeoffs of decoupled softwre

time

Our progress

Business needs a demo!

Page 137: Software economics: tradeoffs of decoupled softwre

Option 1: Not giving options

Page 138: Software economics: tradeoffs of decoupled softwre

Option 1: Not giving optionsNot professional

Page 139: Software economics: tradeoffs of decoupled softwre

Option 2: Deploy something smaller

Page 140: Software economics: tradeoffs of decoupled softwre

Option 2: Deploy something smallerCan you do that?

Page 141: Software economics: tradeoffs of decoupled softwre

Interfaces and Inversion of Control

Page 142: Software economics: tradeoffs of decoupled softwre

NotificationPort

Our appNotification Component

When you’re implementing someone’s Interface, you’re bound by its API and dependencies

uses

Page 143: Software economics: tradeoffs of decoupled softwre

NotificationPort

Our appNotification Component

When you own an Interface, you make the rules

extends

Page 144: Software economics: tradeoffs of decoupled softwre

When dealing with external dependencies, you can switch the place of the

Interfaces involved

Page 145: Software economics: tradeoffs of decoupled softwre

Switching interfaces’ places is Inversion of Control

Page 146: Software economics: tradeoffs of decoupled softwre

This gives you freedom for new implementations

Page 147: Software economics: tradeoffs of decoupled softwre

This gives you freedom for new Options

Page 148: Software economics: tradeoffs of decoupled softwre

time

Original schedule

Page 149: Software economics: tradeoffs of decoupled softwre

time

Our design includes IoC

Original schedule

IoC

Page 150: Software economics: tradeoffs of decoupled softwre

We buy an option

time

We deploy a smaller version for the demo

IoC

Original schedule

Page 151: Software economics: tradeoffs of decoupled softwre

time

We finish our work and deploy the final version, which uses Amazon SMS

IoC

Original schedule

Page 152: Software economics: tradeoffs of decoupled softwre

Extra cost

time

We’ve payed an extra cost but we’ve made it to the demo

IoC

Original schedule

Page 153: Software economics: tradeoffs of decoupled softwre

Hexagonal Architecture

Page 154: Software economics: tradeoffs of decoupled softwre

Hexagonal architecture applies IoC across your design

Page 155: Software economics: tradeoffs of decoupled softwre

We focus on what we need and then we write code that complies

Page 156: Software economics: tradeoffs of decoupled softwre

Our needs are defined in Ports and the implementations are called Adapters

JavaX

Mail

Amazon

SMS

Notifications

Port

Page 157: Software economics: tradeoffs of decoupled softwre

Adapters are interchangeable

JavaX

Mail

Amazon

SMS

Notifications

Port

Page 158: Software economics: tradeoffs of decoupled softwre

JavaX

MailAmazon

SMS

Adapters are interchangeable

Notifications

Port

Page 159: Software economics: tradeoffs of decoupled softwre

Ports are interfaces declared on our app’s

package system

Page 160: Software economics: tradeoffs of decoupled softwre

com.programania.coolapp.NotificationsPort

Adapters use foreign package systems

javax.mail.*

Page 161: Software economics: tradeoffs of decoupled softwre

com.programania.coolapp.NotificationsPort

Adapters extend our app’s Ports

javax.mail.*

Page 162: Software economics: tradeoffs of decoupled softwre

com.programania.coolapp.NotificationsPort

Internals depend on internals

javax.mail.*

Page 163: Software economics: tradeoffs of decoupled softwre

com.programania.coolapp.NotificationsPort

By doing this, we’re inverting the control

(IoC) in our app

javax.mail.*

Page 164: Software economics: tradeoffs of decoupled softwre

How do we choose what’s inside the Hexagon and what lies outside?

Your design needs to support Options but how do you balance it with Y.A.G.N.I.?

How are you going to defer decisions?

Page 165: Software economics: tradeoffs of decoupled softwre

3Stop thinking in individual classes

Page 166: Software economics: tradeoffs of decoupled softwre

Module, component or hexagon. They’re the same: a cluster of classes

Page 167: Software economics: tradeoffs of decoupled softwre

Remember those extended S.O.L.I.D. principles

Page 168: Software economics: tradeoffs of decoupled softwre
Page 169: Software economics: tradeoffs of decoupled softwre

Inside a component, classes and dependencies can be unstable

Page 170: Software economics: tradeoffs of decoupled softwre

Outside the component, dependencies are few and stable

Page 171: Software economics: tradeoffs of decoupled softwre

Single Responsibility Principle of a class

Page 172: Software economics: tradeoffs of decoupled softwre

Single Responsibility Principle of a class module

Page 173: Software economics: tradeoffs of decoupled softwre

Class Responsibility and Collaborators (dependencies)

Page 174: Software economics: tradeoffs of decoupled softwre

Class Component Responsibility and Collaborators (dependencies)

Page 175: Software economics: tradeoffs of decoupled softwre

Class Level Testing

Page 176: Software economics: tradeoffs of decoupled softwre

Class Module Level Testing

Page 177: Software economics: tradeoffs of decoupled softwre

Insights and take aways

Page 178: Software economics: tradeoffs of decoupled softwre

An economic mindset lets you stay in sync with business and make better decisions

Page 179: Software economics: tradeoffs of decoupled softwre

Cost of software is the cost of evolving software

Page 180: Software economics: tradeoffs of decoupled softwre

Principles are greatWhat will you do when they contradict?

Page 181: Software economics: tradeoffs of decoupled softwre

Context is primordial(search for it when reading the next success story)

Page 182: Software economics: tradeoffs of decoupled softwre

Tradeoffs are not staticThey are in constant tension through a project

Page 183: Software economics: tradeoffs of decoupled softwre

Reusing is creating dependencies

Page 184: Software economics: tradeoffs of decoupled softwre

IoC is about switching interfaces’ places

Page 185: Software economics: tradeoffs of decoupled softwre

Stop thinking about individual classesStart considering cluster of classes, seek cohesion and

analyze dependencies

Page 186: Software economics: tradeoffs of decoupled softwre

Thanks!