complex is easy -...
TRANSCRIPT
COMPLEX IS EASY, IT’S SIMPLE WHICH IS HARD
@sarahtarap
SARAH TARAPOREWALLA
TECH PRINCIPAL @sarahtarap
3
Let’s Explore
1 Complexity in the Real World
2 How does it happen?
3 The One About The Checkbox
4 The One About The Fortress
5 The One About The Article
6 The One about the Pricing Rules
@sarahtarap
@sarahtarap
Complexity in the Real World
@sarahtarap
Phot
o co
urte
sy o
f htt
ps://
ww
w.fl
ickr
.com
/pho
tos/
chiro
prac
tic/3
7324
9773
1/
@sarahtarap Phot
o co
urte
sy o
f htt
ps://
ww
w.la
may
or.o
rg/m
ayor
-gar
cett
i-unv
eils
-new
-eas
y-re
ad-p
arki
ng-s
igns
@sarahtarap Phot
o co
urte
sy o
f hht
tps:
//w
ww
.rd.c
om/a
dvic
e/sa
ving
-mon
ey/g
roce
ry-s
hopp
ing-
mis
take
s-th
at-a
re-w
astin
g-m
oney
/
@sarahtarap
Phot
o co
urte
sy o
f htt
ps://
com
mon
s.w
ikim
edia
.org
/wik
i/File
:Vei
n_ar
t_ne
ar.p
ng
@sarahtarap
Phot
o co
urte
sy o
f htt
p://
ww
w.s
tjohn
nsw
.com
.au/
@sarahtarap
Phot
o co
urte
sy o
f htt
ps://
ww
w.c
row
dris
e.co
m/h
ands
only
cpr
@sarahtarap
CYNEFIN FRAMEWORK
11
Phot
o co
urte
sy o
fhtt
ps://
en.w
ikip
edia
.org
/wik
i/Cyn
efin_
fram
ewor
k#/m
edia
/File
:Cyn
efin_
fram
ewor
k,_F
ebru
ary_
2011
_(2)
.jpeg
@sarahtarap
How does it happen?
@sarahtarap
2 6 8
@sarahtarap
2 6 81 3 4
@sarahtarap
2 6 81 3 42 5 7
@sarahtarap
2 6 81 3 42 5 75 8 11
@sarahtarap
2 6 81 3 42 5 75 8 11
x < y < z
@sarahtarap
Phot
o co
urte
sy o
f htt
ps://
cdn.
pixa
bay.c
om/p
hoto
/201
4/03
/24/
17/1
6/br
ain-
2952
91_9
60_7
20.p
ng
@sarahtarap Phot
o co
urte
sy o
f htt
ps://
bett
erhu
man
s.co
ach.
me/
cogn
itive
-bia
s-ch
eat-s
heet
-55a
4724
76b1
8
@sarahtarap
@sarahtarap
@sarahtarap
The One About The Checkbox
@sarahtarap
SIMPLE CODE MANIFESTO
23
Composition Matchers
Tiny Types SRP
Decorators
Inheritance If-Then-Else Primitives Fat Objects Mixed Concerns
over over over over over
@sarahtarap starapor
@sarahtarap
BOY SCOUT RULE
Phot
o co
urte
sy o
f htt
p://
disn
ey.w
ikia
.com
/wik
i/Rus
sell
@sarahtarap
RED GREEN
REFACTOR
REFACTOR
26
@sarahtarap
RED GREEN
REFACTOR
REFACTOR
27
REFACTOR REVERT
REFACTOR COMMIT
@sarahtarap
Trailing commas in lists _matcher = new Matcher<Player> { { p => p.InPenaltyBox(), ReducePenaltyTime }, { p => p.WearingAHat(), RemoveTheHat }, { p => true, PlayARound }, };Brackets { } around conditionals
public void TakeTurn(Player player) { if (player.InPenaltyBox()) { ReducePenaltyTime(); }}
GOOD CITIZEN
28
@sarahtarap
INTENTION REVEALING INTERFACES
29
IFooHandler => IHandleLotsOfFoos IGameRepository => ICanFindTheGame
@sarahtarap
SIDE-EFFECT FREE CODE
30
Phot
o co
urte
sy o
f htt
ps://
xkcd
.com
/326
/
@sarahtarap
SQUINT TEST
Phot
o co
urte
sy o
f htt
ps://
uplo
ad.w
ikim
edia
.org
/wik
iped
ia/e
n/7/
7b/S
nelle
n-m
yopi
a.pn
g
@sarahtarap
SSimple Code
Manifesto
@sarahtarap
The One About The Fortress
@sarahtarap
JOB SECURITY
34
Phot
o co
urte
sy o
f htt
ps://
imgu
r.com
/gal
lery
/08Z
xbv0
@sarahtarap
OPENNESS & COLLABORATION
35
@sarahtarap
OOpenness
and Collaboration
@sarahtarap
The One About The Article
@sarahtarap
DOMAIN DRIVEN DESIGN
38
@sarahtarap
UBIQUITOUS LANGUAGE
39
Phot
o co
urte
sy o
f htt
p://
pngi
mg.
com
/dow
nloa
d/51
770
@sarahtarap
BOUNDED CONTEXTS
40
Phot
o co
urte
sy o
f htt
ps://
mar
tinfo
wle
r.com
/blik
i/Bou
nded
Cont
ext.h
tml
@sarahtarap
DOMAIN DRIVEN DESIGN
41
@sarahtarap
DOMAIN DRIVEN DESIGN
42
@sarahtarap
UUbiquitous Language &
DDD
@sarahtarap
The One About The Legacy
@sarahtarap
EXPLAIN YOUR SYSTEM
Phot
o co
urte
sy o
f htt
p://
evan
.bot
tch.
com
/wp-
cont
ent/
uplo
ads/
2010
/06/
whi
tebo
ard.
jpg
@sarahtarap
SIMON BROWN’S C4 MODEL
@sarahtarap
DESIGN-ON-A-POST-IT
Phot
o co
urte
sy o
f htt
p://
evan
.bot
tch.
com
/wp-
cont
ent/
uplo
ads/
2010
/06/
whi
tebo
ard.
jpg
@sarahtarap
PPost-it Design
@sarahtarap
The One About The Pricing Rules
@sarahtarap
GENERALISE
SPECIALISE
@sarahtarap
SSpecialise to Generalise
@sarahtarap
To Recap
@sarahtarap
SSimple Code
Manifesto
OOpenness
and Collaboration
UUbiquitous Language &
DDD
PPost-it Design
SSpecialise to Generalise
@sarahtarap
SARAH TARAPOREWALLA
@sarahtarap
SSimple Code
Manifesto
OOpenness
and Collaboration
UUbiquitous Language &
DDD
PPost-it Design
SSpecialise to Generalise
@sarahtarap
Q&A
THANKS FOR LISTENING @sarahtarap | [email protected]