## TL;DR

We are having a code retreat on Friday November 15th. Please send me your name and email here: https://bernardic.ca/contact/ . You can just say “Code Retreat” in the message, or write me a longer message with some information about you. I look forward to spending the day with you.

## Code Retreat

From the Code Retreat Website:

A code retreat is a day-long, intensive practice event, focusing on the fundamentals of software development and design, away from the pressures of ‘getting things done’

At a code retreat, the attendees split into pairs, for 45 minute session of coding. When the 45 minutes are up, we share some learnings, pair up with a new partner and start coding from scratch again.

## Conway’s Game of Life

During each of the code retreat’s 45 minute pair programming sessions, we work on a program that implements Conway’s Game of Life.

From Wikipedia article on Conway’s Game of Life:

The universe of the Game of Life is an infinite, two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, alive or dead, (or populated and unpopulated, respectively). Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:

1. Any live cell with fewer than two live neighbours dies, as if by underpopulation.
2. Any live cell with two or three live neighbours lives on to the next generation.
3. Any live cell with more than three live neighbours dies, as if by overpopulation.
4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

The initial pattern constitutes the seed of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed; births and deaths occur simultaneously, and the discrete moment at which this happens is sometimes called a tick. Each generation is a pure function of the preceding one. The rules continue to be applied repeatedly to create further generations.

## Global Day of Code Retreat

Every year the GDCR organization sets a date for the global day of code retreat, which gives us an opportunity to make a local event out of it. During this day developers around the world get together with others in their communities and learn and practice their craft.

## Winnipeg Code Retreat 2019

We will have the code retreat at the FarmLink / Farm At Hand office – suite 110 at 93 Lombard Avenue on November 15th.

If this sounds like something you’d like to try, contact me to attend.

## P.S.

November 15th is a Friday. From the code retreat website:

Traditionally, the Global Day of Coderetreat takes place on Saturdays, but we also want to invite companies to promote educational opportunities for their employees by hosting a public coderetreat on Friday.

## PHP: Peridot and Propel

Wanted to share a little configuration I just finished making for some Peridot and Leo -based tests which work with Propel models.

A bunch of these tests write data to the database using the Propel models, and I need a clean slate DB before each test. I also need a clean slate HTTP session. Here’s some code ( from peridot.php ) that uses transactions to achieve that:

```class MyScope extends Scope {
function __construct( \$emitter ) {
\$emitter->on( 'peridot.execute', function() {
\$this->conn = Propel::getConnection();
} );

\$emitter->on( 'test.start', function() {
self::destroySession();
// have to rollback and begin here.
// it was unreliable when I rolled back on test.end
\$this->conn->rollback();
\$this->conn->beginTransaction();
} );
}
private static function destroySession() {
session_start();
\$_SESSION =[];

// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
\$params["path"], \$params["domain"],
\$params["secure"], \$params["httponly"]
);
}

session_destroy();
}
}

return function(\$emitter) {
\$gmsScope = new GmsScope( \$emitter );

//add this scope into every suite
\$emitter->on('suite.start', function(\$test) use (\$gmsScope) {
});
};
```

## Start learning to become a web developer with the Flatiron School Prework

I ran across the Flatiron School of programming a while back, and I thought it was pretty cool. They have a “pre-work” list of resources for their web development course. I expect it is quite good.

I ran across Flatiron school when I listened to a podcast the founder of the school did. I think it is pretty inspiring.

OK, enjoy learning to program. I’m pretty excited for you!

p.s. This post was based on an email reply I wrote to a reader of this blog who asked me for some resources to start learning Ruby on Rails.

## Before the event

• Join host training if possible
• Find venue
• Find sponsors: company, friends, other companies
• Breakfast and food can be “home made” at the office
• Coffee and breakfast in morning are nice to have, but lunch most important. No invoices for food to GDCR, all to local sponsors directly from any vendors
• Announce after party on time, when announcing the event itself

## Announcing the event

• Do it one month before event so people don’t forget.
• Send reminders a week and a day before
• Announce at gdcr website, but use your own RSVP tool
• Add site to global spreadsheet, write how many attendees you will have
• Make a local spreadsheet with list of attendees. Maybe add columns for people to fill about their experience with various tools of the trade and gdcr experience
• Announce local sponsors, good to get sponsors in the future too
• Print name tags
• If you have more than 25 attendees, try to split them, and have 2 facilitators in 2 venues

## Day of event

• Set up the space before people show up
• Display and make accessible any Swag from sponsors
• Register people when they show up, show them around
• Show where the slides will be accessible at a station
• Coder dojo video – show it
• Video call with another city, very short, brings excitement to team
• Take a look at feed of who is doing what in the world
• Update the live feed with your session
• At lunch time, show code retreat related videos
• Slide deck with sponsors, video call with another city. Update spreadsheet with actual
number of attendees
• Take photos, take video, share it with gdcr and with social networks
• Help clean and pack up.
• Then the after party
• There will be a host survey to complete
• There will be a participant survey as well

## WinniVote Rspec Feature Tests

I spent several hours today creating the specs for WinniVote’s signup feature.

I feel it is a valuable investment of my time for several reasons:

• WinniVote’s current tests do not feel high quality, so hopefully my examples help other WinniVote devs.
• I’ve been thinking about what quality tests look like for a while now, but have not had a chance to get feedback from other developers, so I’m interested what others think about my style.
• I look forward to the further evolution of my style based on the feedback I might receive.

## Global Day of Code Retreat 2013, or “It’s fun to pretend people ask me questions frequently”

Hello. Welcome here, and thanks for coming. I presume you’re here to learn something about Code Retreat. Good for you. Here’s a list of questions that I am going to pretend someone asked me:

How did it go?
Great. Thanks for asking. Unlike other years, I experienced a very low level of frustration, and there are not many things I would do differently. I had fun and I learned a lot even in the previous years, but I felt that I could have prepared better, and I was always disappointed that I did not come out with a finished program from any of the sessions. This time I made a finished program before the event.

What is your hope with writing this post?
This was my third code retreat. I want to recommend it to everyone else who wants to get better at programming. At the same time, I’ve experienced significant frustration during the previous two years, and this year, I did not. I want to share my findings with people who will go, so that they can know what to expect, and maximize the amount of learning that happens.

What is a code retreat, anyway?
A code retreat is essentially a learning opportunity. More specifically, it is a learning opportunity to get better at developing software. In my opinion, it is suitable for anyone from people who do not know how to program to people who have programmed most of their life.

It is a full-day ( 9-5 ) event that is broken into six 45-minute sessions. In each session, you pair up with another attendee, and you try to learn to develop software better together with that person. The developed software is secondary, but it provides a problem to try to solve through software. We were implementing Conway’s Game of Life. After each 45 minute session, you pair up with another attendee, get rid of the code you wrote in the previous session, and start over.

Why do you go to a code retreat?
I go to learn from my peers how I can get better at developing software. I go to make myself available to my peers to learn how to be better at software development. I go to learn how to facilitate a code retreat so I can perhaps facilitate my own when the time comes.

What did you learn?
I learned many things. The answer I offered to the gathered group at the end of the day was that I learned that the best question to ask after each coding session is “What did you learn?” A nice open-ended question that places emphasis on what the point of the day is. This is contrasted to a question like “How did that go?”, or “What did you think about not being able to use ‘if statements’?”

What surprised you?
How many PHP sessions I did. How little frustration I experienced during the day. That there were only 11 attendees at the event. I was also pleasantly surprised by the open-mindedness David Wesst displayed during our session. I guess I had some prejudice about him :).

What will you do differently?
I can answer a few different questions based on this question…

What will I do differently at the next code retreat? I can’t think of anything. I am very happy with how I prepared and what I did at the event. I feel like I seized all the learning opportunities I could have.

What will I do differently at work based on what I learned at this code retreat? I hope to continue increasing the number of ways in which I do not limit the freedom of choice of those who interact with me at work. For example, I hope to not push Test-Driven Development onto people who do not want to do it. I also hope to give up on more of the excuses I use to not do my best work daily. I hope to find more ways in which I can change my behavior to encourage more collaboration at work.

OK, but what can you tell me to help me as a future code retreat attendee?
In one word: Prepare.

It is very hard to actually finish the implementation of the game of life in just 45 minutes. You can pretty much do it only if both of you have done it before exactly the same way including algorithm, language and testing tools. If you have even one circumstance that will make it harder, it pretty much becomes impossible, so you might as well give up on that, and think about what you actually could learn. Things that make it harder are things such as:

• You or your pair not being familiar with the programming language used, or the testing framework used, or even the editor used. Instead of trying to learn how to finish an implementation of the game of life, focus on learning/teaching about the cool features of that language.
• You or your pair not being familiar with ideas in Test-Driven Development. Instead of trying to learn how to finish an implementation of the game of life, focus on learning the mechanics of how to do TDD and what benefits of TDD the more experienced half has seen in practice.
• You or your pair is not deeply familiar with the Game of Life. Instead of trying to finish an executable implementation, focus on exploring what a finished program might look like, and explore the algorithm with which one could implement the game of life.

The purpose of the event is to learn from your peers. What you learn is open-ended, so don’t limit yourself if you see an opportunity to learn something you or your pair thinks you should learn. In each session there are multiple things you could pursue trying to learn, but if you’re paired with someone with considerable experience with something, you should probably take advantage of that. In each pairing, it might be good to learn what are some of the strengths of the person you’re paired with, so you can focus on those things. From the other side, knowing what you’re good at can help your partner for the session understand what opportunities are available to them.

Another thing to consider is that you’re learning how to be good at pair programming, not just programming. Pair programming brings in the social aspect, and because of that, social skills are also available to be learned.

So the common things available to get some hands-on experience with at a code retreat, and meet someone who has considerable experience with it, are:

• How to develop software in a pair?
• How do my skills compare to my peers in some aspect?
• How to program?
• How to program with a specific language?
• How to do unit testing?
• How to do acceptance testing?
• How to use a particular testing framework?
• Why does a particular activity exist as part of a code retreat? What is it trying to teach me?
• What does a program that implements the Game of Life do?
• What are different ways one might implement the program for the Game of Life?
• And many more…

I’m sold! When’s the next one?
You can reply to this tweet one of the organizers sent out:

Im organizing a code retreat. Would you like to come out?