List

From test && commit || revert to LIMBO

From test && commit || revert to LIMBO

by Shane Becker

In this talk from RailsConf 2019, Shane Becker discusses the concept of "Test && Commit || Revert" (TCR), exploring its origins, practical applications, and implications for software development. The talk is structured in three parts, starting with a technical overview of TCR, followed by a historical context that highlights the evolution of programming patterns and methodologies that led to TCR, and concluding with practical insights from Becker's own experiences implementing the concept.

Key Points Discussed:

  • Understanding TCR: TCR is a process where if tests pass, all changes are committed; if they fail, all changes are reverted. This mechanism emphasizes rapid feedback and encourages programmers to work in small increments.
  • Historical Context: Becker shares a brief history of influential concepts and figures in software development, such as Kent Beck, who contributed to Test-Driven Development (TDD) and the Agile Manifesto. The principles of TCR can be traced back to architectural patterns discussed in books like "A Pattern Language".
  • The Evolution of Programming: The talk reflects on how the TCR methodology is grounded in past programming practices and philosophies, asserting that many modern practices are derived from earlier ideas.
  • Implementation and Lessons Learned: Becker recounts practical experiences using TCR, identifying challenges such as reverts during coding sessions, which led to valuable lessons. Important takeaways include the significance of fast tests, the benefit of making small, incremental changes, and trusting the automation process.
  • Practical Application: He encourages attendees to implement TCR in real-world projects, emphasizing experimentation with TCR while remaining in a safe coding environment. Becker offers suggestions for improving tool integration and enhancing TCR practices.

Conclusions and Takeaways:

  • Becker asserts that TCR can potentially reshape the way programmers approach software development. It fosters a culture of safety in experimenting with code, while boosting efficiency and reducing the fear of failure in committing code changes.
  • The talk concludes with a call to action for developers to explore TCR, whether in toy projects or live applications, and to engage with the broader programming community about their experiences with this approach.

Overall, Shane Becker's presentation at RailsConf 2019 sheds light on an innovative approach to coding practices that combines history, theory, and practical application in a rapidly evolving field.

RailsConf 2019 - From test && commit || revert to LIMBO by Shane Becker

_______________________________________________________________________________________________

Cloud 66 - Pain Free Rails Deployments
Cloud 66 for Rails acts like your in-house DevOps team to build, deploy and maintain your Rails applications on any cloud or server.

Get $100 Cloud 66 Free Credits with the code: RailsConf-19
($100 Cloud 66 Free Credits, for the new user only, valid till 31st December 2019)

Link to the website: https://cloud66.com/rails?utm_source=-&utm_medium=-&utm_campaign=RailsConf19
Link to sign up: https://app.cloud66.com/users/sign_in?utm_source=-&utm_medium=-&utm_campaign=RailsConf19
_______________________________________________________________________________________________

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.

RailsConf 2019

00:00:20.449 so unfortunately in the time that I put this talk together I didn't have
00:00:26.789 opportunity to dive into limbo too much with other people and it really does require other people it's not a by
00:00:32.520 yourself thing so when I change the title to talk a little bit and take out limbo and since I'm not going to
00:00:38.070 anywhere that doesn't make sense to have the two in there if I'm not going to anywhere the from doesn't make sense so I'm just
00:00:44.280 left with testing commit or revert but what I ended up doing it was talking about patterns a whole lot software
00:00:50.129 patterns the design patterns architecture patterns and so we're gonna add that in there and then finally do a little bit formatting so here's the
00:00:56.399 title of the talk on patterns and tests and commit or revert my name is Shane
00:01:02.309 Becker I go by vegan straightedge on the internet I look like this in most places
00:01:08.039 I used to look like that that and that's normally where a Cubs hat and me and
00:01:15.450 Terrance Lee are sort of the blue hat ruby crew once co-organized Cascadia
00:01:21.690 ruby with big bleeding and seattle and then after me they did it in portland i put on the best backyard storytelling
00:01:29.009 conference in the universe called farmhouse conf in hollywood california and i used to be the open source
00:01:34.619 cheerleader for engineer hard way back when when they were a company and I
00:01:39.810 worked with the open source teams on Rubinius and JRuby doing sort of community outreach kind of stuff I
00:01:46.250 currently live in a small town called San Francisco California and I work for
00:01:52.259 a company called mode it's also on my hoodie here it's totally amazing the
00:01:58.830 culture is really great these are the company values that you can't read at this size but if you talk to me or CTO
00:02:05.280 or coworker we will tell you them we have lots of inside jokes about goats
00:02:11.430 and lots of puns all of the all of the puns the people are great we have
00:02:17.690 developers and engineers at various experienced levels and interests and
00:02:22.739 expertise and of course we're hiring you can find more about the company at mode
00:02:28.590 com the product is let's imagine you have it some mountain data in a database and you want to ask
00:02:35.450 data-driven questions or get data-driven answers you could if you have data
00:02:41.250 scientist data analyst or just you know curious folks who are willing to write a little bit sequel or already know sequel
00:02:48.180 they could do a thing sincerely you should click go find our CTO who is
00:02:56.730 somewhere in this room and we'll be at the the table out in the place where the
00:03:02.790 tables are she is the very best you should go find her and come work for us
00:03:08.870 ok on to the talk the talk is going to be three parts a sort of technical
00:03:15.810 overview briefly of what is testing commit or revert and then this weird
00:03:21.800 wild and hopefully wonderful historical interlude does everyone know that they're in a talk on this track called
00:03:28.140 weird wild and wonderful ok great so that's what you're in store for I hope
00:03:33.230 that's what I set out to have you in store for and then toward the end some more sort of deeper dive into the
00:03:39.840 technical stuff the lessons I learned in the process can you start the countdown
00:03:45.900 clock the big red one thanks ok so here is the TLDR for the whole sort of
00:03:53.220 technical part of the talk it's actually writing the title test and commit or
00:03:58.290 revert so it's just right there and for the people in the back I made it big so
00:04:03.510 let's break this down right because these aren't actually like Unix commands that you can issue right test isn't a thing so these are just ideas these are
00:04:10.230 concepts so let's turn these concepts into actual commands we can issue right so test maybe you're running mini tests
00:04:16.410 and you can use rake tests or maybe you're using r-spec and maybe that r-spec has to be run under the context
00:04:21.720 of bundler and maybe you have it alias because you hate typing like I do so
00:04:26.789 that's the test part right and then the commit part in in testing commit or
00:04:31.979 revert means like commit all of the things you're not going to be picky you're not gonna choose some things
00:04:37.919 you're gonna commit everything and so we could do a git commit - am all of the
00:04:43.440 things and if you don't know the - - M - M means I want to have a commit
00:04:49.800 message in line right here in this command instead of popping open opening my editor and type in a thing there and
00:04:55.050 - a means add all of its the equivalent doing a git add dots but only of the
00:05:00.300 files that you already have attracted a version control so in bash you don't
00:05:05.310 have to have quotes around things if they're single words so we'll just say working and to do our future selves a
00:05:10.349 little favor we'll use something thats sort of a signal - what the hell is this weird little small community commitment
00:05:16.580 okay and again - a doesn't catch untracked files so if you created a new
00:05:22.800 one it won't it won't show up in that commit so I'm also going to talk tech on a git add dot which leaves us get add
00:05:29.729 dots and git commit - a MTCR for the commit part of testing commit or revert
00:05:36.919 and now the revert is you know the opposite when you want to do all that
00:05:42.569 work and chances are you're using git if you're still using subversion I'm sorry
00:05:49.050 come in from the cold we have hot chocolate we have central heating so but
00:05:54.300 to be clear it's not a git revert in the sense that you're undoing a past commit it's it's undoing all of mice unsaved
00:06:02.009 changes okay and there's two ways to do this and get at least two ways you can do a git reset - - hard which is bold
00:06:09.599 and daring and that's gone forever or you could do a you know add all your files and make sure you have untracked
00:06:15.029 ones and then you could stash it and the stash is like a what is it last in first out stack so you could catch those
00:06:22.259 changes back out if you want to but for our purposes we're going to be bold and
00:06:27.539 daring and let go of the past so we went from this test and commit or revert to
00:06:35.279 this which I will never type by hand so I made an alias because I hate typing
00:06:41.099 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
00:06:47.370 very large room okay so if you're only here for the sort of like technical
00:06:53.219 reenacts or the reenactment of a technical blog post thank you for attending my TED talk you're free to go
00:07:00.130 because now I want to talk about like the idea of TCR and like where do ideas come from man okay
00:07:08.750 so I'm already tired of saying test and commit or revert so I want you to create
00:07:14.900 a mental alias for when I say TCR I mean testing commit words so what the hell is
00:07:22.850 this thing in my opinion TCR is five things it's just an idea which I have
00:07:28.730 opinions about that word just I think we should all purge it from we should just purge it from our language it's just an
00:07:35.030 idea right it's not a prescription of particular tools or technology right it's a combination of things that we
00:07:41.330 already know I bet everyone in this room has run tests maybe written test has committed code and as reverted code it's
00:07:48.800 also the automation of that combination so we do all these things together as one thought and then it's also naming
00:07:55.580 the pattern of that combination and automation and finally maybe it is a new
00:08:01.760 way of doing software development we'll see I don't know it's still like it's not even in its infancy it's like in its
00:08:07.910 it's like a zygote of an idea so it's super-new unclear its future so if TCR
00:08:14.510 is quote-unquote just an idea like why now why why didn't someone else come up
00:08:20.600 with this before and to speak to those
00:08:26.450 questions I'm gonna tell the history of TCR or rather like a history of TCR
00:08:31.790 because let's start with the true facts that no history is objective or completes or unbiased or the reverse of
00:08:39.710 that so we could say that this section of my talk is a brief and incomplete
00:08:46.520 history of people events and ideas that predate the idea of TCR
00:08:53.410 which when let's swirled in to a stew and looked at through a particular
00:08:58.670 perspective might be seen as like related around a particular theme or something so I the the middle act right
00:09:10.370 I'm going to put a bunch of pin on a board and draw lines or connected
00:09:16.820 them with yarn and hopefully there will be like a thematic connection and that sort of mosaic will make some sort of
00:09:23.030 sense at the end okay when tells us history of these things
00:09:30.650 that ultimately lead to me in this moment giving that talk okay so where do we start unless you started the Big Bang
00:09:38.090 and complete include every single thing every history has some you know chosen
00:09:44.060 curated start I wanted to start this 100 years ago when Eisenhower took a road trip from DC to San Francisco and it
00:09:50.330 took 62 days but it got cut so let's start in Eugene Oregon at the University
00:09:56.270 of Oregon in 1961 when the university published its quote/unquote master plan this is not it
00:10:02.030 this is Apple Maps picture but that is the let's see does that thing work yeah that is the University of Oregon campus
00:10:10.100 and on this master plan where they laid out decades of architectural development
00:10:17.110 this in the sort of like ultimate Gantt chart and waterfall development they
00:10:22.550 laid out that they wanted to destroy or like raze this 1800s Cemetery and build
00:10:29.180 some buildings people the members of the community students faculty staff they
00:10:35.000 resisted this idea they pushed back and they're able to stop it and then in 1968 the university created a new building
00:10:43.340 for the science department called Klamath hall and Klamath Hall was a building that is ugly and it is in a
00:10:51.530 style of architecture called brutalist or Brutalism and if anyone in this room
00:10:58.130 doesn't know about Brutalism it's worth a quick sidequest which is these buildings tend to have a lot of
00:11:04.430 concrete's involved they tend to have a lot of sort of rigid geometry and in
00:11:11.270 some ways they had their boom and they're like 60s and 70s in some ways these buildings remind me of the Jetsons
00:11:17.270 it's this like retro neo futurism it's
00:11:22.310 like our parents or grandparents a vision of what they thought the future would be and it a future that never really happened so
00:11:28.520 there are these like artifacts these relics and every time I think a future
00:11:33.950 of Brutalism I always think of this one building in particular that's now
00:11:39.500 abandoned and I was created as a sort of soviet monument in bulgaria which is in
00:11:44.840 that part of the world if I was John Oliver I would show like a picture of like South America and say it there and
00:11:50.420 then switch and this place is named yes I don't speak Bulgarian or Turkish so I
00:11:57.230 don't know how to pronounce that my apologies I have read that it's Turkish for I see which makes sense because it
00:12:05.150 looks like Hoth and but to me this building makes sense this like weirdly
00:12:11.870 like in this place like on the peak of this hill even like at like off in the distance like its silhouette it makes
00:12:16.940 sense in this context and in a way it's like even kind of beautiful admittedly like for me part of the beauty is that
00:12:23.450 it's abandoned and falling apart I think that's kind of pretty in its own way and in the right context these
00:12:30.200 buildings can be really beautiful and even kind of cool and hopeful but in the
00:12:35.660 wrong context or done poorly this is the buffalo Buffalo New York City Court
00:12:42.590 building imagine going to work there every day there's not a single window or like this building it looks
00:12:51.320 like a goddamn battleship so I don't
00:12:56.600 like Brutalism but I could see it done well sometimes so back to Klamath Hall
00:13:02.210 it was none of those things so it was ugly or is this building is still there
00:13:09.350 it is ugly it is out of place the rest of the building is like or the rest of the campus it's like red brick and trees
00:13:15.200 and you know like the Pacific Northwest and it's frankly pretty inhumane and
00:13:21.140 then in 1970 brace yourself that's good so dark for moments in the Pacific
00:13:27.200 Northwest there's a lot of logging and clear cuts and those logging trucks would sometimes drive through the campus
00:13:32.960 and in 1970 one of those logging trucks kill the students and so rightly so
00:13:39.350 people were upset and combination of that happening it was
00:13:44.450 a sort of a general time of unrest and protests and these like development
00:13:49.519 decisions the community was like you know we want to have some we don't like these particular decisions but we also
00:13:55.610 don't like the process in which these decisions were made so the president the university enlists a group of architects
00:14:02.240 from UC Berkeley and these are their names I will refer to them as the
00:14:08.329 Christopher Alexander group later they come in and they're asked to like
00:14:14.149 basically solve their problems so so one of their problems is which buildings to
00:14:21.140 build and the other problem is how do we say decide which buildings to build so they write this all up and publish it in
00:14:29.209 a book called the oricon experiment everyone in this room should read this book it's you know half inch thick 180
00:14:34.579 pages you know pretty small and it lays out these six principles Organic order
00:14:39.709 meaning like the whole is only ever presented by a bunch of local acts you
00:14:44.720 can't build the whole you can't build the web the web can only be expressed by a bunch of websites participation the
00:14:50.839 the users of space you know the faculty the students the staff must be the ones
00:14:56.240 to decide what to build and when to build it piecemeal growth small iterations patterns this part was huge
00:15:02.870 patterns is an agreed-upon sort of vocabulary which we build from we design
00:15:08.360 from diagnosis and coordination so all those get published into this book again
00:15:13.850 everyone should read it they also published the timeless way of building which laid out the theory of this process and then a pattern language
00:15:20.329 which is a tome it's the best of these books it lays out 250 patterns some of
00:15:28.220 which are very large like neighborhood should be identifiable right there should be an eccentric nucleus so on and
00:15:35.149 then some very small like there should be sitting walls here are different kinds of city walls right so it's it's
00:15:40.310 this broad scope of things okay so how
00:15:45.350 do we go from there to here thank you for bearing with me here's where we turn towards making computers go so just like
00:15:52.640 how two people at the same time in Europe discovered calculus independent of each other in
00:16:01.639 1970 that didn't happen in 1979 that that'd be weird in the year I was born
00:16:08.029 in 1979 two different people read a pattern language and came to the same sort of revelation independent of each
00:16:16.069 other and wouldn't meet four years later so one of them was named Ward Cunningham he I hear I did I wasn't able to talk to
00:16:23.720 Ward directly for this but other people told me he was given a draft copy of a pattern language and then Kent Beck was
00:16:32.209 always just like really into architecture as a kid and still and so he read this book in the UFO bookstore
00:16:39.949 like an hour at a time standing up in the aisle because he couldn't afford to buy it and then several years later in
00:16:46.370 1985 Kent Beck happens to get hired onto a project that's Ward Cunningham as our
00:16:52.130 do and in the process they accidentally invent or rediscover a pair programming and then they start talking about
00:16:58.940 pattern language patterns in general and ideas they've had this connection between how buildings can be built this
00:17:07.189 process and then how we're building software so they launched a website
00:17:13.459 called the portland pattern repository which is hosted at sea to calm and it is the first wiki Ward Kent Ward Cunningham
00:17:20.360 created it for this site it's still there in 1994 the sort of continuation
00:17:25.669 of that community eventually publishes a book called design patterns by a group
00:17:31.070 of authors that get referred to as the Gang of Four this is one of the seminal texts in our industry a few years later
00:17:37.460 in 1997 kitten back published a book about patterns and small talk and this
00:17:42.650 is the book that kicked off the whole thing that led me to talking today I was bar on this book from a co-worker and
00:17:48.770 friend named Josh Susser and a couple chapters and I was like patterns I remember a book called a pattern
00:17:54.740 language it's been recommended to me in like the late 90s when I was making flash websites as some like metaphor for
00:18:00.650 web design and I read it thinking this will be a web design book and it's not it's literally about building buildings
00:18:06.260 I thought that would be eka I'm for for building websites it wasn't so I wasn't ready for it and then later on
00:18:12.120 friends recommended it because I want to build a tiny house and again I just wasn't ready for it this time I bought
00:18:18.390 it sort of sight unseen and I got it this book there's a direct through line
00:18:23.549 from this book published in the 70s to this book published in the late 90s ok
00:18:29.040 and I made this connection independent right independently but it was in the
00:18:34.890 context of the four decades of like the influence that these other people and
00:18:41.070 their connections that they had made has influenced our industry in the way we do work all right so Kim Beck is also
00:18:48.299 credited with inventing test-driven development or TDD but the way he explained it to me is he rediscovered
00:18:54.330 TDD in the sixties NASA was actually doing TDD during the mercury missions
00:18:59.400 they would write out input tables back when we had input tables and output tables and just write code until it
00:19:04.559 matched that's TDD extreme programming basically falls out of this from Kent Beck as well
00:19:11.240 combining some of these tools so a pair programming TDD stored cards and shortly thereafter we get the most beautiful
00:19:18.090 website ever the agile manifesto which is just frozen in time and this giant
00:19:23.309 image tiles by the way if you scroll down there's just the same management level and all of the ideas in agile come
00:19:33.059 directly from these books ok especially the Oregon experiment and it's six
00:19:38.309 principles the first three of which describe agile development okay so how
00:19:44.610 do we go from architecture design principles in the 70s to test and commit or revert in 2018 and my hunch is that
00:19:54.660 there's a few people sort of hovering around this idea at the same time it was a few actors so Kent Beck had for a long
00:20:00.630 time been doing tests and commit as sort of one thought just sort of out of laziness and efficiency and just habit
00:20:06.950 okay and and then 2012 Sandi Metz publishes this book which you should all
00:20:13.200 read and if you have it if you have read reread it so good colloquially
00:20:18.990 it's referred to as pooter as like a little kid would say computer she covers like refactoring and patterns
00:20:27.499 and design and testing I am timeout here
00:20:34.649 I'm confused that says I have 20 minutes left and this says I have 39 minutes left that cannot be right I've not been
00:20:39.720 talking for one minute that's some fast socket okay so in 2017 sandy and Katrina
00:20:46.499 Owen published this book called 99 bottles of ooh where you program either 99 bottles
00:20:51.749 of beer on the wall or milk on the wall it is also great everyone should buy this book and read it and in this
00:20:58.739 process in the book they describe the process of basically like manual TCR they say make a tiny change run the test
00:21:04.259 if they pass commit if they don't undo your change make it better change that sounds like TCR or the other way around
00:21:12.149 when I learned about TCR I was like that sounds like 99 bottles of oak and it's worth pointing out that Kent Beck wasn't
00:21:18.269 even the one that came up with the or revert part that was a Oslo air in Oslo
00:21:23.669 at code camp he described his process of doing tests and commits and then this
00:21:31.919 person will say admin Stromer Strom er said to him well if you do this then
00:21:39.450 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
00:21:45.960 we must try it so who invented TCR I don't know if that's the right question
00:21:51.450 I think attribution is important people should not be lost people should not be like written out of history but maybe
00:21:57.179 the question is like who discovered TCR maybe it's katrina owen because she was doing it she described manual TCR and
00:22:02.639 she was doing it and maybe it's Kent Beck because he named the thing and maybe it's admin because he tacked on
00:22:09.629 that last part who knows but I think the real point is that ideas don't exist in a vacuum and
00:22:15.899 they're also not created in a vacuum right we never have we never ever have like Eureka moments we always have like
00:22:22.529 the next so every idea stands on the shoulders of giants because everything
00:22:28.139 is a remix if you haven't seen that video series you should let definitely did not write original music
00:22:34.100 that's fine but you know everything is a remix and since everything is a remix
00:22:40.130 this is also an idea that should go read about we have basically the same brain as our you know Paleolithic ancestors
00:22:49.370 but they could not have imagined nuclear missiles they could imagine rocks and
00:22:54.500 then rocks attached the sticks and sticks that our point you know so on so one of the things Sandi said to me is
00:23:01.520 that maybe the idea is time had just come right it was the idea for TCR was
00:23:08.450 just in the air and if one of these people didn't come up with it someone would have maybe someone in this room
00:23:14.410 okay so now we're into that third section on the talk we're done with the sort of
00:23:19.520 like historical interlude of conspiracy theory okay so in my like early
00:23:28.010 misadventures into TCR here are some things that I learned improving tests if
00:23:35.480 you're not writing if you're not changing a implementation TCR is great because as long as like your goal here is to change tests and have them keep
00:23:42.320 passing so every change you make that passes commit that if they don't you don't want that and there's a lot
00:23:48.380 like sunk cost fallacy feelings in this but when you throw something out that doesn't work you're throwing out
00:23:54.290 something bad you're not throwing out something good okay but if your test suite does not run in just like a few
00:24:00.500 seconds it's behooves you to not run the whole test suite right so you could run an
00:24:06.050 isolated test just the ones that have a change in them which gives you a much faster feedback loop which is super
00:24:13.310 important if if the feedback loop is longer than a few seconds TCR feels clumsy so the takeaway is like make your
00:24:20.960 tests fast and they're sort of hand wavy and reductive but you could make your
00:24:26.270 tests fast by making your tests fast or you can run isolated tests manually right so you're editing that either that
00:24:31.610 alias or your your manual kind of like typed out version TCR or you can run an isolated test automatically and I think
00:24:38.930 some of the tools that we have our disposal can do the right thing here I think r-spec and mini test and guard you
00:24:45.500 can say like just run the test lies to the change that I made okay
00:24:50.580 so fast tests are super important here and the place where TCR is like
00:24:56.910 obviously a good idea is refactoring because using the sort of Martin Fowler
00:25:04.680 definition of refactoring of changing internal arrangement of your code without changing the external behavior
00:25:11.340 of your code it's perfect right you want to you know move stuff around reorganize your code but not break your tests so
00:25:18.210 make a tiny change run the tests if they pass commit if they don't do and then repeat okay so I did a few pairing
00:25:25.830 sessions part of me here would take a little drink we're over when Marco Rubio did that like the State of the Union and
00:25:33.750 like rebuttal and he was a powdered water so a bear walks into a bar and the
00:25:43.170 bartender says what can I get you and he says gin and tonic okay so the first
00:25:48.480 pairing session was with Morgan Fogerty and we built Fibonacci right it's like
00:25:54.900 an own little domain and I hear the things we learned the commit history is completely not useful okay it's that
00:26:02.820 every single one of your commits and then some of like does that matter is is our like commit log importance it feels
00:26:10.679 like yes I feel like I go back and read it sometimes but like I never went back and read my old issues of comics but I
00:26:17.640 liked having them so maybe it's it's something like that so maybe we should always work on a branch which most of us
00:26:23.490 do most the time anyhow and never work on master and then when you when you
00:26:28.559 merge your PR you can do a squash commit take all that noise how you're you know commit history that's probably also a
00:26:34.710 good idea even if you're not doing useless commits are useless messages we
00:26:40.080 also found that we had a reflex to want to just like undo our changes that we
00:26:46.770 lost to the or revert part and we we asked like is that cheating like what is
00:26:53.700 cheating even in this situation so but we moved on
00:27:00.080 and we also or sometimes confused by pardon me would get like a failure or an
00:27:07.220 error message and would refer to a line of code that was no longer true so I'd be like line seven puts fubar and we'd
00:27:13.610 go to there and puts fubar wasn't there anymore so that was sometimes confusing but that could probably be solved by tooling not by like removing the idea
00:27:20.690 itself you know maybe there's TCR tooling that sort of capture some state of what the failure was and show you
00:27:26.000 shows you that we also found that it was tricky sometimes to make changes to both
00:27:32.870 the test and the implementation basically it's like the opposite of TDD right so TDD says red green refactor you
00:27:39.380 write a failing test but TCR says if you write a failing test that failing test gets reverted so a sort of trick
00:27:48.590 workaround again like is this cheating unknown we would write a test and then we would hard code the implementation
00:27:54.980 you know we expect you know food to return 37 we would just go put it 37 and
00:28:00.140 foo as the return value we run TCR the test would pass which would commit which
00:28:05.780 would lock in that test and then we could go TCR adjust the implementation with the you know those changes could be
00:28:12.680 reverted over and over but we wouldn't lose our test okay and the bear says I'm
00:28:20.240 a bear I got them from my mom because he
00:28:26.450 has big paws so the reason that joke is funny is because a bear would never go into a bar in order to drink a bear
00:28:32.630 drinks the campsite okay so I paired with Evan Phoenix on an actual like you
00:28:40.160 know production bug in Puma does anyone not know what Puma is in here great you're all probably using
00:28:46.910 cumin this was totally inconsequential bug when you start it the output in the
00:28:52.730 terminal 3 thousand it always said zero so I cool let's go do this and we did it
00:29:00.290 over the course of six commits into files and we got about a dozen reverts and most of those reverts you know that
00:29:06.530 y'all know the tattoo that someone got this had no records that's what I always think of when I'm with this so mostly
00:29:12.860 those reverts were when we were sort of exploring the interface of like the TC PE class or module it's
00:29:19.370 this old murky place and we ended up needing string but obviously we thought
00:29:27.380 we needed to s and not to s was given us this like string of hacks not zero so
00:29:33.560 this is what our commits ended up looking like super helpful and we were
00:29:39.410 running isolated tests for speed because puma is all sort of network test because
00:29:44.750 it's a web server and then then before we did our pull request we would run the
00:29:49.970 entire test suite and then again in CI and that worked out really well that was maybe like a half hour hour or so and
00:29:57.320 that was a new feature which was I'm sorry I left something out so the first test that we wrote was a test that
00:30:03.920 succeeded by describing the buggy behavior and then from that test we could then change our expectation of
00:30:10.460 that feature and then go change the fix the implementation so I paired with a book of swarthy on a rails and react up
00:30:17.480 just on the rail side it's called kids on forty-fifth it is this website it's
00:30:23.090 like cheap clothes for kids and like it's like stitch stitch fix for kids and
00:30:28.160 oh my god the Tet the tests were so fast we could run the whole suite every time and over the course of 86 minutes we did
00:30:35.990 fifty-three commits and one things we kind of accidentally discovered is if you wanted to if you were like a
00:30:41.930 contractor or someone that like had to keep track of their time you could use your commit log to do it because way
00:30:47.900 down here at the bottom it says 86 minutes ago and then way up here the top says three minutes go and we normally
00:30:53.360 only capture the last thing you know like that when we did the save or the commit so that's not certainly not the
00:30:59.690 reason to do this but that's a fun little side discovery and it really kind
00:31:06.260 of encouraged us to make these really small moves even like even two lines was sometimes too much because a we
00:31:12.620 have to retype two lines and we may started making like single character
00:31:18.590 moves so we would write you know like this kind of change like a set up in our
00:31:24.710 test because update would it fail fales really quietly it would run TCR it
00:31:30.170 would succeed even though update errored or like you know didn't validate and
00:31:36.310 then we would add the bank and then update bang fails very loudly so we
00:31:42.320 would then get a failure it get reverted but we only lost one character and like suddenly we cared about how much we had
00:31:47.600 to type so by being very careful we learned that we could be very risky and
00:31:54.580 so the big the big takeaways small moves why are small moves important though why
00:31:59.660 are they good you know like we talk about them all the time small objects small methods but what what does small
00:32:04.970 moves actually give us right so like small things are safe they're easy they're cheap to try but more
00:32:11.180 importantly they're cheap to fail because pause is a homonym with pause
00:32:18.710 like bare feet the amount of time okay
00:32:26.560 so we also like Morgan I we had this like this inclination to like undo or
00:32:33.860 like he was using them and it didn't like auto refresh the file and so we're like oh we could just like re save the
00:32:39.410 file then we didn't lose our changes but we're like we're doing this to do this let's find out so we're like let's trust
00:32:45.950 the process and be really pedantic and feel the pain of losing changes so that
00:32:52.220 it would encourage us to find the benefits and the benefits were you know make small moves sometimes single words
00:32:57.920 sometimes single characters and we also found that we could really like go do some exploratory demolition and let the
00:33:05.120 or revert cleanup for us we don't have to keep track of where all of our like Putz's and our like I think it's like
00:33:12.140 food bar but it turned out to be food has like if it fails it just all gets cleaned up for us and we can start fresh
00:33:18.110 every time yeah so sometimes just like exploring some some class we don't know
00:33:25.970 well or some method and we just go put it into our implementation that's our
00:33:32.810 test is testing and then this would not succeed and then we'll go get wiped out for us so it gave us like additional
00:33:38.470 points to put - with how it happened I like spin up a whole test we also found the writing
00:33:45.299 things like outside in was again like safe which allowed us to like move more
00:33:51.000 confidently and so one step at a time here is the test that we ended up with
00:33:58.830 and this is not the prettiest test in the world admittedly there's a lot of setup it's as complicated like this is
00:34:04.080 how they do the issue credits back to customers when something's not in inventory so there was like a fair bit
00:34:10.379 like they had to invent the universe in order for us to do this last line and assert equal since 300 so here's the
00:34:18.300 code I'm going to walk through the steps that we took seen as each commit so
00:34:24.720 first we have this file we just required this we run the test of course they pass every single line of these is of course
00:34:31.320 it passes right so we add the class we had the fixtures we had the test method
00:34:37.050 then we start doing the setup step by step by step then even when we get down here we do you know this like iterator
00:34:44.869 before actually doing something inside of that tap block so and so and so on
00:34:50.490 all these are safe moves and then our final thing that the only time that was actually risky was right here is if our
00:34:58.200 implementation didn't actually result in three dollars and because we're in a
00:35:05.460 flat room maybe can't see it so I made it big okay so that was the final test
00:35:12.030 there and I just have white slides for the rest of my time I'm kidding okay so
00:35:18.720 what are the lessons learned sort of in general I've said it a lot fast tests they're super important super fast tests
00:35:25.140 are important making small moves as always I got good idea this process kind
00:35:31.020 of like encourages you with both like a carrot and a stick to make small moves you can think of the all those small
00:35:39.390 commits as like you're climbing up a ladder and you're bringing the safety net with you every time you commit that
00:35:44.580 safety net is like right below you so if you fall you fall like this much iterative growth is is that like making
00:35:52.320 these small moves right and trusting the process and all of those things are straight out of this
00:35:58.780 book I did not know that when I started this process but I read this book I was exploring TCR I was like holy they
00:36:05.980 came up with these ideas while they're building billions in Oregon okay so
00:36:10.990 that's the sort of in dish of my talk I hope it was weird wild and wonderful so
00:36:19.990 here are the action items for you to put on your TPS report you have a to-do
00:36:27.040 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
00:36:32.410 do any things I'm not your boss I'm not your uncharged of your life do what everyone but I have some book
00:36:39.100 assignments you could send me your book reports Monday morning the organ experiment like I said is like half inch
00:36:44.920 thick it's 180 pages yeah big big type there are pictures some of you like pictures the timeless way a building is
00:36:52.930 thicker it's theory it's also great and a pattern language is a cornerstone of a
00:37:01.750 different industry and became a cornerstone of our industry and we do software the way we do because of this book ok pooter read this book again it's
00:37:09.970 like half inch thick super good 99 bottles is incredible it
00:37:17.200 goes through this TCR process it what they set out to accomplish and did
00:37:22.450 accomplish what this book was they never skipped a single step in any of their code examples they don't go from like
00:37:28.180 shitty shady perfect like wait what were the 30 steps between they do all 30 steps for fun because I have a public
00:37:36.340 address system at a fairly captive audience and I'll give you two non nerd book recommendations the uninhabitable
00:37:43.330 earth is the best book on climate change that I've ever read everyone should read it the opening
00:37:48.670 sentence is it is worse much worse than you think station 11 is this brilliant weird novel
00:37:57.070 that I don't want tell you anything about except it's sort of like nonlinear and it's unclear who the protagonist is
00:38:02.640 by Emily st. John Mandel okay so the sort technical action items who will have a
00:38:09.800 yellow light now or I want you to try TC are doing on a toy project like fib or
00:38:14.930 fizzbuzz or better yet do it in your production code base no no that's weird not a laugh line but
00:38:22.309 sincerely do it is safe I'm not suggesting that you do this on master I'm not suggesting you don't on your
00:38:28.130 test in fact I'm encouraging you to run your test I'm not suggesting that you don't use CIL all the same process but
00:38:33.710 do it on a real project see what it feels like outside of you know I bail
00:38:39.380 it's a binary tree on this wave board like don't care do it in the real world and then we'll find out if it's worth
00:38:46.430 finding out about to make a branch run TCR before making any changes and then
00:38:52.040 you just press the uparrow over and over right refactor something improved test or test coverage fix a bug at a feature
00:38:58.640 but all the while make small moves whatever you think is small go smaller than that okay it's like when they say
00:39:04.880 like pack everything everything you need and then cut it in half and then some I offer to you is if you want to try this
00:39:12.470 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
00:39:19.130 while we're here at rails camp or you know remotely over our computer TVs and
00:39:25.299 then my request of you is that if you do this tweet about your experience whether
00:39:31.339 you do it with me or by yourself you know like let's talk about TCR this is
00:39:36.490 like I said in the beginning that's like such an absurd idea that it's either something that's just a passing little
00:39:42.109 like one time conference talk or maybe this is how we do software for the next ten years so let's talk about it
00:39:47.900 publicly you can mention me if you want you can you know tweet at me or not don't care and I want to know like what
00:39:55.819 works what does it you know what did you learn that I didn't learn here was it fun for you will you keep
00:40:02.420 trying to okay so here's the extra credit bonus make some tooling you know
00:40:08.599 write a bash function that takes some inputs of like which tests are run or the commit message or figure out a way
00:40:14.540 to do a dynamic commit message do some IDE integration you know if
00:40:20.220 you know how to use one those IDs I don't you can make a text editor plugin
00:40:26.599 like vs code or atom or sublime or the very best oh I've ruined my joke
00:40:33.569 I somehow deleted my text may slide that's such a bummer I still use text mate make a plug-in for
00:40:40.170 any of those I don't know what a TC our CLI would be but maybe you do figure
00:40:47.520 that out and make it okay I want to thank you for your time I know you have
00:40:52.680 lots of options when flying across country thank you for flying on the weird wild and wonderful Trek this is me
00:41:00.599 that's what I look like that's how you can find me I will not take any questions in the remaining 50