Coding Dojo

 “When most people practice, they focus on the things they already know how to do. Deliberate practice is different. It entails considerable, specific, and sustained efforts to do something you can’t do well—or even at all. Research across domains shows that it is only by working at what you can’t do that you turn into the expert you want to become.”


– K. Anders Ericsson, Michael J. Prietula, and Edward T.
Cokely, writing in the Harvard Business Review

Mindset

  • We are here to learn
  • Safe place outside work
  • Need to slow down
  • Focus on doing it right
  • Non competetive, collaborative and fun

Navigator / Driver

  • Navigator decides what to code
  • Driver does the coding
  • Rotate after 5 minutes:
    • ​navigator returns to crowd
    • driver becomes navigator
    • new driver is selected

 

  • ​Remember: Asking questions to the crowd when stuck is allowed!

TDD

Kata: FizzBuzz

Imagine the scene. You are eleven years old, and in the five minutes before the end of the lesson, your Maths teacher decides he should make his class more "fun" by introducing a "game". He explains that he is going to point at each pupil in turn and ask them to say the next number in sequence, starting from one. The "fun" part is that if the number is divisible by three, you instead say "Fizz" and if it is divisible by five you say "Buzz". So now your maths teacher is pointing at all of your classmates in turn, and they happily shout "one!", "two!", "Fizz!", "four!", "Buzz!"... until he very deliberately points at you, fixing you with a steely gaze... time stands still, your mouth dries up, your palms become sweatier and sweatier until you finally manage to croak "Fizz!". Doom is avoided, and the pointing finger moves on.

So of course in order to avoid embarassment infront of your whole class, you have to get the full list printed out so you know what to say. Your class has about 33 pupils and he might go round three times before the bell rings for breaktime. Next maths lesson is on Thursday. Get coding!

 

Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".

1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
Fizz
19
Buzz
... etc up to 100

Step 2

  • Add “Whizz” for multiples of seven

Step 3

  • Add “Fizz” also for all numbers containing a 3 (eg
    23, 53)

Randori in Pairs

  • Pair Programming
  • Ping Pong TDD
  • Show results at the end

Kata: String Calculator

Create a simple String calculator with a method int Add(string numbers)

  1. The method can take 0, 1 or 2 numbers, and will return their sum (for an empty string it will return 0) for example “” or “1” or “1,2”
     
  2. Start with the simplest test case of an empty string and move to 1 and two numbers
     
  3. Remember to solve things as simply as possible so that you force yourself to write tests you did not think about
     
  4. Remember to refactor after each passing test

Retro time!

Coding Dojo GDATA

By Kevin Wittek

Coding Dojo GDATA

  • 1,695