Shane (he/him) is a developer, designer, and an anarchist. He was once the open source cheerleader for Rubinius. He co-organized Cascadia Ruby, Farmhouse Conf and Barn Talks. Currently, he’s a senior software engineer at Mode.com and coordinator of development on crimethinc.com (an anti-fascist anarchist publishing collective). He's exploring these wild-sounding new ways software development to see if another world is possible.View the profile
About the talk
RailsConf 2019 - From test && commit || revert to LIMBO by Shane Becker
Kent Beck (TDD, eXtreme Programming, Agile Manifesto) has a couple new ideas. They both sound so terrible and impossible that they just might be totally amazing.
1. test && commit || revert If tests pass, commit everything. If they fail, revert everything. Automatically. Wild.
2. LIMBO. Anything that's committed is pushed. Anything that's committed by teammates is automatically pulled in while you work. So wild.
Does this work? Does it scale? Will I always be losing important progress because of a typo? Will this make me a better / faster / happier programmer?
We'll cover tools, process, deficiencies, mental models, and experiences. Show up and see what happens.
So unfortunately in the time that I put this talk together, I didn't have the opportunity to dive into limbo too much with other people and it really does require other people. It's not a by yourself. So I wanted to change the title to talk a little bit and take out limbo. And since I'm not going to anywhere that doesn't make sense to have the two in there. If I'm not going to anywhere the front doesn't make sense with testing commit or avert. But what I ended up doing was talking about patterns a whole lot software patterns of design patterns architecture patterns. And so we're going to add
that in there and then finally do a little bit of formatting on patterns and testing commit or revert. My name is Shane Becker. I go buy vegan straight-edge on the internet. I look like this in most places. I used to look like that and me and Terrence Lee year for the blue hat Ruby crew. I once co-organized Cascadia Ruby with Seattle and then they did in Portland. I put on the best backyard storytelling conference in the universe called Farmhouse coffee in Hollywood, California, and I used to be the open-source to you earlier for engine yard way back when when they were a company and
I worked with the Stars teams on rubenia S&J Ruby doing for the community outreach. I currently live in a small town called San Francisco, California and I work for a company called mode. It's also on my honey here. It's the culture is really great. These are the company values that you can't read. If you talk to me or CTO or co-worker. We will tell you them. We have lots of inside jokes about goats and lots of puns all of the all of the times and the people are great. We have developers and engineers
at various interest in expertise. And of course, we're hiring Find more about the company at mode.com. The products is let's imagine you have it from Mountain of data in a database and you want to ask data-driven questions or you could if you do a scientist data analyst or just curious folks who are willing to ride a little bit SQL or nosql they could do a thing sincerely. You should click go find our CTO who is somewhere in this room and we'll be at the the table out in the place where the tables are. She is very best. You should go find
her and come work for us. Okay onto The Talk The Talk is going to be three parts technical overview briefly of what is testing commit or revert and then this weird wild and hopefully wonderful historical interlude does everyone know that they're in a talk on the track on weird wild and wonderful, but that's what I set out to have you in store for and then toward the end towards deeper dive into the technical stuff. Can you start the countdown clock The Big Red One? Alright, so here is the tldr for the hole for the technical part of the talk is actually writing the title of
tests and commit or revert back. I made a big salad. Maybe you're running many times. Can you use brake test or maybe you're using ours back and maybe that are stuck has to be run under the context of bundler and maybe have an alias. Could you hate typing? Like I do have to let the test apartment and then the committed part in intestine commit or revert means I commit all of the things you're not going to be picky and do some things you can commit everything. And so we can do it again commit
- am all of the things and if you don't know the dash day of the dash dash end means I'm going to have a commit message in line right here in this popping open open my editor and add all of it. But only of the files that you already have attracted a person control so inbox you don't have time quotes around things that they're single word. So it will just a working and to do our future selves little favor will use something that's where the signal to what the hell is this weird little smoked meat. Okay, and again
decade doesn't catch untracked files that he created a new one. It won't it won't show up and not commit. So I'm off going to talk pack on a get at. Which we get a. And get commit amtcr for the commit part of testicle. I know the reverse is all that work and chances are you're using a gift if you're still using the version, I'm sorry come in from the cold. We have hot chocolate. We have central heating. So let's be clear. It's not a git revert in the sense that you're
undoing a past its undoing all of my unsaved changes. And I just two ways to do this and get at least two ways. You can do a get reset dash out hard which is bold and daring and that's gone forever or you could do it at all your files. Make sure you have asthma stash is like a what is it last in first out back so you could catch those changes back out if you want to but for our purposes were going to be bold and daring and let go of the past. So we went from this test and commit or revert to this which I will
never type my hands. So I made an alias cuz I hate typing and it's just TCR and now that it's just one little word we can make it really big and that's easier to see in this very large room. Okay. So if you're only here for the for the bike technical reenacts, are they the reenactment of a technical blog post? Thank you for attending my TED Talk you're free to go because now I want to talk about like the idea of PCR and like where do ideas come from man? Okay, so I'm already tired of saying testing commit or revert. So I want you to create
a mental Alias for when I say TCR I mean testing. So what the hell is this thing in my opinion tcra's five things. It's just an idea which I have opinions about it just an idea is not a prescription of particular tools or technology It's a combination of things that we already has committed code and has Reaper code. It's also the automation of that combination. So we do all these things together as one Is also named in the pattern of that combination and Automation and it finally maybe it is a new way of doing supper to help. We'll see. I don't know.
It's still like it's not even in its infancy. It's like it's like a zygote of an idea Stone super new unclear its future. So it is TCR is quote-unquote. Just an idea why now? Why didn't someone else come up with this before? And to speak to those questions. I'm going to tell the history of TCR rather like a history of TCR because let's start with the true facts that no history is objective or completes or unbiased or the reverse of them. So we could say the dissection.
My talk is a brief and incomplete history of people events and ideas. That predate the idea of PCR which one world into a stew and looked at through a particular perspective might be seen as like related a particular theme or something. So I the middle Pins on a board and draw a line to connect them with yarn and hopefully there will be a somatic connection Mosaic will make some sort of sense at the end. History of these things that ultimately lead to me in this
moment getting that talk. So, where do we start Big Bang include every single thing every history has some in her chosen curated start. I wanted to start this a hundred years ago when Eisenhower took a road trip from DC to San Francisco and it took 60 two days, but it got cut so what star in Eugene Oregon at the University of Oregon in 1961 when the university published its poem quote master plan. This is not a test. This is a nice picture. But that is the that is the University of Oregon campus
and on this master plan where they lay out Decades of architectural elements. Misinterpreted like ultimate Gantt charts and waterfall development. They laid out that they wanted to destroy or like raised this 1800 cemetery and build buildings. People are the members of the community students faculty and staff. And then in 1968 the university created a new building for the science department, Klamath Hall and Klamath Hall was a building that is and it is in a style of architecture called brutalist for brutalism. And if anyone in this room
doesn't know about brutalism, it's worth a quick side quest which is these feelings tend to have a lot of concrete involved. They tend to have a lot of rigid geometry. and in some ways they had their bun in the sixties and seventies some ways these buildings remind me of the Jetsons if this like retro Neo futurism. It's like our parents or grandparents vision of what they thought the future would be and it's a future that never really happened. So they're these like artifact relics and every time I think of future of brutalism, I would think
of this one building particular that's now abandoned and I was created as a monument Bulgaria, which isn't that part of the world is John Oliver, I would sure like a picture of Bulgarian or Turkish though. I don't know how to pronounce that. My apologies I have read that is Turkish for I see which makes sense because it looks like Hof Show me the building makes sense. There's like weirdly like in this place like on the peak of this hell even like cats like off in the distance like a
silhouette makes sense in this contact and then immediately unlike for me part of Duty is that it's abandoned and falling apart as pretty and in the right contact. These buildings can be beautiful and even kind of cool and hopeful but in the wrong contacts or done poorly, this is the Buffalo New Buffalo New York City court building and I can go to work there every day. There's not a single fucking window. Or like this building looks like a goddamn battleship. So
I know they don't like brutalism, but I could see it done. Well, sometimes so back Weymouth Hall. It was none of those things. So it was ugly for is still there. It is ugly. It is out of place. The rest of building is like the rest of the campus like red brick and trees and you know, like the Pacific Northwest and I frankly pretty inhumane and then 1970 break yourself too dark for a moment in the Pacific Northwest and does logging trucks with sometimes drive through the campus and
kill the students and rightly. So people were upset and combination of that happening in a ways to sort of a general time of unrest in protest. And these like development decisions the community was like yeah, we want to have some real life these particular decisions, but we also don't like the process in which these decisions were made to the price of the university in West a group of Architects from UC Berkeley. And these are their names. I will refer to them as the Christopher Alexander group later.
They come in there after like fixing solve their problems. The only problem is which buildings to build and the other problem is how do we decide what they write and publish it in a book called Morgan experiment everyone in this room should read this book pages, you know. Baseball at least help me six principles organic order meaning like the hole is only ever presented by the bunch of local acts. You can't fill the hole. He can't build the web the web can only be
expressed by websites participation the users of a space near The Faculty student staff must be the one to decide what to build when to build it later Asians patterns that part was huge patterns. It has been agreed upon for vocabulary which we build from we design from diagnosis. Do all those get published in his book to read it also published. The Timeless way of Billy was laid up with the theory of this process and then a pattern language, which is a Tome. It's the best of these books is lays out 250
patterns some of which are very large like neighborhood sheep should be identifiable nucleus and has some very small like their City walls hear a different kinds of broad scope of things. Okay. So, how do we go from there to here? Thank you for bearing with me. Here's where we turn towards making computer go. So just like how two people at the same time in Europe discovered calculus independent of each other. In 1970 read a pattern language and Revelation independent of each other and would it meet for years later? The one of them was named Ward Cunningham,
but other people told me he was given A draft copy of a pattern language and then came back was always just like really in the architecture as a kid and still UFO bookstore in like an hour at a time standing up in the aisle cuz he couldn't afford to buy it. And then several years later 1985 Kent Beck happens to get hired on to a project that work and in the process, they accidentally invented pair programming. And then they start talking about how did
language patterns in general and ideas. They've had a connection between how this process. Do they launch a website called the Portland pattern repository, which is hosted at C2. Calm and it is the first one who created it for. This site is still there in 1990 for the continuation of that Community eventually publishes a book called design patterns by a group of authors that get referred to as a gang of four. This is one of the seminal texts in our industry years later
published a book about patterns and small talk. And this is the book that kicked off the whole thing that let me borrow this book from a co-worker and friend and Josh and couple chapters and I was like how patterns I remember a book called a pattern language. It's been recommended to me like the late 90s website estimate metaphor for web design Reddit thinking this will be a web design book and it's not it's literally about building Billings. I thought that would be And then later on Friends recommended it because I
want to build a tiny house and it wasn't ready for it is a direct through line from this book published in the 70s to this book published in the late 90s and I made this connection independent, but it was in the context of the four Decades of like the influence that these other people and their connections that they had made as influence our industry the way we do work. Isochem back is also credited with inventing test-driven development or tdd. But to me, is he rediscovered DVD in the sixties? NASA was actually doing tdd during Mercury Mission Bay would write out input tables
tables and output tables and just write code until it matched STD extreme programming back as well combining some of these tools to pair programming tdd story cards and shortly thereafter. We get the most beautiful website ever the agile Manifesto, which is just Frozen in time does Giant image tiles by the way, you scroll down there just the same image of room and all of the ideas in agile, especially the orgone pyramid and it's six principles the first
three of which describe a child development. So how do we go from architectural design principles in the 70s to testing commit or revert in 2018? If my hunch is that there's a few people for hovering around this idea the same time as if you actually had for a long time and doing testing and fucking good colloquially. It's referred to as Poudre as like a little kid with a computer. She covers like factoring and patterns. and design and talking I'm I'm confused that says I have 20 minutes left just says I have 39 minutes left that
cannot be right. I'm not been talking for one minute Sandy and Katrina Owen public. This book called 99 bottles of where you program. Are there 99 bottles of beer on the wall or milk on the wall. It is also great. Everyone should buy this book readers in the processor in the book. They describe the process of basic manual TCR change run the tests. That sounds like er, or the other way around when I learned about TCR I like that sounds like I was at camp He describes his process of doing testing commits. And then this
person will say Osmond stroller. If you do this, then logically you have to do that. He saw the Symmetry and came back was like that's absurd but it's cheap and it's safe. So we must try it. Who invented PCR? I don't know if that's the right question. I think that's an important people should not be lost. People should not be like written out of History Katrina only because she was doing and she describes main OTC on she was doing it and maybe a step back because he names of thing. And maybe it's because he tacked on that last part,
but I think the real point is that ideas don't exist in a vacuum and they're also not created. And in fact, we never have never ever had like Eureka moments. We always have liked the next so let's definitely did not write original music. That's fine. But you know, everything is a remix and spent everything is a remix. This is also an idea that we have basically the same brain as our you know, Paleolithic ancestors, but they could not have imagined nuclear missiles they could imagine rocks and then rocks attach the sticks and stick Starpoint you selling So one thing Sandy said to
me is that maybe the ideas time and just come it was the idea for TCR was just in the air. And if one of these people didn't come up with it, someone would have maybe throw in this room. So now we're into that third section will talk. We're done with these sort of like historical interlude of conspiracy theory Okay, so in my like early Misadventures in the TCR here are some things that I learned improving test if you're not writing to not changing the implementation tcra's great because as long as
your goal here is to change test and have them keep passing. So every change you make that passes and cost fallacy feelings in this but we throw something out that doesn't work. You're throwing out something bad not throw it out something good. But if it does not run in just like it's behoove you to not run the whole test we try so you can just the ones that have a change in them. Will give you a much faster P back Loop feedback loop is longer than a few seconds TCR feels clumsy.
So it sort of hand wavy and productive but you could make your test fast by making your house fast or you can run manually or editing that typed out version TCR or you can draw an isolated test automatically and I think some of the tools that we have at our disposal can do the right thing here any cars back and many tests and guard you can just run the test localized to the change that I made. so fast pass or super important here and the place where TCR is like obviously a good idea is retiring cuz using the sword of Martin Fowler definition
of refraction of changing internal arrangement of your code without changing the external behavior of your code is perfect. Right? You want me to move stuff around reorganize your code, but not break your tough. So make it tiny change run the test if they pass commit if they don't I do and repeat. Okay, so I did a few pairing sessions to go. Drink River when Marco Rubio did not like the State of the Union in like rebuttal in music County Water so a bear walks into a bar and the bartender says
Okay. So the first parent session was with Morgan Fogarty and we commit history is completely not useful that every single one of your comments. That matter is is our like MIT login port-of- feels like I feel like I go back and read it sometimes but like I never went back and read my old issues of comics by like having them. So maybe it's so much most of us to most of time anyhow, and never work on master. And then when you merge your p r e to do a squat commit take all that noise, even if you're not doing useless, are you useless messages? We
also found that we had a reflex to want to just like undo our changes that we lost to the or revert part and we we ask is that cheating? Like what is cheating even in the situation so but We moved on and we also were sometimes confused by time. We get like a failure or an error message and refer to a line of code that was put School bar. And we go there and puts Fubar wasn't there anymore. So removing the forecaster some state of what the failure was and
show you chose them. We also found that it was tricky sometimes make changes to both the test and implementation may say it's like the opposite of tdd failing tests. But TCR says if you write a failing test that failing test gets reported. So trick work around again, like we would write a test then we'd hard-code the implementation, you know, we expect you know Foods the past which witch is which would lock in that test and then we could go TCR adjust the implementation with the no changes to be reported over and over but we wouldn't lose
her test. little bear says I'm a bear. I got with my mom. Show me a big part of the reason I joke is funny is because a bear would never go into a bar in order to drink a bear drinks. So I paired with Evan Phoenix on an actual like no production bug and Puma great. You're all probably using this was totally inconsequential book. When you start it the output in the terminal would tell you what port is running on even though I was running on 3000 it always have zero so I cool. Let's go do it in
reverse and muscles revert. You know, that's what I was thinking. Mostly those were verts were when we were exploring the interface. I'd like the TCP class module. It's it's old murky place and we ended up needing. Stream, but obviously we thought we needed that to us and not to ask was given us just like string of hex not zero. so this is what are commits ended up looking like super helpful and we were running isolated test for Speed because Pumas all sort of network test because And then before we get our pull request, we would run the entire testimony and
then again in CI and that worked out really well that was like a half hour or so. And that was a new feature, which was I'm sorry. I left something out. So the first was a test that succeeded by describing the buggy behavior. And then from that test we could then change our expectation of that feature and then go change that fix that from the station. So I paired with buckets Worthy on a rail to react to Something Real side. It's called kids on 45th. It is this website cheap clothes for kids that like like Stitch stitch fix for kids. I only got the tent the test were so
fast. We can run the whole sweet every time and over the course of 86 minutes. We did 53 and one things we discovered is if you wanted to if you were like a contractor or someone, I like to keep track of your time. You can use your commit long to do it because way down here at the bottom. It says 86 minutes ago and then 3 minutes ago normally only capture. The last thing he said it really encouraged us to make these really small moves. I even I even two lines with sometimes too much cuz
And we made it started making you like Single Character moves that we would write you don't like this kind of changed because update would it fails it feels really quietly and we weren't TCR it would succeed even though update error or like a note didn't validate and then we would at the bank and then update bang fails very loudly so we would then get a failure to get reported, but we only lost one character. So my being very careful we learned that we could be very
risky. And the big the big takeaways small braids, like small things are safe easy. They're cheap to try but more portly there cheats at fail. Cuz pause is a homonym with pause like bare feet. The amount of time like Morgan I like this inclination to like undo or like he was using the bathroom and it didn't like Auto refresh the file. And so we save the file and then we didn't lose our changes but we're doing this to do this. Let's find out until we trust the process. We really pedantic and feel the pain of losing changes so that it would encourage us to find the benefits
and the benefits were make small moves sometimes single word sometimes single characters and we also found that we can really like go do some exploratory Demolition and let the or revert clean up for us. We have to keep track of where all of our life and our like, I think it's like food. Bar, but it turned out to be food on bad if it fails it just all get cleaned up for us. We can start fresh every time. Sometimes you like exploring some some class. And we would go put it into our implementation. That's
our test is testing and then this would not succeed and then go get white out for us to put test on two without have to expend. We also found a writing things like outside in was again like safe which allowed us to like move more confidently. And so one step at a time here is the test that we ended up with. This is not the prettiest in the world in Midland Lee. There's a lot of the issue credits back to customers when something's not inventory in order for us to do this equal 300. So here's the code.
I want to walk through the steps that we took it as if so first we have the file. We just acquired this we run the test, of course every single one of these is of course it passes. So we add the class. We have the fixtures. We had the task method and we start doing the setup step by step by step when you get out of here. We do, you know this like a traitor Before I could doing something inside of that tap block. Toronto on all these our state moves and then our final thing that the only time that was actually risky was right here is it's our
implementation. Did it actually result in 3 hours and maybe can't see it. So I made it big. So that was the the the final test there. And I just have white lines for the rest of my time came. So what are the Lessons Learned in general. Fast making small moves is always a good idea this process kind of like encourages. You would both like a carrot and a stick to make small lives. You can think of the the other small commit as like you're climbing up the ladder and you're bringing the safety net with you every time you commit that's taking that
is like right below you. So if you fall you fall like this much. Area growth is is that would make me small moves and I trust in the process and all of those things are straight out of his book. I did not know that when I started this process, but I read this book. I was exploring TCR. I was like, holy shit. They came up with these ideas weather building billions in Oregon. So that's the sort of Indus of my talk. I hope it was weird wild and wonderful. So here are the action items
for you to put on your TPS report? You have a to-do comments in your code and you want to delete it. But in order to delete it you have to do the things you don't have to do anything, but I have some book assignments. You could send me your book reports Monday morning to organ experiments. 680 Pages a big the timer for a building is thicker its Theory. It's also great and a pattern language. Is a Cornerstone of a different industry and became a Cornerstone of our industry and we do software the way we do because of this book
read this book again. It's like Talking Stick super good. 99 bottles is incredible it go through the teeth are processed what they set out to accomplish. They never skipped a single step in any of their code examples. They don't go from my shity shity. Perfect. Like wait, what were the 30 steps between they do all 30 stuff for fun? Because I have a public address system and sailing captive audience will give you two non nerd book recommendations. The uninhabitable Earth is the
best book on climate change that I've ever read. Everyone should read the opening sentence is it is worse much worse than you think. Station eleven is the Brilliance weird novel that I don't tell you anything about it except for like nonlinear and it's unclear who the protagonist is. by Emily st. John Mandel I'm at Southeastern Technical action items who are the yellow light up or I want you to try not to laugh. But sincerely it is safe. I'm not suggesting that you do this on Master on your test
on a real project see what it feels like outside of you know, I don't do it in the the real world and we'll find out if it's worth finding out about Jamaica Branch run TCR before making any changes and then you just press the up Arrow over and over right after something improve test or test coverage fix a bug out of feature. But all the while make small moves, whatever you think it's small go smaller than that. It's like when they say like pack every play every need and then cut in half. And into my offer to you is if you want to try this, but you feel like you need a sidekick or a
cheerleader or a buddy. I will be that I will pair with you for a half hour ish while we're. Orbio remotely over our computer TVs. And then my request of you is that if you do this to me about your experience, what are you doing with me or by yourself? Feel like let's talk about TCR. This is like I said, no idea that one time or maybe this is how we do software for the next 10 years. So let's talk about it publicly. You can mention me if you want you can tweet at me or not.
And I want to know like what works what does it you know, what did you learn that? I didn't learn here. Was it fun for you? Will you keep trying to put it? So here's the extra credit bonus make some tooling your right bass function that takes some input to bike which tests to run or the message or figure out a way to do a dynamic commit message. If you know how to use one as I eat. I don't you make a text editor plugin Amor sublime or the very best. I ruined my joke. I somehow deleted my texts might slide. That's not right. I saw you text me make a plug-in for
any of those. I don't know. What a t crcl I would be but maybe you do and make it. I want to thank you for your time. I know you have lots of options when flying across country. Thank you for flying on the weird wild and wonderful Trek bike. That's how you can find me. I will not take any questions and they remain 50 seconds up here, but I would happily talk to anyone out there.
Buy this talk
Access to all the recordings of the event
Buy this video
With ConferenceCast.tv, you get access to our library of the world's best conference talks.