On 17th November across the globe the Global Day of CodeRetreat was happening. In Melbourne 28 Developers rocked up to code and learn together. Here are Melbourne's slides, including the chosen constraints for the day.
Thanks to my awesome co-hosts, co-facilitators and co-organisers Tomasz Janowski (REA), Luke McCarthy (ThoughtWorks), Ren Koh (SEEK), Terence Duong (SEEK), Seamus Kearney (SEEK), Birgitta Mabbett (SEEK) and Kelly Benson (ThoughtWorks) for a great team effort to making the day successful and heaps of fun!
3. The Global Day of Coderetreat is happening thanks
to hundreds of Hosts and Facilitators worldwide!
4. Global Day of Coderetreat encourages you to donate to
CoderDojo.
Hidden Slide Slower
5. CoderDojo is a global volunteer-led community of free
programming clubs for young people between 7 and 17.
CoderDojo gives young people all over the world better
access to the “Magic behind the technology” that surrounds
us and touches almost everything that we do in our lives.
About CoderDojo
Hidden Slide Slower
6. Within CoderDojo there is a focus on developing creativity, a
sense of community, peer learning skills, mentoring and self
led learning with an emphasis on openness and showing how
coding can be a force for positive change.
About CoderDojo
Hidden Slide Slower
10. Morning
Hidden Slide Slower
● 08:30 Intro to the Day
● 09:00 Practice session #1
● 10:00 Practice session #2
● 11:00 Practice session #3
● 12:00 Lunch break until 1:30PM
11. Afternoon
Hidden Slide Slower
● 1:30 Practice session #4
● 2:30 Practice session #5
● 3:30 Practice session #6
● 4:30 Closing circle
● 5:00 End of the event
● > 5pm Drinks & Nibbles
12. Coderetreat
Hidden Slide Slower
● Full day activity focused on the fundamentals
of software development and design
● The goal for developers at work is to finish
something
● The goal for them during coderetreat is to
practice, not to finish
13. Coderetreat
Challenge yourself!
Hidden Slide Slower
● Get out of your comfort zone
● Program in languages you don’t know
● Detach yourself from your own creation
● Do what you always wanted but couldn’t
● Don’t focus on finishing
14. Structure
Hidden Slide Slower
● Problem:
○ Conway’s Game of Life
● Session length:
○ 45 minutes followed by a 10 minute
retrospective
● Delete your code after each session!
15. Structure
Hidden Slide Slower
● Pair Programming
● TDD
● Kent Beck’s 4 rules of simple design
○ code passes the tests
○ reveals intention
○ no duplication
○ fewest elements
● Don’t forget to have fun!
17. Test Driven Development
Hidden Slide Slower
● Add failing test
● Run all tests
● Write code
● Run tests
● Refactor
● Repeat
18. Conway’s Game of Life
Hidden Slide Slower
● A zero-player game, meaning that its evolution is
determined by its initial state
● The universe of the Game of Life is an infinite
two-dimensional grid of square cells
● Every cell is in one of two possible states: alive or dead
● Every cell interacts with its eight neighbours, which are
the cells that are horizontally, vertically, or diagonally
adjacent
24. No constraints
Hidden Slide Slower
● Get familiar with Conway’s
Game of Life
● Use your preferred language
● Remember to delete your
code after the session
27. Ping Pong TDD
Hidden Slide Slower
● Work in pairs
● Person A only writes tests
● Person B only tries to get the
tests to pass
● Both persons refactor when
appropriate
● Person B swaps roles with A
30. No naked primitives
Hidden Slide Slower
Primitive Obsession (Code
Smell)
It is using primitive data types to
represent domain ideas.
Eg: String for a message, Integer
to hold currency etc.
31. No naked primitives
Hidden Slide Slower
Objective of the session -
● To practice avoiding primitive
obsession code smell.
● Creating required “Value Objects”
● Understanding encapsulation.
32. No naked primitives
Hidden Slide Slower
Adding an alive cell in position [3,4]
● Primitive obsession
const population = [ [], [], [], [], [], [] ];
population[3][4] = true;
33. No naked primitives
Hidden Slide Slower
Adding an alive cell in position [3,4]
● No primitives
const population = new Population();
const cell = new AliveCell();
const position = new Position(3, 4);
population.set(position, cell);
37. Baby steps
Hidden Slide Slower
1. Set the timer (4 minutes)
2. Write exactly one test
3. Write implementation to make the
test pass
4. If within time - commit
Otherwise - revert
5. Repeat
40. Pure functions
Hidden Slide Slower
● A function where the return
value is only determined by
its input values, without
observable side effects
41. Pure functions
Hidden Slide Slower
● A pure function can only access what you pass
it, so it’s easy to see its dependencies
● When a function accesses some other program
state, such as a global variable, it is no longer
pure.
● A given invocation of a pure function can be
replaced by its result. There’s no difference
between “add(2,3)” and “5”. This property is
called referential transparency
42. Pure functions
Hidden Slide Slower
● Easy to test
○ To test a pure function, you declare the values
that will act as arguments and pass them to the
function. The output value needs to be verified
against the expected value.
○ No context to set up, no current user or request
○ No side effects to mock or stub
○ Testing doesn’t get more straightforward than
this
52. Mute Ping Pong
Hidden Slide Slower
● Work in pairs
● Person A only writes tests
● Person B only tries to get the tests to
pass
● Both persons refactor when
appropriate
● Person B swaps roles with A
● A and B can’t talk to each other
56. Closing Circle
Hidden Slide Slower
● What, if anything, did you
learn today?
● What, if anything, surprised
you today?
● What, if anything, will you do
differently in the future?
57. Thanks for coming!
Hidden Slide Slower
Thanks for attending
GDCR 2018
Stick around for some drinks,
nibbles and networking!