understanding software engineering with equations

41
UNDERSTANDING SOFTWARE DEV USING EQUATIONS [email protected] @jacdevos

Upload: jacques-de-vos

Post on 22-Jan-2018

218 views

Category:

Software


0 download

TRANSCRIPT

UNDERSTANDING SOFTWARE DEV

USING EQUATIONS

[email protected]

@jacdevos

Why this talk?

• Hard!

• Non-intuitive

• Misunderstood

• Seen as black-art done by amateurs

Software engineering is:

I’m not a mathematician

Mental models, rather than

precise calculations

Why do systems get so

complicated?

Handing complexity with

𝒏 𝒏 − 𝟏

𝟐

10

1

2

34

5

𝒏 𝒏 − 𝟏

𝟐

66

12

3

4

5

67

8

9

10

11

12

Complexity is caused by:

quadratic increase in

connections

How do we reduce complexity?

4

44 3

15!1

2

3

4

5

6

7

8

9

10

11

12

Org structure

or

Code structure?

Design reduces dependencies

Summary:

What is the effect of messy

code?

Go slow to go fast with

𝑻 𝒏 = 𝑶(𝒏)

0

50

100

150

200

250

300

10 20 30 40 50 60 70 80 90 100

TIM

E+

RIS

K T

O M

AK

E C

HA

NG

E

FEATURES BUILT

CODE CHANGE COMPLEXITY

O(n) O(n2)

Clean Code gives

• Easy to read

• SOLID design

• Boy scout refactoring

• Self-testing

• TDD

𝑶(𝒏)

Messy code gives

• Manual regression testing

• Spaghetti dependencies

• Hart to understand

𝑶(𝒏𝟐)

Your algorithm of work

determines order of time

complexity

In summary

We’re so busy! Why don’t we get

stuff done?

Credit: http://www.autoevolution.com/

Maximise efficiency with

𝑭𝒍𝒐𝒘 = 𝑺𝒑𝒆𝒆𝒅 . 𝑫𝒆𝒏𝒔𝒊𝒕𝒚

𝑽𝒆𝒉𝒊𝒄𝒍𝒆𝒔

𝑯𝒐𝒖𝒓=

𝑴𝒆𝒕𝒆𝒓𝒔

𝑯𝒐𝒖𝒓.𝑽𝒆𝒉𝒊𝒄𝒍𝒆𝒔

𝑴𝒆𝒕𝒆𝒓

youtu.be/Suugn-p5C1M

0

2000

4000

6000

8000

10000

12000

14000

16000

18000

0

20

40

60

80

100

120

140

50 100 150 200 250 300 350 400 450 500

FL

OW

RA

TE

(V

EH

ICLE

S/H

OU

R)

SP

EE

D (

KIL

OM

ET

ER

/HO

UR

)

DENSITY (VEHICLES/KILOMETER)

OPTIMAL FLOW

Speed (Km/h) Flow (Vehicles/h)

UnstableStable

Speed decreases as

density increases.

This is not intuitive.

Optimum flow at

speed 60 and

density 250.

Neither MAXED!

Speed = (1 – Density . JamDens) . MaxSpeed

How does this apply to software?

• 𝐹𝑙𝑜𝑤 = 𝑆𝑝𝑒𝑒𝑑. 𝐷𝑒𝑛𝑠𝑖𝑡𝑦

• Velocity = Throughput = Flow (avg # features delivered per week)• WIP = Density (avg # features started but not completed)

• 𝐶𝑦𝑐𝑙𝑒 𝑡𝑖𝑚𝑒 =1

𝑆𝑝𝑒𝑒𝑑(avg time it takes to complete a feature)

• 𝑇ℎ𝑜𝑢𝑔ℎ𝑝𝑢𝑡 =𝑊𝐼𝑃

𝐶𝑦𝑐𝑙𝑒 𝑇𝑖𝑚𝑒(aka Little’s Law)

𝑽𝒆𝒍𝒐𝒄𝒊𝒕𝒚 =𝑨𝒗𝒈 𝒇𝒆𝒂𝒕𝒖𝒓𝒆𝒔 𝒊𝒏 𝒑𝒓𝒐𝒈𝒓𝒆𝒔𝒔

𝑨𝒗𝒈 𝒕𝒊𝒎𝒆 𝒕𝒐 𝒄𝒐𝒎𝒑𝒍𝒆𝒕𝒆 𝒂 𝒇𝒆𝒂𝒕𝒖𝒓𝒆

In summary

Improve continuously with

𝑨 = 𝑷𝒆𝒓𝒕

http://jamesclear.com/marginal-gains

• r = -1% per week (decay rate)

• t = 104 weeks/2 years (time in weeks)

This gives us

• 34% of original

• Degraded 66% over 2 years!

Is this how technical debt behaves?

𝒆𝒓𝒕

• r = 1% per week (improvement rate)

• t = 104 weeks/2 years (time in weeks)

This gives us

• 294% improvement over 2 years!

𝑰𝒎𝒑𝒓𝒐𝒗𝒆𝒎𝒆𝒏𝒕 = 𝒆𝒓𝒕

In summary

Simplify by removing dependencies

Go slow to go fast

Remove congestion to flow

Continuous improvement compounds

Other equations

• Entropy

• Bayesian Inference

• The software engineering equation

• Yours?

[email protected]

@jacdevos

DISCUSS.