Cranking Design to 11: Corey Haines on the Global Day of Code Retreat and the Art of Practice
•
UGtastic Archive
Full Transcript Available
Corey Haines, a Global Day of Code Retreat organizer, discusses the event's format, language agnosticism, and the importance of pushing code to its limits to improve design and clean code practices. #CodeRetreat #FunctionalProgramming #CleanCode #PairProgramming #LanguageAgnostic
The Interviewer
Mike Hall
Interviewer, UGtastic
The Guest
Corey Haines
Clojure and functional programming
The Conversation
Mike Hall
Interviewer, UGtastic
Hi, I'm Mike with Eugtastic. I'm sitting here with Corey Haynes. Corey does the Global Day of Code Retreats and he's also very active in just speaking and being involved in user groups and technical education. So, Corey, can you tell us a little bit about what is Global Day of Code Retreat and what's a Code Retreat?
Corey Haines
Clojure and functional programming
Okay, so Code Retreat's an event. It's a community-focused sort of directed practice event that has been going on for almost four years now. There's all over the world, and it's a day that's focused on practice rather than learning a new technology.
Mike Hall
Interviewer, UGtastic
So you just write code? How do you practice?
Corey Haines
Clojure and functional programming
So there's a set format for it. We work on Conway's Game of Life. We work in 45-minute sessions, and at the end of the 45 minutes, we delete all of the code we did, swap pairs, start again, and we do it about five or six times through the day. And then each session, we introduce different constraints, different ideas around object-oriented design, test-driven development, pairing, things like that. And so it's a day of sort of pushing yourself past where you normally code. And I like to say that we take normal sort of clean code constraints and different design ideas and we crank them up to 11. Yeah, I've been to one or maybe two of your events and things like no return values or don't use conditional statements is always interesting.
Mike Hall
Interviewer, UGtastic
But for the audience, what languages are you using?
Corey Haines
Clojure and functional programming
this is like a ruby specific thing it's it's language agnostic okay so as long we've had we asked people to come with a development environment set up what we call sort of your language of convenience okay but the community events are very much if you're interested in trying it in a different language say you've never done Clojure and somebody there has a Clojure environment set up then they can you compare with them for 45 minutes sort of get a feel for it a little bit We started off a lot of Java, there's a lot of C# that shows up, a lot of Ruby that shows up, but they're intended to be language agnostic.
Mike Hall
Interviewer, UGtastic
So what do people do when they can't finish the problem in the 45 minutes allocated?
Corey Haines
Clojure and functional programming
So very few people can, and in fact, it's intentionally chosen so that you can't finish the problem. The goal is to sort of retreat from the normal pressures of finishing. We all know that we write our worst code when we're rushing under constraints and under a time pressure. And the corners we cut, things like that. So the day is built to allow you sort of that freedom to experiment and try new things. So the very first one, it's frustrating for people. And by the end of the day, it's frustrating not finishing it. But you're kind of laughing. You're laughing at it. and instead sort of that pressure to finish goes away and you start to focus on um clean code focus on investigating different design ideas rather than rushing to finish right and actually have you ever had anybody like just be like oh can't wait anymore like you don't put up and just bang it out so i'm just curious we've had like for the first session a lot of times people will sort of hack out a solution because they're still in that mindset of wanting to get it done but you know like a lot of us say it's easy to get something working when you write crap right and so the idea of the day is to sort of write the best code you've ever written right and see what that looks like and take what you consider great code take it to the extreme and you know we always talk about going too far but very few people actually get close to too far so so shoot for gold plating shoot for gold plating and what happens if you actually go too far what happens if you refactor too much or you extract too many methods what does it look like and by taking yourself to that place you get a better sense for when you are actually building a production system how far you can go yeah and i think that that exercise of like sometimes when you want to start to refactor and you're you're looking and saying okay i'm gonna i'm gonna refactor this code and then you realize you did go too far you spent half a day and now you have to back it up but this cold retreat you can see like what if i did this thing i want to try to do and it doesn't matter if you went too far because you don't have to backtrack you just throw it away you throw it away and that gives you a good perspective so that when you are working and you're like am i going too far yeah you'll have an experience of actually doing it so that you can be like well no if i go a little farther it's still okay um and what was probably what's probably the most unique um experience you've had like do you have like a specific because we're going to get into the global aspect but the actual at a code retreat a solution that somebody did has anybody done something like implemented it and then script or anything like that? We've had people fool around in bash scripts. I think one team did try it in vim script and it's always interesting every code retreat there's always some sort of interesting approach to it so there's nothing really that stands out like that was the coolest. I did see at a code retreat in Colorado where I think on the final session some people ended up writing a fairly reasonable solution about six or seven lines of Ruby and I was like oh well what if you need to do this or change this and they it was actually a really nice small scripted solution we tend I tend to encourage people to over engineer so make a ton of classes keep very small methods things like that to see what it means we drop that term over engineering all the time but few people know a few people could recognize it and understand why that's a problem about the global now I mean I know you you started doing these these club treats it's kind of a one-off thing you did them in a few places but you do one that spans the entire globe in one day yeah so last year in 2011 in August I put out a blog post and said wouldn't it be cool if we have 20 cities around the world all on the same day and we could Skype and stuff yeah and it sort of took off and by the I think it was December 5th of 2011 we had 94 cities 14 time zones all doing it around the world on the same day and you tried to hop around so I did Sydney which was one of the first ones and then I caught a 6 p. m. flight that landed in Honolulu at 6:45 a. m. the same day so while the Sun was going this way you were going hot the other way and went the other way and so I'm gonna try to do it again this year okay we're aiming for 200 cities this year we are already at 60 which is about on track and so we've got two months to go and that's usually when it starts picking up okay and yeah it's a really great day there's a lot of it sort of brings the community the global community because code retreats just as as one-off things are done all over the world pretty much every weekend now there's at least one or two going on a couple weeks ago there were six of them on a day and global day is really about bringing it's a there's two really cool parts about it one is bringing that global community together all around one event and then the other aspect is introducing and training new facilitators because during the day the facilitators role is to introduce new constraints is to answer questions help people out ask questions and so it's on we do trainings we do facilitator trainings yeah I was about to ask I mean if somebody wanted to become a facilitator and it's like man this is really cool I wish I could do this in my city but we're in Anchorage you know there's nobody around you know how do how do they go about doing so for participants yeah well the it's built the format is very well defined and so it's sort of built so that even if you are a horrible facilitator right if you stick to this format then it's going to be a great day. So it's intentionally made for people to be able to just do it and follow a script almost and then for as you do more and more you get more understanding of sort of the subtleties of facilitation how to introduce the exercises better things like that but if people want to do it I've had lots of people email me with those exact same questions like i've never done this i don't i don't feel like i'm a great developer all of that but it's like the best way is just to do it yeah um the this isn't a great developer exercise it's a path it's a path and you know i like to tell everyone that every facilitator that's out there there's a handful of us who are experienced facilitators and have done a lot right but all of us had our first one yeah and i know very specific people who are very active in the community do a lot of these things and i remember their first code retreat when they emailed me and i talked to them and you know had a skype call with them and walked them through some ideas and now they're doing them all the time yeah and i mean with it getting so big i just wonder also is it getting so is it getting to become a point where there's a code retreat being set up and you didn't even know about it absolutely yeah absolutely i that's cool i'm very strict about the format and so we have it published this is the format um i've been sort of iron hand holding the format that if you want to do a code retreat this is the format if you want to call it a code you want to call it a code retreat i always make sure to tell people that the it's not intended to be the only activity that anyone ever does and it's not the it doesn't cover all aspects of development it has very focused things that it works on and it's there's lots of really important practice oriented activities people can do but coder tree is this right and so i've been um fairly iron handed about that and but now it's sort of as I've sort of curated it and gone it's it's intended to be decentralized okay so people set them up and do them all the time very few people now like email me and go can I right because it's It's not about my approval or my influence or anything like that. It's a local event to bring people together and practice. So it's kind of finally grown beyond your privilege. That has to be a really cool feeling. It's a wonderful feeling. Early on, I knew sort of what everything was doing. And, you know, I pissed a couple people off because they were like, oh, I'm going to do this. I'm like, well, that's not a code retreat. I'd ask you to not call it a code retreat. but um now it's gotten it's it's sort of reached that level where it's beyond me and it's not centered around me i'm sort of a uh one of my one of the guys called me a benevolent dictator yeah i think more instigator yeah and i like to curate like i run the coderetreat. org site but it's not like i'm on there saying what can happen um and there's enough people now who are experienced facilitators experienced hosts who just they're off doing it and there's not really experimentation around the format but there's more and more experimentation around exercises during the 45 minutes so I was gonna would that be relevant because I was what I was just thinking about is well if it's object-oriented functional programming is very much becoming popular now.
Mike Hall
Interviewer, UGtastic
Could somebody do a functional code retreat? Wouldn't that still be a code retreat?
Corey Haines
Clojure and functional programming
Absolutely. Absolutely. The format is the 45 minutes, the throwing the code away, Conway's Game of Life. I'm an OO guy, and I've been doing a lot of sort of thinking about OO concepts over the last couple years. And so the code retreats that facilitate and the exercises that I do focus on sort of the edges of understanding around OO design I don't have a tremendous amount of like expertise in functional paradigms I did I've done you know a fair share of fun or something like a theme that they wanted to build a code retreat around and they they can make a cohesive set of exercises to do within a format they could absolutely so a perfect example of that is JB Rainsberger started a thing called legacy code retreat okay and it was the first sort of expanding the family of code retreat and so they don't do counters game of life they have a code base that Chet Hendrickson and Patrick Welsh put together which is a horrible code base and so the the it takes your own yeah exactly well it's chat and so the exercises are about writing tests around it refactoring and it's still it's a legacy code retreat so the classic code retreat I'm very you know here's the format there's no reason you can't come up with something like a it's Matt Hauser came up with a test automation code retreat okay so they we have been experimenting with doing the code retreat format but around different techniques in test automation okay so they use a code base and work on different automation tools well how can we hit this this way how can we get it that way yeah and so what I what I'm aiming for and what I love to see is an expansion of the code retreat family rather than a if you go to something called code retreat you don't know what you're going to get because people are doing whatever they want. But if you go to a legacy code retreat, you know you get this. If you go to a test automation code retreat, Brian Merrick for a little while was talking about putting together some exercises on a refactoring code retreat. And so I love this.
Mike Hall
Interviewer, UGtastic
How can you mutate a code base? Yeah.
Corey Haines
Clojure and functional programming
And so, but I tell people, I get people asking like, can I use a different problem or all of this? And I generally say no. Well, I always say no. But what I want people to do is use, you know, it's been, we've been building and sort of fine-tuning the format for almost four years now. It's settled, it's good. Yeah, we know this works. This worked. Early on, we did a lot of experimenting around the format and settled on something that works. And so what I want, what I would love people to do is come up with a different set of exercises centered around something specific and then call that a X coded sheet. I would love to see somebody who has more experience with functional languages and knows about functional design come up with a set of exercises that are really applicable to functional programming. and have a sort of a functional code retreat. So, for example, one of the exercises that I love doing that always causes people problems is no return values. My favorite. And in a functional language, say you're doing it in Clojure, well, Clojure's got a lot of just data transforms. And what comes out is it's transformed into some other format. and so the core a lot of the core is built on data coming in data going out so asking them to say no return values i don't know like i'm not a Clojure guy i've fooled around a little bit paired with people but i don't know if that would give them a valuable thing to practice right i know but at least it would make them try to think about something like if they're always saying it goes this way it goes this way it goes this way what if it goes like this what if it goes like that i know that in oh the exercise around no functional or no return values is fantastic and it's a really valuable design style that you can use and get better at and in certain cases it's a much it's a highly it's a much more superior uh form in certain cases and so one of the ideas is that we tend to have the way we code right um it's sort of like our style the the wagon trail where you code this way for so long you end up with ruts that your wheels go down and it's effective and you get to california and you find your gold but what if if that's your only tool that you can pull out then you know what if a problem what happens when the you know the wagon wheel falls off yeah yeah yeah and so really yeah or what if what happens if you get dysentery right exactly yeah that's a problem yeah um so yeah that's really the goal of it and global day is about um increasing the number of people who are comfortable facilitating expanding it after last year last year the majority of the people running them were new. New facilitators, new hosts. And that led to an explosion this year of people who had a little bit of experience doing it. So that's where we got every weekend. You can go to the event. You can go to the CodeRetreat. org site. So that's what I was going to wrap up is say, for people who are interested in participating or running a CodeRetreat, you have a website. coderetreat. org is our social network it's built on ning um and there's a big banner right now you can go there's a page for global day it's at globalday. coderetreat. org okay but if you go to coderetreat. org there's a banner there's an events listing okay so it has both the uh registered locations for global day as well as what's going on this weekend and it could be near your town okay great well thank you very much thanks so much for uh talking and keep up the good work these are great interviews thanks