82: Becca Bailey on Refactoring React Components
Today we chat with Becca Bailey about Refactoring — how to make your React code a little more liveable, human-friendly, and ready for anything.
You can hear more from Becca this march, on finding joy in refactoring.
Reactathon is a top React conference in the heart of San Francisco.
Becca and I will be there, passing out high fives and excited to meet you.
Get a ticket at reactathon.com.
Featuring
Links
- Formidable
- The State of React State in 2019 | Becca Bailey
- Shape Up: Stop Running in Circles and Ship Work that matters
- Refactoring: Improving the Design of Existing Code
- Testing JavaScript with Kent C. Dodds
- The different types of tests — Atlassian
- React Testing Library
- Enzyme
- Jest Snapshot Testing
- React Concurrent Mode
- "for each desired change, make the change easy (warning: this may be hard), then make the easy change" — Kent Beck
- ESLint
- Sarah Mei — The Power of Agile
- Konmari Your Code: Finding Joy in Refactoring — Becca's upcoming Reactathon talk
Transcript
[00:00:00] Michael Chan: This is React Podcast. I'm Chantastic. This is episode 82 of React Podcast. Today we chat with Becca Bailey about refactoring. How to make your React code a little more livable, human-friendly, and ready for anything. For the month of February, we're chatting exclusively with Reactathon speakers. You can hear more from Becca this March on finding joy in refactoring. Reactathon is a top React conference in the heart of San Francisco. Becca and I will be there passing out high fives and excited to meet you. Get a ticket at reactathon.com. Becca Bailey, welcome to React Podcast.
[00:00:48] Becca Bailey: Hi, I'm so happy to be here.
[00:00:50] Michael Chan: It is so good to have you. We've actually been working for like months to try to coordinate. I know we wanted to try to talk at React Rally.
[00:01:00] Becca Bailey: React Conf.
[00:01:01] Michael Chan: Sorry, React Conf. And that didn't happen. But we're finally, finally getting to uh to talk now. Um for anyone who doesn't know who you are, give us a little introduction to yourself and you know what you're doing these days.
[00:01:14] Becca Bailey: Yeah. Um so, I am currently working as a software engineer at Formidable, which is a JavaScript consulting company. So, I literally just write JavaScript and React all the time. And really enjoy talking about it. in front of people sometimes, as as you might have seen if you were at ReactConf or saw the videos from it. And I am currently in the process of moving across the country. Um, if you were in my house right now, you I you would see all the boxes that I'm just sitting next to. Um, and I will be making the cross-country move from Chicago to Seattle next week. So there is a lot going on in my life right now.
[00:01:56] Michael Chan: Yeah. How long have you been in Chicago?
[00:01:58] Becca Bailey: Forever, basically. I was born here. And um have went away for a bit to go to college and came back. Besides for a brief stint living in Central America, um have pretty much been here ever since.
[00:02:12] Michael Chan: Wow, that's wild. So, um that's gonna be a pretty big cultural shift, I imagine. Like moving from being in Chicago long-term to moving to San Francisco. Seattle.
[00:02:25] Becca Bailey: It would be if I were moving to San Francisco. I think that would be an even bigger one. But yeah, a little bit. Um, you know, I think it helps. I have some family there. My husband is from Seattle, so like at least half of us have actually lived there before. And yeah, I think that there are some culture shifts that'll be different and then some that are actually a little better. Than Chicago, honestly. So there will be-
[00:02:53] Michael Chan: Yeah.
[00:02:54] Becca Bailey: So I'm not quite sure what to expect at this point, whether I will like fully experience the Seattle freeze, the um the thing that they talk about where people are friendly but don't want to actually like let you be their friend. So-
[00:03:11] Michael Chan: Oh yeah, yeah, yeah, yeah. Well, yeah, I'm sure that it'll be um interesting. That's one thing that's super fascinating, I think, about work these days, especially tech work, where you can kind of have this like middle ground where, you know, you live in live in the place you live, but then you kind of like get acclimated like slowly to another like, you know, culture by working with a bunch of people who live in that city.
[00:03:37] Becca Bailey: Yeah. And I feel like that's where I've been at for the last, I mean, last few months, especially since I've been working at Formidable. But even the last couple of years going you know, my husband and I have been going back and forth on a regular basis and spending more time with some of his older friends and his family. And um so honestly, at this point, I kind of feel like I've been spending enough time there that it doesn't feel like a huge jump.
[00:04:02] Michael Chan: Yeah, that's awesome. So you seem pretty busy. You have you're working, you're you're on this podcast with me right now. You've been speaking significantly more. Are you- are you- how are you feeling about all this? I mean, it's kind of like a pretty rapid, uh, I guess, like rise into kind of being involved in the React community. How has that been over the last year?
[00:04:26] Becca Bailey: Yeah. I mean, it's been an interesting ride, honestly. Um, I was really happy to be involved in React Conf. But that was kind of a pretty big surprise for me as someone who had spoken at like maybe 2 or 3 more more local conferences before that point.
[00:04:46] Michael Chan: Sure.
[00:04:47] Becca Bailey: And there was also this really interesting job transition that was happening this year where I went to work at a startup and then left that startup very quickly. And so there was like this whole like, I got a lot of affirmation from the community about what I'm doing and what I'm talking about and what I'm really into. And then at the same time, I got kind of a like a hard reality check about getting that from people who I work with.
[00:05:12] Michael Chan: Sure.
[00:05:13] Becca Bailey: So it was this very interesting experience where, yeah, I had- I was kind of living in both worlds where I really had to struggle to have people like take me seriously as an engineer and-
[00:05:26] Michael Chan: Interesting.
[00:05:27] Becca Bailey: —really listen to my ideas. And then at the same time, the React team was literally asking me to talk about my ideas, you know, in front of the entire community, basically. So-
[00:05:38] Michael Chan: That's so fascinating. That's something I I don't think we've ever talked about on this show, but that is a real- that is a real thing. Like, it's so weird because I think once you're on a stage, right, or whatever, like when people are like hearing your voice, it feels very authoritarian, I guess. Yeah. Right? Or like And people perceive you from from that perspective as like an authority on, you know, whatever subject you're talking about. And like kind of more broadly, an authority in React or whatever ecosystem you're part of. But that doesn't that doesn't automatically translate to workplace accolade or respect. If anything, I feel like almost like the opposite. Like the more that I've like done in the community, like the harder I have to like work against like some type of like, you know, reputation at work. Um, how have you like, how have you navigated that besides just being like, do you know who I am in Slack and just kind of like flipping tables?
[00:06:46] Becca Bailey: Yeah, I definitely feel the need to like kind of passive-aggressively share some of my recent accomplishments with the people who I've worked with earlier this year. Yeah. Um, I mean, that can be really hard. You know, I as I was, I went through like 2 job searches this year and I was kind of surprised by the fact that like even putting like pretty major conference talks on my resume, people were like, but do you really know about that thing?
[00:07:11] Michael Chan: Sure. Yeah.
[00:07:12] Becca Bailey: Or, you know, I'm sure you know about that thing, but you haven't worked in our system.
[00:07:17] Michael Chan: Yeah.
[00:07:17] Becca Bailey: So I think there is a lot of disconnect there. And I think there's also kind of this broader conversation we're having As a community where we're asking, like, are people in developer relations actually engineers? You know, where that kind of public persona might actually be helpful in some contexts and in some workplaces.
[00:07:40] Michael Chan: Yeah.
[00:07:41] Becca Bailey: But in other- but at other times, it might actually work against you.
[00:07:45] Michael Chan: Yeah, yeah.
[00:07:46] Becca Bailey: Depending on the type of people who you're working with and how much they value that community involvement. And to be honest, like, I will be the first one to admit that giving a conference talk about state management or refactoring doesn't necessarily make me an expert. It's usually the opposite. It's usually something that I've really wanted to learn more about as somebody who's kind of coming from a- like a- I'm pretty solidly mid-level in my career right now. So. I'm trying to gain those skills at the same time as you are. So, I think that there are some people who, especially after my React Conf talk, were like, oh, I I disagree with everything you said. And I'm like, that's cool. I I probably won't agree with everything I said in a year.
[00:08:36] Michael Chan: Totally. You know, that's really interesting. I think from from that perspective, too, of I think that we forget sometimes that when we go to conferences, the people on stage are just sharing their experiences, right? And it's not a- like, not an authority. It's just like, we're sharing the things that we know, and that helps us. The more things that people share, the easier it is for people to kind of see a bunch of like diverse opinions and perspectives and kind of like incorporate that into their own thinking. It's not like, hey, that person on the stage said that, you know, this is how they do it, and now I should be doing that because, you know, they said it from a stage. And um I think it's interesting what you said. The- that so many times, like, when we're giving a talk on something, it's something that we want to research, right? Like it's like the product of like an interest as opposed to, you know, maybe like decades of knowledge on a subject. So, that brings us to kind of your your talk this year, which is focused on refactoring. And I'm super excited about this because I think that with all the changes in React, Uh, this is gonna be such a huge conversation over the next couple years. So, tell us a little bit about kind of why this is catching your interest right now.
[00:09:53] Becca Bailey: Yeah. So, as we are um working in a very changing ecosystem, React is getting new features every year. We are adding hooks. We are hopefully at some point going to be adding Suspense into our workflows. Um. We have new ways of being able to test these things and prototype. I think that there's a conversation that needs to be had about how do we change our code and how do we do it well? Because I think sometimes there's this tendency to just rush into the next thing. To be like- Yeah. Hooks are awesome. I'm gonna change all of my function- all of my components to functional components now so that I can use hooks. And that's really great. But if we don't change some of the underlying issues that are- that's making it harder for our teams to work on this quickly and effectively, you know, that's not gonna be serving us in the long term.
[00:10:51] Michael Chan: Yeah, that's interesting. It seems like there's a lot of- I don't know. I can't get Basecamp's verbiage out of my head. But there's like a heavy appetite for like wanting to change stuff. But Sometimes we can get ourselves into trouble if we don't have some of the surrounding things in place. Um, and and a lot of those things are very like human-centric, things that we need to like figure out as a team and whatnot to be able to move our apps forward well. Um, before we get too far into like kind of the the specifics of all that, um, let's cover like what is refactoring. For like anyone who's like kind of maybe never heard this term or they've heard this term and they've always thought in the back of their head, like, what the hell is that? Like, what is refactoring?
[00:11:42] Becca Bailey: Yeah. It helps- when I'm explaining this, it helps me to talk about, like, what are the situations where I would need to refactor. And I'm not- and I will get more into that later. But, like, I had a personal experience, like, a few weeks ago where I needed to add one thing to a dropdown menu. Like really simple ticket. It should have taken me 10 minutes. But I went into that component and discovered I had like 7 nested conditionals that were like leading up to that one component that I needed to change. And I and like that was the moment where I was like, shoot, I really need to refactor this. And if you aren't familiar with refactoring, like refactoring is a pretty old term. It's been in use for probably, I don't know, 30 years in the tech community when we talk about like factoring things again. And by factoring, that means that we are making decisions about how our code is designed. And there's been a really huge um push as we're making those decisions um to make the- to do things that humans can understand.
[00:12:51] Michael Chan: Gotcha.
[00:12:52] Becca Bailey: You know, I really- I've been reading Refactoring, the book by Martin Fowler. And I really like a lot of the things that he says about variable naming, things like smaller functions that people can read. Because when we are refactoring, we want to make sure that we're making changes that don't actually change the functionality of our application, but that make it easier to use and read and reason about as a human, you know.
[00:13:23] Michael Chan: Interesting. So, so, like putting it into into practice like like like you did, You come to a piece of code, you have something that you need to add, but it's exceedingly difficult because of the decisions that were made before. And like no fault to the decision decision makers because you know they were dealing with the the best that they could at the time.
[00:13:42] Becca Bailey: Yep. Honestly, it was probably me.
[00:13:44] Michael Chan: It always is, right? You get blamed like, who was this idiot? Oh, it was me 6 months ago. Yep, it was me. And so so now that you have new information, you need to kind of like restructure what was there to make the new changes easy? Is that kind of like a- because because it can be kind of confusing, you know, because you come to it with a problem, but then also you mentioned like not changing any of the functionality in your refactoring. So, are these like two different phases then?
[00:14:16] Becca Bailey: Yeah. I mean, I think that there are different phases for like, for example, if your application doesn't have a lot of test coverage, if you don't have like an automated way of knowing, like, if I change this thing, then it will- then this functionality will stay the same. Like I would consider that a phase in my refactoring is just going into the component that I'm changing and like adding a layer of test coverage around that. And then challenging myself to test it in a way that I'm- where I'm able to test the behavior and not the implementation.
[00:14:55] Michael Chan: Okay.
[00:14:56] Becca Bailey: You know, like This is something that Kent C. Dodds talks a lot about in his Testing React course. Is ways that we can test behavior of a component in a way that allows us to change it.
[00:15:09] Michael Chan: Interesting. So, it sounds like there's a pretty big- I guess it seems like there's a relationship then there between tests and the code that you want to refactor. Um, so, it sounds like it wouldn't really be advisable to ha- like refactor code that doesn't have tests around it?
[00:15:29] Becca Bailey: In most cases, no. I mean, it it's up to you. You're a free agent. You can live on the wild side if you want to. Um, and with small components, especially if we have like Storybook or a tool that allows us to easily like manually test things, go for it. That's it.
[00:15:49] Michael Chan: Sure.
[00:15:50] Becca Bailey: Um, it's your call. But my preferred workflow is to have some tests so that I know that I'm not changing anything. And the next person who's who's working on this, who might who may or may not be me, also knows a little bit about what their code is supposed to be doing.
[00:16:09] Michael Chan: Yeah. So, when when talking about React and refactoring and tests, what is kind of the right level maybe to be testing these React components? Um. Because you did mention that a little bit, how like sometimes certain levels of testing uh can make a component extremely difficult to change.
[00:16:29] Becca Bailey: Yeah. Um, I've seen a lot of cases where we have like these really great unit tests. And we have 100% test coverage. And it looks really good. But then we are testing things like the name of the state variable. Or, um, you know, the really specific helper function that that we are putting in our components in order to like sort our API results. Something like that where if I change the name of that function or if I change the state variable or if I refactor to a functional component from a class component, like, I I, you know, those tests don't serve me anymore. And they're all gonna break.
[00:17:18] Michael Chan: Yeah. And now you're just like rewriting tests that test stuff that really doesn't matter in terms of like actually consuming that component.
[00:17:26] Becca Bailey: Yeah, exactly. Um, and I don't know about your projects. I don't know about anybody else's projects. But like that's not something that I usually have time to do. Or-
[00:17:36] Michael Chan: Yeah.
[00:17:37] Becca Bailey: Or like just- the resources to rewrite all of my tests every time I make a change.
[00:17:44] Michael Chan: Yeah, I think that's I I think that's interesting. And I think that, you know, as as you work in projects that have different classifications of tests, uh it does become clear really quickly like what tests just feel like at the wrong level. And I have noticed that a lot in React code, especially like kind of like early days React code. There was a compulsion to test, right? Because it's like that's what you're supposed to do. But maybe the tools didn't really like exist yet to do that at a level that was testing the interactivity of the component or like the display of the component. And so, then every time you changed anything like a prop name or uh you know the the way that the text displayed, it's like now you have like breaking tests, which is really frustrating as you know maybe a designer who's like coming into that library just to kind of change the presentation of something. And um to have these tests break and it's like now like okay, well, I got to fix these things which are like all just implementation details.
[00:18:42] Becca Bailey: Yeah, exactly. You know, if your tests are breaking because you changed the text, uh, you know, you changed the subtext or something, that's probably not a great place to be.
[00:18:52] Michael Chan: So, it sounds like in refactoring, having a test that is kind of like at the edges of your component allows you to to do a little bit more, uh I guess, like internal work without actually like having to change the tests.
[00:19:08] Becca Bailey: Yeah. Um and that's usually like an integration-level test. Um for example, if I were testing a form input, I might write tests that kind that um without actually rendering my code in the browser, like uh end-to-end test. Um a test that uses a test renderer to actually fill in the form the fields on the form and press the submit button and then tells me what I what what function I'm calling with that result. So, that's just an example of kind of a higher-level integration test that's gonna be very helpful when we're specifically talking about testing these React components.
[00:19:48] Michael Chan: Nice. Do you have uh preferred tools for doing that level of testing?
[00:19:54] Becca Bailey: Yeah. I mean, recently I've been using React Testing Library.
[00:19:58] Michael Chan: Mm-hmm.
[00:19:59] Becca Bailey: Which is a tool that was basically designed for this purpose. Um, before React Testing Library, we had tools like Enzyme, which is another test renderer, which is a very, very powerful tool, but it gives us a lot of um like hooks into the inner workings of our code that are not always encouraging the best testing practices. And so, I think that tools like Enzyme can also- I've also used it to do this exact thing. But you just have to have more conversations with your team about exactly which- the way that we're using it.
[00:20:36] Michael Chan: Yeah, yeah, absolutely.
[00:20:38] Becca Bailey: And I think there's a few tools like that. Like snapshot testing is a great tool for having some idea about what your component is actually rendering. But if we use it too much, if we over-rely on it, then it actually encourages bad practices.
[00:20:55] Michael Chan: Yeah, you get kind of into that same pattern of like every time you update the code, you also have to update the tests.
[00:21:01] Becca Bailey: Yep. And after you do that so many times, you and the rest of your team just gets used to being like, update, update. You know, you just you do it every time and you don't even read through the diff or think about what you're changing.
[00:21:13] Michael Chan: Yeah, you get kind of— it it kind of creates this numbness to the idea of the the output changing at all.
[00:21:20] Becca Bailey: Mm-hmm. So, I- in my experience, if we are not very careful and like conservative with our amount of snapshot testing, we tend to create this snapshot overload that um allows us to miss a lot of things that are changing in our rendered components.
[00:21:37] Michael Chan: Interesting. Interesting. So, with all the things that are changing in React, um, you know, we've you know, we've seen kind of over the last you know couple years, we've seen kind of a big transition to hooks, which kind of replaces largely A lot of stuff we were doing with higher-order components and render props. Um and then we see this move kind of slowly to Suspense and how we're dealing with asynchronous data. What are some of the, I guess, smells that you look for when you're thinking like, hey, this this component actually is in need of some type of rethinking or refactoring?
[00:22:12] Becca Bailey: Yeah. I think the things that I tend to look for, even more than things like is this a functional or a class component or Am I using the latest technology? Am I using context rather than Redux? Like, the things that I look for before I even get to that level are things like um nested conditional logic. Um if I have a lot of conditionals inside a component, then that might mean that I need to have just separate components. You know, if I'm just trying to do too many things in one place, that probably is a sign that I need to separate my responsibilities and have a and make it a little bit more clear and maybe introduce a little bit more duplication in the process, but make it more readable. Other things I tend to look for are um components that are too tightly coupled to an API. Like, I have definitely experienced this where we are using an API. It could be a GraphQL API, it could be a REST API. But the data that I'm getting back is not super ideal. It might be inconsistently formatted. It might be, um, you know, I might have some um weird nesting or like I might need to nest it in a different way. But something that I see a lot is like you make an API request in your component and then you just take everything, just take the entire data structure and just like stick it in the child components. And and then we have like these just layers and layers of like child components that have this kind of weirdly formatted data that they're working with.
[00:23:55] Michael Chan: Yeah.
[00:23:55] Becca Bailey: And it can be really hard to know what actually is going into those components. Especially if we don't really have types or prop types that are showing us what types are going in, you know. If my prop type is like data object. That's not very helpful to me as a developer trying to use that component. So, that to me is a code smell that I've been seeing a lot is just like this kind of, you know, without introducing a layer in between my API response and my components to kind of to make my props prettier. To actually think about what objects they are and what the and the data that they're representing.
[00:24:40] Michael Chan: Yep.
[00:24:40] Becca Bailey: That can make it much harder to know how to use my other components.
[00:24:46] Michael Chan: Yeah, yeah, absolutely. It is a really interesting, I guess, like case of design, right? Where, you know, the GraphQL layer, the API layer is usually that kind of like a shared territory. And so, you kind of have to make some concessions there that might not be ideal for your components. Right? And so, so taking a minute to like actually like think about the the component in isolation and being able to kind of like separate it from that data and do it in such a way that now that is actually reusable, kind of like separated from the data structure, is is like a really important, I guess, part of making components truly reusable.
[00:25:27] Becca Bailey: Yeah, definitely. I mean, I tend to talk about my components as like perfect world components. Like in a perfect world, this is how I would structure my props. This is how I would like have have types. This is how I would make this so that it's readable. And then even if the API, if if like the pipeline that's coming into my components is managed by another team, or in my case as a consultant, often it's somebody who just who works at a completely different company who's managing this data and then just kind of sending it to me.
[00:26:00] Michael Chan: Yeah.
[00:26:01] Becca Bailey: Um, I don't have to I don't have to make all the same choices that they're making.
[00:26:06] Michael Chan: Yeah, yeah, yeah. I imagine as as a consultant, you see a see this a lot, right? Like you see kind of like different patterns, especially in mature apps. It's like, you know, you're gonna see like all matter of patterns, if not like all manner of of different frameworks like trying to be used together in in that. Um, which I've always liked about consulting. It kind of gives you a a A vantage point to see like a bunch of different apps kind of running into the same same issues. Do you feel like, you know, with all of the hype around doing the, I guess, like fun refactorings, like changing something from like a class to like a a function component, um, is there a level of restraint that you need to like have when thinking about refactorings? Because there's so many things where it's like, oh, I want to rewrite everything in in in hooks, right? That sounds fun to do. But then there's a lot of things that aren't so much fun. Like like what you mentioned of like just decoupling a component from the data structure. That's not like- you don't get that kind of like endorphin rush of like, you know, you know, all of the- using all of the coolest stuff in that case. What are some metrics that you use to kind of like decide, you know what, this is actually a good time to refactor this component versus like we don't actually need to, like this is working code, like let's just leave it alone.
[00:27:25] Becca Bailey: Yeah, I mean, that's a really good question and that's something that I run into a lot. Is like, when is the right time to refactor? And I would argue that the first thing I refactor are some of the things that I was talking about, like API coupling, um, conditional logic, things that actually make the code harder to read and harder to change. Because once I do that, then it's It's like a 10-second change to change my code from a component to a function or a class to a function. Um, because I already have a lot of the other stuff cleaned up. So, my first priority is always those things that make your code harder to read and harder to change. Um, and then like refactoring to hooks is kind of a bonus. And it's something that I honestly in a mature codebase, it wouldn't be my top priority.
[00:28:21] Michael Chan: Sure.
[00:28:21] Becca Bailey: What I would probably want to do in that case is if we are going to establish a new pattern and write new components using function- using functions, I would make sure I document that, communicate it with my team, maybe add it to our style guide if we have one. And then the next time I actually have to significantly change another component, that's the time when I might refactor it. But I wouldn't necessarily just dive right in the day after React Conf and be like, I'm gonna change everything today. I think there are ways to do that in a way that's thoughtful and respectful of all of our time.
[00:29:03] Michael Chan: Yeah, yeah. And I think that you you had mentioned this, which I think is such a good a good way to think about when to refactor. From the very beginning of this conversation, you said like you like to think about it from like from feature requests, right? Like you go into this code and with an intent to change it to add some type of feature. And then from there, you kind of evaluate, like, does this code actually support this change? And if not, then making the decision to refactor. And even then, I think it- I think it might actually be in that book that you mentioned, the Martin Fowler book.
[00:29:35] Becca Bailey: Yep. That's an idea that comes straight from Martin Fowler. That idea of refactoring as you change your code.
[00:29:41] Michael Chan: Yeah, yeah, yeah, yeah.
[00:29:42] Becca Bailey: And considering refactoring just a part of your development workflow when you're making estimates and when you are deciding how to change your code.
[00:29:50] Michael Chan: Yeah. And I I think if I remember correctly, there's a there's this concept in there. It's like, um make make the change easy and then make the easy change.
[00:29:59] Becca Bailey: Yes.
[00:30:00] Michael Chan: Which I which I love. And I think I think it goes to like exactly what you're saying is like, you know, so so many times you'll find that like once you fully understand the problem, and you make the the code work for that, then like all the other stuff is like easy. It's like like cosmetic.
[00:30:15] Becca Bailey: Yeah, that's that's the idea. And of course, we don't always live in this perfect world. And it could be hard to know like if the thing that's easy for us to understand is easy for someone else to understand. Um, I think that's why code reviews are so important. Because if you're because if you're refactoring is something that makes your teammate go, what is going on here? Then that might be a signal that this design pattern that you are really familiar with might not be something that everyone else knows intimately as well.
[00:30:43] Michael Chan: Yeah, absolutely.
[00:30:45] Becca Bailey: But yeah, in a perfect world, we do want to break our components down. We want to rename things. We want to make our- we want to structure them in a way that is easier to understand.
[00:31:00] Michael Chan: Yeah. Now, you you've mentioned this a lot. And I I really like this idea. But the idea of of building a codebase up around humans. And I think that- I know for me, like when I was getting into programming, there were a lot of people on the forefront of of exploring like what it actually meant to program as like a community of people and not just me kind of enforcing my values on the code. And I've I've been really impressed, you know, with With people coming up into programming now, it seems like there's a- I guess like a better mindset around like, hey, we're doing this as a team. And I really like that about your your approach, your thinking, the way that you're talking about all this stuff. Um, how do you experience that? Like what are some of the things that you feel when you are working with a team and want to collaborate in in this way? How does refactoring play into that? I know it's a big question. So, we can kind of like tease it out. But like what are your feelings on that? As um as you work in codebases and work um as a consultant to other teams?
[00:32:07] Becca Bailey: Yeah. Um that is a big question. So, I'm gonna try to break it down a little bit. But first of all, something that I try to communicate a lot is our code is a user interface the same way that our browser window is a user interface. Um except we as developers are the users rather than people on who are interacting with the screen. And we talk a lot about accessibility for users.
[00:32:38] Michael Chan: Mm-hmm.
[00:32:39] Becca Bailey: But we also want to care about accessibility for developers as well. How do we as developers build things that are accessible for the junior developer on your team who's just learning this for the first time? Or how do we build things that are accessible For, you know, the person who is learning a new language or the person who is coming to this codebase for the first time. And those are things that we need to be thinking about. And I think there's been a really great conversation as a community recently about like the 10x developer, the person who can just kind of knock it all out themselves. And you know, code all night. And I think that that's not a reality that most of us are living with right now. And personally, my interest in this kind of team dynamics and talking about our developers as users of this code comes, first of all, from some of the things that I have learned as a new developer. Um, that was a huge emphasis when I went to Dev Bootcamp, which was really important for me. And at my first job, that was something that we talked about a lot, was how to write good code that other people actually understand. And I'm really grateful for having those experiences. But then I've also had some experiences where I'm like, oh yeah, that's why it's important. I've been on teams where The power dynamics are just way off. And as a new member of the team who's like, wait, this codebase- you know, this code that you're pushing to the codebase is actually not easy for me to understand. That sometimes has been dismissed as like, oh, whatever, you know, what do you know? And I've experienced the way that I feel. I've seen the way that other people feel on a team where that just isn't happening. So, one of my goals as an engineer is to engineer for humans and for teams and to do it in ways that make us all feel like we are contributing to something that we that we are a part of equally.
[00:35:01] Michael Chan: I love that. I think that so many times we want to try to avoid the conversation. And we do that through like- I don't know. I've seen it happen a lot through like ESLint, right? You just like throw in a bunch of rules and it's like, okay, just like just do this and uh you know and then then you'll be fine. But there is something that we miss so often in that in that conversation, right? And so many times code is an on-ramp to that conversation. And I love the way that you put it. Like the the the idea of code as a as a user user interface. And is this user interface, is it accessible? Is does it kind of walk someone up to a concept like gently in a way that they can understand it, even though it might be kind of like, I don't know, using my finger quotes right now, like not ideal. Uh like how not ideal is it if it's also like kind of like affording the people, like the group of programmers to be able to like understand it or walk into it a little bit easier. I I love Love, love, love that idea. Do you have any, um, I guess, like resources or experiences that you have found helpful in kind of building that conversation vein up in your teams and communities?
[00:36:16] Becca Bailey: Yeah, I'm trying to think. I mean, most of what I've learned about this has been through experiences. It's been through conversations with people. There have been some really great talks. about um power dynamics on teams and um pairing, such as "The Power in Agile" by Sarah May. Um I loved that talk, and I recommend that everybody watches it whenever I join a new team, because I think that a lot of her ideas about the ways that power dynamics plays into our teamwork is really important. You know, if I'm working with you and you're a man and I'm a woman, or if you're Black and I'm white, or if you're a senior and I'm a junior, like those things matter.
[00:37:06] Michael Chan: Yeah.
[00:37:08] Becca Bailey: And they actually do change the way that we sometimes interact with each other and interact with our code. As a consultant, like the very first lesson that that I learned was most of the time when we think we have a technical problem, We actually have a team problem. So most of what I have learned about that has just come from experience and having conversations with people. Um, it also helps that my husband is a software engineer, so we just like come home and talk about all of our team dynamics all day. So we- so I get a little bit of insight that way in terms of like his experience leading teams and my experience being on them and you know, my experience mentoring. It's just a combination of a lot of things.
[00:37:59] Michael Chan: Yeah. Well, I think that's a great start. I I have not seen that talk by Sarah May, but it she's a hero of mine and I would love to uh check that out. So, we'll link that in the show notes for sure. So, you have this you have this talk coming up at Reactathon. You're gonna be talking about refactoring. Uh what are you most excited about for that event? It's such a you know, unique event. What are you excited to kind of explore while you're while you're there in San Francisco?
[00:38:25] Becca Bailey: Let's see. It's my first time at Reactathon. But I'm really excited about the idea of having topic tables and being able to like have structured ways of talking to other people about this stuff that I'm really interested in. You know, as a person who sometimes struggles with social interactions, it's really nice to have structured social interactions. And that's actually kind of what got me started on conference speaking because I realized that if I go to a conference as a speaker, people will come up and talk to me about my talk and I don't have to go to them. So, um, so I really-
[00:38:59] Michael Chan: That is the dirty little secret, isn't it?
[00:39:01] Becca Bailey: It is.
[00:39:01] Michael Chan: I feel exactly the same way.
[00:39:03] Becca Bailey: It is. It's like the introvert's trick. Like, if I am standing up in front of people and talking to everyone at once, then I have a starting point for all of these other conversations that people are gonna want to have with me. So-
[00:39:18] Michael Chan: Yeah. So, so what is your topic table on at Reactathon?
[00:39:22] Becca Bailey: Um, I do not know. I don't have one yet. I just want to go talk to other people about theirs.
[00:39:27] Michael Chan: Awesome, awesome.
[00:39:29] Becca Bailey: As far as I know.
[00:39:31] Michael Chan: Cool. Well, this has been a pleasure. It's been a pleasure to meet you. Thank you so much for kind of talking with us about refactoring and kind of the human parts of, you know, creating a codebase that works for everybody. If people want to find out more about you and kind of hear your thoughts as you continue to develop this talk and um kind of guides for refactoring, how can they follow you?
[00:39:55] Becca Bailey: Um I am pretty active on Twitter. So, if you are into Twitter, you can follow me there. And we'll link to my profile in the show notes. And I am also starting a blogging project about refactoring that will be on my personal website. Um I have one post up so far that talks more about some of the API decoupling. And there will be more coming.
[00:40:17] Michael Chan: Awesome, awesome. And where can people find that?
[00:40:20] Becca Bailey: That is on my personal website, becca.is.
[00:40:23] Michael Chan: Awesome. That's a great domain.
[00:40:25] Becca Bailey: It is. It's a great domain. And I also cross-post on dev.to.
[00:40:30] Michael Chan: Killer. Well, I think this is gonna be an amazing, amazing topic over the next couple years. I'm so excited to see how you flesh this out. You are a really great teacher. And I think that anyone who's interested in kind of like modifying in-place codebase over the next like year or so that's into React, um should definitely uh follow you on all that.
[00:40:52] Becca Bailey: Thank you so much, Michael.
[00:40:53] Michael Chan: Thanks for being on the show. Uh and I look forward to seeing you at Reactathon.
[00:40:58] Becca Bailey: All right. See you then.
[00:40:59] Michael Chan: For links and show notes, visit reactpodcast.com/82. This episode This episode of React Podcast was edited by Mikael Delport. It was produced by Mikael Delport and Sarah Jackson. You can find React Podcast on Speck, a network to help designers and developers level up. Visit speck.fm to find other shows that will take you further in your career. Help us out by reviewing this show on iTunes. Your reviews help the show grow and help us ensure great guests and awesome content week to week. To join the discussion, visit reactpodcast.com/chat or follow us on Twitter @reactpodcast. I'm @chantastic. To stay out of the discussion but get updates, visit reactpodcast.com/news and sign up for emails. Thanks so much for giving us your attention. We'll be in your ears again next week.
chantastic.fm