Choice Is the Enemy of Good

A presentation at Voxxed Days Thessaloniki 2022 in June 2022 in Thessaloniki, Greece by William Bartlett

Slide 1

Slide 1

Choice is the Enemy of Good � William Bartlett william.bartlett@zenika.com � @bartlettstarman � punkstarman � punkstarman Zenika William Bartlett (@bartlettstarman) Choice is the Enemy of Good 1 / 46

Slide 2

Slide 2

Γειά σας! Με λένε Γουίλιαμ. Είμαι Βρετανός και Αμερικανός. Μένω στη Νάντη στη Γαλλία. Είμαι σύμβουλος στo Ζένικα. William Bartlett (@bartlettstarman) Choice is the Enemy of Good 2 / 46

Slide 3

Slide 3

William Bartlett (@bartlettstarman) Choice is the Enemy of Good 3 / 46

Slide 4

Slide 4

William Bartlett (@bartlettstarman) Choice is the Enemy of Good 4 / 46

Slide 5

Slide 5

William Bartlett (@bartlettstarman) Choice is the Enemy of Good 5 / 46

Slide 6

Slide 6

William Bartlett (@bartlettstarman) Choice is the Enemy of Good 6 / 46

Slide 7

Slide 7

William Bartlett (@bartlettstarman) Choice is the Enemy of Good 7 / 46

Slide 8

Slide 8

William Bartlett (@bartlettstarman) Choice is the Enemy of Good 8 / 46

Slide 9

Slide 9

We have yet to write a single line of business logic William Bartlett (@bartlettstarman) Choice is the Enemy of Good 9 / 46

Slide 10

Slide 10

We have yet to write a single line of business logic Other programming languages have similar problems. William Bartlett (@bartlettstarman) Choice is the Enemy of Good 9 / 46

Slide 11

Slide 11

How can we get stuff done and feel good about it? William Bartlett (@bartlettstarman) Choice is the Enemy of Good 10 / 46

Slide 12

Slide 12

Agile processes promote sustainable development. The sponsors, developers, and users should be able to maintain a constant pace indefinitely. — Agile Manifesto William Bartlett (@bartlettstarman) Choice is the Enemy of Good 11 / 46

Slide 13

Slide 13

Sustainable development is development that meets the needs of the present without compromising the ability of future generations to meet their own needs. — Brundtland Report William Bartlett (@bartlettstarman) Choice is the Enemy of Good 12 / 46

Slide 14

Slide 14

How do we choose? Section 1 How do we choose? William Bartlett (@bartlettstarman) Choice is the Enemy of Good 13 / 46

Slide 15

Slide 15

How do we choose? Reason William Bartlett (@bartlettstarman) Choice is the Enemy of Good 14 / 46

Slide 16

Slide 16

How do we choose? William Bartlett (@bartlettstarman) Choice is the Enemy of Good 15 / 46

Slide 17

Slide 17

How do we choose? Emotion William Bartlett (@bartlettstarman) Choice is the Enemy of Good 16 / 46

Slide 18

Slide 18

How do we choose? Emotion 4. Rationalizing an emotional decision. Go was fun. It felt right. We thought: “if we’re willing to adopt Go on a gut feeling, maybe other systems geeks will be too? And wouldn’t it be cool if we could get them to feel that way about Docker, too?” — � Solomon Hykes William Bartlett (@bartlettstarman) Choice is the Enemy of Good 17 / 46

Slide 19

Slide 19

How do we choose? Emotion Reason is, and ought only to be the slave of the passions, and can never pretend to any other office than to serve and obey them. — David Hume. A Treatise of Human Nature William Bartlett (@bartlettstarman) Choice is the Enemy of Good 18 / 46

Slide 20

Slide 20

How do we choose? Observation CC-BY-SA-3.0 Olga Tarkovskiy (Wikimedia Commons) William Bartlett (@bartlettstarman) Choice is the Enemy of Good 19 / 46

Slide 21

Slide 21

How do we choose? Lifecycle Early adopters Early majority Late majority Laggards because of how because of why because of others because of obligation chasm Diffusion of Innovation. Everett Rogers. 1962 — Crossing the Chasm. Geoffrey A. Moore. 1991 William Bartlett (@bartlettstarman) Choice is the Enemy of Good 20 / 46

Slide 22

Slide 22

How do we choose? Luck William Bartlett (@bartlettstarman) Choice is the Enemy of Good 21 / 46

Slide 23

Slide 23

How do we choose? Luck [Luck] plays a very large role in every story of success. — Daniel Kahneman. Thinking, Fast and Slow William Bartlett (@bartlettstarman) Choice is the Enemy of Good 22 / 46

Slide 24

Slide 24

Contextual Decision-Making Section 2 Contextual Decision-Making William Bartlett (@bartlettstarman) Choice is the Enemy of Good 23 / 46

Slide 25

Slide 25

Contextual Decision-Making Cynefin Cynefin (Κυνέβιν) Complex Complicated AC Chaotic A = Aporia Sense-making framework created by Dave Snowden Clear C = Confused William Bartlett (@bartlettstarman) Choice is the Enemy of Good 24 / 46

Slide 26

Slide 26

Contextual Decision-Making Cynefin Clear Predictable cause and effect known to all I Apply best practices I Take time for tech watch Examples: I indentation, code style I sorting algorithm William Bartlett (@bartlettstarman) Choice is the Enemy of Good 25 / 46

Slide 27

Slide 27

Contextual Decision-Making I have yet to see any problem, however complicated, which, when you looked at it in the right way, did not become still more complicated. — Anderson’s Law William Bartlett (@bartlettstarman) Choice is the Enemy of Good 26 / 46

Slide 28

Slide 28

Contextual Decision-Making Cynefin Complicated Predictable cause and effect known to experts I Ask experts, rely on experience I Use analysis expertise is lacking I Share expertise, when needed Examples: I testing strategies I security William Bartlett (@bartlettstarman) Choice is the Enemy of Good 27 / 46

Slide 29

Slide 29

Contextual Decision-Making Cynefin Complex Any action has unintended consequences Examples: I large-scale distributed systems I organizations, teams William Bartlett (@bartlettstarman) Choice is the Enemy of Good 28 / 46

Slide 30

Slide 30

Contextual Decision-Making Cynefin Complex Any action has unintended consequences I Diversity William Bartlett (@bartlettstarman) Choice is the Enemy of Good 28 / 46

Slide 31

Slide 31

Contextual Decision-Making Cynefin Complex Any action has unintended consequences I Diversity I Do the next right thing (coherence) William Bartlett (@bartlettstarman) Choice is the Enemy of Good 28 / 46

Slide 32

Slide 32

Contextual Decision-Making Cynefin Complex Any action has unintended consequences I Diversity I Do the next right thing (coherence) I Keep options open William Bartlett (@bartlettstarman) Choice is the Enemy of Good 28 / 46

Slide 33

Slide 33

Contextual Decision-Making Cynefin Complex Any action has unintended consequences I I I I Diversity Do the next right thing (coherence) Keep options open Let the market decide William Bartlett (@bartlettstarman) Choice is the Enemy of Good 28 / 46

Slide 34

Slide 34

Contextual Decision-Making Cynefin Complex Any action has unintended consequences I I I I I Diversity Do the next right thing (coherence) Keep options open Let the market decide Document decisions (Architecture Decision Record) William Bartlett (@bartlettstarman) Choice is the Enemy of Good 28 / 46

Slide 35

Slide 35

Contextual Decision-Making Parallel safe to fail probes When trying something new, do it on a scale where failure is survivable. — Peter Palchinsky’s 2nd principle William Bartlett (@bartlettstarman) Choice is the Enemy of Good 29 / 46

Slide 36

Slide 36

Contextual Decision-Making Parallel safe to fail probes When trying something new, do it on a scale where failure is survivable. — Peter Palchinsky’s 2nd principle Nothing is more dangerous than an idea when it is the only one you have. — Emile Chartier William Bartlett (@bartlettstarman) Choice is the Enemy of Good 29 / 46

Slide 37

Slide 37

Contextual Decision-Making Retrospective Prime Directive Regardless of what we discover, we understand and truly believe that everyone did the best job they could, given what they knew at the time, their skills and abilities, the resources available, and the situation at hand. — Norm Kerth. Project Retrospectives: A Handbook for Team Review William Bartlett (@bartlettstarman) Choice is the Enemy of Good 30 / 46

Slide 38

Slide 38

Plan-Do-Study-Act Section 3 Plan-Do-Study-Act William Bartlett (@bartlettstarman) Choice is the Enemy of Good 31 / 46

Slide 39

Slide 39

Plan-Do-Study-Act Plan-Do-Study-Act Plan Do Act Study William Bartlett (@bartlettstarman) Choice is the Enemy of Good 32 / 46

Slide 40

Slide 40

Plan-Do-Study-Act Plan-Do-Study-Act I renders certain arguments unnecessary William Bartlett (@bartlettstarman) Choice is the Enemy of Good 33 / 46

Slide 41

Slide 41

Plan-Do-Study-Act Plan-Do-Study-Act I renders certain arguments unnecessary I pushes us to debate facts instead of fiction William Bartlett (@bartlettstarman) Choice is the Enemy of Good 33 / 46

Slide 42

Slide 42

Plan-Do-Study-Act Plan-Do-Study-Act I renders certain arguments unnecessary I pushes us to debate facts instead of fiction I allows codebases to mature at the same rate as the team William Bartlett (@bartlettstarman) Choice is the Enemy of Good 33 / 46

Slide 43

Slide 43

Plan-Do-Study-Act Malleable Code Malleability enhances PDSA William Bartlett (@bartlettstarman) Choice is the Enemy of Good 34 / 46

Slide 44

Slide 44

Plan-Do-Study-Act Malleable Code Malleability enhances PDSA I Disposability William Bartlett (@bartlettstarman) Choice is the Enemy of Good 34 / 46

Slide 45

Slide 45

Plan-Do-Study-Act Malleable Code Malleability enhances PDSA I Disposability I Decoupling William Bartlett (@bartlettstarman) Choice is the Enemy of Good 34 / 46

Slide 46

Slide 46

Plan-Do-Study-Act Malleable Code Malleability enhances PDSA I Disposability I Decoupling I Test-Driven Development William Bartlett (@bartlettstarman) Choice is the Enemy of Good 34 / 46

Slide 47

Slide 47

Plan-Do-Study-Act What TDD is not TDD is not I writing the tests before the code I unit testing every single function I a substitute for other forms of testing William Bartlett (@bartlettstarman) Choice is the Enemy of Good 35 / 46

Slide 48

Slide 48

Plan-Do-Study-Act What TDD is Plan refactor code to match Do Act Study William Bartlett (@bartlettstarman) write test that fails write code why code works Choice is the Enemy of Good 36 / 46

Slide 49

Slide 49

Plan-Do-Study-Act What TDD accomplishes Plan prove flexibility Do Act Study William Bartlett (@bartlettstarman) choose an outcome experiment learn Choice is the Enemy of Good 37 / 46

Slide 50

Slide 50

Plan-Do-Study-Act Evolution of a Java Programmer public class Factorial { public long factorial(long n) { … } } William Bartlett (@bartlettstarman) Choice is the Enemy of Good 38 / 46

Slide 51

Slide 51

Plan-Do-Study-Act Evolution of a Java Programmer Java 1.1 - simple and effective public long factorial(long n) { long result = 1; for (long i=1; i<=n; i++) { result = result * i; } return result; } William Bartlett (@bartlettstarman) Choice is the Enemy of Good 39 / 46

Slide 52

Slide 52

Plan-Do-Study-Act Evolution of a Java Programmer Java 1.2 - Collections public long factorial(long n) { List factors = new ArrayList(); for (long i=1; i<=n; i++) { factors.add(i); } long result = 1; Iterator it = factors.iterator(); while (it.hasNext()) { long factor = ((Long)it.next()).longValue(); result *= factor; } return result; } William Bartlett (@bartlettstarman) Choice is the Enemy of Good 40 / 46

Slide 53

Slide 53

Plan-Do-Study-Act Evolution of a Java Programmer Java 5 - Generics and foreach loops public long factorial(long n) { List<Long> factors = new ArrayList<Long>(); for (long i=1; i<=n; i++) { factors.add(i); } long result = 1; for (long factor: factors) { result *= factor; } return result; } William Bartlett (@bartlettstarman) Choice is the Enemy of Good 41 / 46

Slide 54

Slide 54

Plan-Do-Study-Act Evolution of a Java Programmer Java 7 - Parallelism public long factorial(long n) { ForkJoinPool pool = new ForkJoinPool(); return pool.invoke(new FactorialTask(1, n)); } William Bartlett (@bartlettstarman) Choice is the Enemy of Good 42 / 46

Slide 55

Slide 55

Plan-Do-Study-Act Evolution of a Java Programmer Java 7 - Parallelism class FactorialTask extends RecursiveTask<Long> { @Override protected Long compute() { if (lo > hi) return 1L; if (lo == hi) return lo; } long mid = (lo + hi) / 2L; FactorialTask f1 = new FactorialTask(lo, mid); f1.fork(); FactorialTask f2 = new FactorialTask(mid + 1L, hi); return f2.compute() * f1.join(); } William Bartlett (@bartlettstarman) Choice is the Enemy of Good 43 / 46

Slide 56

Slide 56

Plan-Do-Study-Act Evolution of a Java Programmer Java 8 - Functional streams public long factorial(long n) { return LongStream .rangeClosed(1, n) .reduce(1, (a, b) -> a * b); } William Bartlett (@bartlettstarman) Choice is the Enemy of Good 44 / 46

Slide 57

Slide 57

Conclusion Section 4 Conclusion William Bartlett (@bartlettstarman) Choice is the Enemy of Good 45 / 46

Slide 58

Slide 58

Conclusion Choice Is the Enemy of Good Don’t complicate things needlessly Develop and use expert knowledge and experience Plan-Do-Study-Act (TDD) Do the next right thing Keep options open William Bartlett (@bartlettstarman) Choice is the Enemy of Good 46 / 46