Slide 1

Slide 1 text

Imperative Bowling Kata 20 Years On Delegating Menial Tasks to Github Copilot Chat using Scala in IntelliJ IDEA @philip_schwarz slides by https://fpilluminated.org/

Slide 2

Slide 2 text

In this deck we carry out a code kata for the game of Ten Pin Bowling. While we are going to use Test Driven Development (TDD), we are not going to write any code, and that is because we are going to delegate manual/menial work to Github Copilot. The tests that we are going to use, and the code that is going to get written, were captured 20 years ago in a deck written by Robert Martin and used by him to demonstrate TDD-based code katas. While the game is coded using the imperative programming paradigm, Robert Martin used Java, whereas we are going to use Scala. @philip_schwarz

Slide 3

Slide 3 text

Be warned that what follows is just an experiment. There is nothing prescriptive / exemplary / recommended about the experiment and about its parameters, e.g. • The programming paradigm used (imperative programming - shudder) • The contents of the copilot-instructions.md file used • The Github Copilot mode used (Agent) • The LLM model used (Claude Sonnet 4.6) • The particular prompts used - e.g. their length, their approach to expressing details, etc. Just because the above parameters had the intended consequences for the limited purpose of re-enacting a classic sample code kata, it doesn’t mean that they are of any particular merit. They were not the results of a planned strategy and/or tactics aimed at securing a desired outcome in terms of e.g. optimality, effectiveness, efficiency, productivity.

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

Bowling Game Code Kata

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

https://x.com/unclebobmartin http://cleancoder.com/products http://butunclebob.com/ … (continued) Robert C. Martin

Slide 10

Slide 10 text

http://butunclebob.com/FrontPage … (continuing)

Slide 11

Slide 11 text

http://butunclebob.com/ArticleS.UncleBob.TheProgrammingDojo

Slide 12

Slide 12 text

http://butunclebob.com/ArticleS.UncleBob.TheBowlingGameKata http://butunclebob.com/files/downloads/Bowling%20Game%20Kata.ppt … (continued)

Slide 13

Slide 13 text

… (continuing)

Slide 14

Slide 14 text

† slightly modified – e.g. with some highlighting and some annotations Let’s look at Robert Martin’s preamble section: "A Quick Design Session” †.

Slide 15

Slide 15 text

Bowling Game Kata Object Mentor, Inc. fitnesse.org Copyright © 2005 by Object Mentor, Inc All copies must retain this page unchanged. www.junit.org www.objectmentor.com blog.objectmentor.com

Slide 16

Slide 16 text

Scoring Bowling. The game consists of 10 frames as shown above. In each frame the player has two opportunities to knock down 10 pins. The score for the frame is the total number of pins knocked down, plus bonuses for strikes and spares. A spare is when the player knocks down all 10 pins in two tries. The bonus for that frame is the number of pins knocked down by the next roll. So in frame 3 above, the score is 10 (the total number knocked down) plus a bonus of 5 (the number of pins knocked down on the next roll.) A strike is when the player knocks down all 10 pins on his first try. The bonus for that frame is the value of the next two balls rolled. In the tenth frame a player who rolls a spare or strike is allowed to roll the extra balls to complete the frame. However no more than three balls can be rolled in tenth frame.

Slide 17

Slide 17 text

Scoring Bowling. The game consists of 10 frames as shown above. In each frame the player has two opportunities to knock down 10 pins. The score for the frame is the total number of pins knocked down, plus bonuses for strikes and spares. A spare is when the player knocks down all 10 pins in two tries. The bonus for that frame is the number of pins knocked down by the next roll. So in frame 3 above, the score is 10 (the total number knocked down) plus a bonus of 5 (the number of pins knocked down on the next roll.) A strike is when the player knocks down all 10 pins on his first try. The bonus for that frame is the value of the next two balls rolled. In the tenth frame a player who rolls a spare or strike is allowed to roll the extra balls to complete the frame. However no more than three balls can be rolled in tenth frame.

Slide 18

Slide 18 text

Scoring Bowling. The game consists of 10 frames as shown above. In each frame the player has two opportunities to knock down 10 pins. The score for the frame is the total number of pins knocked down, plus bonuses for strikes and spares. A spare is when the player knocks down all 10 pins in two tries. The bonus for that frame is the number of pins knocked down by the next roll. So in frame 3 above, the score is 10 (the total number knocked down) plus a bonus of 5 (the number of pins knocked down on the next roll.) A strike is when the player knocks down all 10 pins on his first try. The bonus for that frame is the value of the next two balls rolled. In the tenth frame a player who rolls a spare or strike is allowed to roll the extra balls to complete the frame. However no more than three balls can be rolled in tenth frame.

Slide 19

Slide 19 text

Scoring Bowling. The game consists of 10 frames as shown above. In each frame the player has two opportunities to knock down 10 pins. The score for the frame is the total number of pins knocked down, plus bonuses for strikes and spares. A spare is when the player knocks down all 10 pins in two tries. The bonus for that frame is the number of pins knocked down by the next roll. So in frame 3 above, the score is 10 (the total number knocked down) plus a bonus of 5 (the number of pins knocked down on the next roll.) A strike is when the player knocks down all 10 pins on his first try. The bonus for that frame is the value of the next two balls rolled. In the tenth frame a player who rolls a spare or strike is allowed to roll the extra balls to complete the frame. However no more than three balls can be rolled in tenth frame.

Slide 20

Slide 20 text

The Requirements. • Write a class named “Game” that has two methods – roll(pins : int) is called each time the player rolls a ball. The argument is the number of pins knocked down. – score() : int is called only at the very end of the game. It returns the total score for that game.

Slide 21

Slide 21 text

The Requirements. • Write a class named “Game” that has two methods – roll(pins : int) is called each time the player rolls a ball. The argument is the number of pins knocked down. – score() : int is called only at the very end of the game. It returns the total score for that game. Each pin knocked down adds 1 point to the score

Slide 22

Slide 22 text

The Requirements. • Write a class named “Game” that has two methods – roll(pins : int) is called each time the player rolls a ball. The argument is the number of pins knocked down. – score() : int is called only at the very end of the game. It returns the total score for that game.

Slide 23

Slide 23 text

A quick design session Clearly we need the Game class.

Slide 24

Slide 24 text

A quick design session A game has 10 frames.

Slide 25

Slide 25 text

A quick design session A frame has 1 or two rolls. In each frame the player has two opportunities to knock down 10 pins. The score for the frame is the total number of pins knocked down, plus bonuses for strikes and spares.

Slide 26

Slide 26 text

A quick design session The tenth frame has two or three rolls. It is different from all the other frames.

Slide 27

Slide 27 text

A quick design session The score function must iterate through all the frames, and calculate all their scores.

Slide 28

Slide 28 text

A quick design session The score for a spare or a strike depends on the frame’s successor A spare is when the player knocks down all 10 pins in two tries. The bonus for that frame is the number of pins knocked down by the next roll.

Slide 29

Slide 29 text

A quick design session The score for a spare or a strike depends on the frame’s successor A strike is when the player knocks down all 10 pins on his first try. The bonus for that frame is the value of the next two balls rolled.

Slide 30

Slide 30 text

The next slide contains links to YouTube videos that • may help to reinforce one’s understanding of the game • may appeal to people who prefer video over text

Slide 31

Slide 31 text

https://www.youtube.com/shorts/Gn3MadD0rOM https://youtu.be/a8lHGHJSmwQ https://youtu.be/GwDcwpfN4Ro https://youtu.be/yuSiy-D9ZdU https://youtu.be/mPmqNRepLEA https://youtu.be/XmSnZN5r0FU https://youtu.be/zBS34YIGa3U

Slide 32

Slide 32 text

Bowling Game Code Kata 2005 2025 imperative code

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

The next two slides show how Copilot was used, on the command line, to create the project used for the kata.

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

Manually deleted these two files after executing the prompt: - lightning-talk/src/main/scala/Main.scala - lightning-talk/src/test/scala/ExampleSpec.scala

Slide 43

Slide 43 text

Finally, a blow by blow account of the code kata session, in the form of a sequence of screenshots capturing every TDD step that was taken.

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

No content

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

No content

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

No content

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

No content

Slide 80

Slide 80 text

No content

Slide 81

Slide 81 text

No content

Slide 82

Slide 82 text

No content

Slide 83

Slide 83 text

No content

Slide 84

Slide 84 text

No content

Slide 85

Slide 85 text

No content

Slide 86

Slide 86 text

No content

Slide 87

Slide 87 text

No content

Slide 88

Slide 88 text

No content

Slide 89

Slide 89 text

No content

Slide 90

Slide 90 text

No content

Slide 91

Slide 91 text

No content

Slide 92

Slide 92 text

No content

Slide 93

Slide 93 text

No content

Slide 94

Slide 94 text

No content

Slide 95

Slide 95 text

No content

Slide 96

Slide 96 text

No content

Slide 97

Slide 97 text

No content

Slide 98

Slide 98 text

No content

Slide 99

Slide 99 text

No content

Slide 100

Slide 100 text

No content

Slide 101

Slide 101 text

No content

Slide 102

Slide 102 text

No content

Slide 103

Slide 103 text

No content

Slide 104

Slide 104 text

No content

Slide 105

Slide 105 text

No content

Slide 106

Slide 106 text

No content

Slide 107

Slide 107 text

No content

Slide 108

Slide 108 text

No content

Slide 109

Slide 109 text

No content

Slide 110

Slide 110 text

No content

Slide 111

Slide 111 text

No content

Slide 112

Slide 112 text

No content

Slide 113

Slide 113 text

No content

Slide 114

Slide 114 text

No content

Slide 115

Slide 115 text

No content

Slide 116

Slide 116 text

No content

Slide 117

Slide 117 text

No content

Slide 118

Slide 118 text

No content

Slide 119

Slide 119 text

No content

Slide 120

Slide 120 text

No content

Slide 121

Slide 121 text

No content

Slide 122

Slide 122 text

No content

Slide 123

Slide 123 text

No content

Slide 124

Slide 124 text

No content

Slide 125

Slide 125 text

No content

Slide 126

Slide 126 text

No content

Slide 127

Slide 127 text

No content

Slide 128

Slide 128 text

No content

Slide 129

Slide 129 text

No content

Slide 130

Slide 130 text

No content

Slide 131

Slide 131 text

No content

Slide 132

Slide 132 text

No content

Slide 133

Slide 133 text

No content

Slide 134

Slide 134 text

No content

Slide 135

Slide 135 text

No content

Slide 136

Slide 136 text

No content

Slide 137

Slide 137 text

No content

Slide 138

Slide 138 text

No content

Slide 139

Slide 139 text

No content

Slide 140

Slide 140 text

No content

Slide 141

Slide 141 text

No content

Slide 142

Slide 142 text

No content

Slide 143

Slide 143 text

No content

Slide 144

Slide 144 text

No content

Slide 145

Slide 145 text

No content

Slide 146

Slide 146 text

No content

Slide 147

Slide 147 text

No content

Slide 148

Slide 148 text

No content

Slide 149

Slide 149 text

No content

Slide 150

Slide 150 text

No content

Slide 151

Slide 151 text

No content

Slide 152

Slide 152 text

No content

Slide 153

Slide 153 text

No content

Slide 154

Slide 154 text

No content

Slide 155

Slide 155 text

No content

Slide 156

Slide 156 text

No content

Slide 157

Slide 157 text

No content

Slide 158

Slide 158 text

No content

Slide 159

Slide 159 text

No content

Slide 160

Slide 160 text

No content

Slide 161

Slide 161 text

No content

Slide 162

Slide 162 text

No content

Slide 163

Slide 163 text

No content

Slide 164

Slide 164 text

No content

Slide 165

Slide 165 text

No content

Slide 166

Slide 166 text

No content

Slide 167

Slide 167 text

No content

Slide 168

Slide 168 text

No content

Slide 169

Slide 169 text

What was the cost of that code kata session, on top of the monthly cost of Copilot’s Pro plan?

Slide 170

Slide 170 text

The cost was $1.60, and was determined by the LLM model used and the number of premium requests made. The session captured in the screenshots consisted of 39 premium requests using Claude Sonnet 4.6. See next for examples of the cost of other similar sessions.

Slide 171

Slide 171 text

No content

Slide 172

Slide 172 text

$1.88

Slide 173

Slide 173 text

$1.60

Slide 174

Slide 174 text

No content

Slide 175

Slide 175 text

No content

Slide 176

Slide 176 text

That’s all. I hope you found it useful.