The Elixir Outlaws now have a Patreon. If you’re enjoying the show then please consider throwing a few bucks our way to help us pay for the costs for the show.
Episode Transcript
Amos: Welcome to Elixir Outlaws the hallway track of the Elixir community.
Chris: Hello!
Amos: Uh, how's your day going? I hear kids in the background. That's awesome.
Chris: Yep. They're fighting.
Amos: It's what brothers and sisters do. That's what I hear. I didn't know that growing up, but my wife told me that this is normal.
Chris: This is, this is fine. Yeah. Everything about this is fine. Closing this tab almost there- I am so- I'm out of sorts. I'm all out of sorts today.
Amos: I closed everything so that I just see your face. I can't do anything else. I full screen you.
Chris: Wow, man.
Amos: Yeah. Putting my hands on my knees and staying focused. That's the goal of today. Stay focused.
Chris: Staying focused.
Amos: Stay focused.
Chris: It's a good goal. That's a good goal.
Amos: San Diego?
Chris: I'm proud of you. That's a good goal.
Amos: Uh, well I was, I was reading the other day, an article that a friend sent me. I wish I had the paper in front of me, cause I would tell you what the article was, but they were talking about research that was done, that 40% of the things that you do during your day are all about hab-
Chris: Useless.
Amos: No, they're all about habits. 40% of your day is spent solely on whatever you're habits are. So, change, you make good habits and you change a lot of your day. So that's my goal. And -
Chris: That's, that's good. That is um, uh, that's a, that's an interesting philosophy. Uh, it, it reminds me of you remember the movie, A Beautiful Mind?
Amos: That -yes.
Chris: With, uh, uh, Russell, Russell Crowe?
Amos: Yes.
Chris: The Gladiator dude.
Amos: Yeah, I think it's Russell Crowe.
Chris: Anyway, do you remember how the solution at the end of the movie was, um, just don't be crazy.
Amos: Yep.
Chris: That's uh, that's, that's the same sort of philosophy that you're talking about.
Amos: Yeah. You know, you know how to take care of schizophrenia?
Chris: If you want to be more productive, yeah just don't be crazy.
Amos: Just don't have schizophrenia.
Chris: I was so mad at that movie, even when it came out, because basically the answer is like, oh, well, if you have a problem, just choose not to have the problem anymore. It's like, that's not how that works. I am fairly certain that is not how that works. Wait a minute.
Amos: I think in some ways it can though, like in this being productive thing and focusing, changing your habits.
Chris: Yeah. If you want to be productive, you should just be productive.
Amos: (laughing) Just be productive.
Chris: Like if you want to be productive the fastest way between here and being productive is being productive.
Amos: That's right. Done.
Chris: That's uh, that's my take on it.
Amos: So I do need to start out today and say, I think most people know that my, my oldest son did our music, but today is, is special today. He turns 14. So I just want to say happy birthday to, to our, uh, composer. Royalty free composer. I don't pay him anything. He asked me for royalties. I told him that he gets room and board, so.
Chris: And we don't even get paid to be here. You know what, we should, we should actually start, uh, I feel like we should probably start doing ads on the show. Right. You know, we can sell you some sort of trunk of clothes for men or, uh, some sort of a, bed in a box type situation
Amos: That, that works for me.
Chris: Do you find yourself tossing and turning all night due to the lack of any sort of direction in Elixir and the Phoenix project? Well, have we got a solution for you. Use Casper mattresses will alleviate all of your abilities to worry about the complete directionless goals of anyone who's working on Phoenix.
Amos: I, okay. So, I'm-
Chris: Do you find yourself frustrated trying to configure Ecto?
Amos: I'm laughing even more that as soon as you said bed in a box, the first thing that my mind went to is Casper. So they've obviously won that market.
Chris: Are your underwear all on a twist because you're worried about how hard it is to configure Ecto? Well try me undies.
Amos: You should give to our Patreon. It'll just make you feel better. No, really. If you're enjoying Chris and I laughing at each other and stuff like that. And Anna, whenever, whenever she's not traveling the world because she has an awesome life. Uh, and we just sit at home with our children. That's it . Don't have children and give to our Patreon. Oh man.
Chris: Oh, don't do that because I'm going to, I'm going to feel so obligated to keep the show going.
Amos: Uh, uh, if you get,
Chris: You're trying to golden handcuff me into this.
Amos: I am I am.
Chris: You can't keep me down.
Amos: I'm trying to-T we have to, we have to get enough money-
Chris: I'm a bird. You gotta let me fly.
Amos: We have to get enough money in our Patreon account to make Chris want to stay.
Chris: I'm a peacock. Let me fly.
Amos: Oh man.
Chris: Oh my gosh.
Amos: So I'm excited and a little sad about Lone Star.
Chris: Little sad? Why are you sad?
Amos: Cause um, I don't know if you're coming or not.
Chris: Oh Yeah. Um, I'm pretty sure I'm coming. I got to get all my travel squared away.
Amos: Yay!
Chris: I'll be there. I'm pretty sure I'll be there, the odds are looking. The odds are ever in my favor. Yeah.
Amos: Alright. If they're, if they're not in your favor, if people give enough money to our Patreon-
Chris: We're not gonna pull money of the Patreon to do this.
Amos: I know. I’m just kidding. So I do want to tell that the things that we've spent money on from our Patreon was like stickers. And if any of you have-
Chris: Lapel pins.
Amos: Lapel pins. Yeah. We gave out some pins to people. So, um, we, we spend it on, on schwag and I think, did we buy one microphone? Something like, that.
Chris: Are we having a pledge drive, like what's going on , like?
Amos: I feel like if - (in announcer voice) We're on NPR where we don't do anything except for talk about how you need to give us money.
Chris: Hi. I'm Chris Outlaw. I'm here to tell you a little bit about the Elixir Outlaws. If you're enjoying all of these great shows here available on Outlaw on Outlaw, uh, network, you can, uh, just donate a quick $5. Our operators are standing by to take your donations
Amos: Or just show up at Lone Star.
Chris: You can donate to all the great shows.
Amos: Show up at Lone Star.
Chris: Elixir Outlaws. You got Rust Rebels.
Amos: Is there a Rust Rebels show?
Chris: Oh, probably.
Amos: They're missing out if they're not.
Chris: I really feel like it was a missed opportunity, not finding something. I mean, it's a slant rhyme, right? Elixir Outlaws.
Amos: Right.
Chris: It feels good. Is that iambic? Is that iambic?
Amos: I have no idea.
Chris: Stress unstressed stress is iambic?
Amos: I don't know. It's definitely, it's definitely not a mirror rhyme.
Chris: E-lix-ir-Out-Laws. II think it is. But it, so it rolls off the tongue well, but I do think we missed the opportunity for some alliteration.
Amos: That's true.
Chris: I loves me some alliteration.
Amos: I don't, I don't. I'm trying to think of what we would use. Elixir Eugenics?
Chris: No, absolutely not. Elixir, uh, Elixir Ewoks.
Amos: Oh perfect! No, wait, don't say that.
Chris: Nailed it!
Amos: Take that back. Take that back. We're going to get sued by Disney.
Chris: Oh! This is, us,, this is this falls into under fair use.
Amos: Well, here's, here's how you get Disney off your back when you talk about Star Wars. Or anybody.
Chris: Elixir Emperor Palpatine and his daughter,
Amos: We just start talking about the Christmas special. The Star Wars, Christmas Special. And if you've never seen this, it's got Betty White. It's on YouTube. Go find it.
Chris: If you, I mean, yeah. It's, I mean, I think it's, I think it's well, it's like asking if people have watched Troll 2. Like, of course you've or like there's this great movie it's called Troll 2. It's the worst movie ever made. It's like, no, duh, everybody knows what Troll 2 is, k. You gotta dig a little deeper on your cultural touchstones here, if you want to try to, you're trying to flex on everybody about how, how many weird things that you know.
Amos: Oh, I'm not trying to do that with Star Wars. I know better. There's too many people in this community that know way more than I do, even though I really like it. Um, but I don't obsess over, over things like that. Um, I, I obsess over other stupid things. Um-
Chris: Yeah. I obsess over important things.
Amos: No, I said other stupid things, alright. To be clear. Oh man, I'm enjoying this. I don't know that I want to get-
Chris: Oh! We're coming in hot. This is good.
Amos: I don't know that I want to get into real show stuff, but I've been having a great time. I'm super excited about Lone Star and especially even more now that I know that you're showing up, I I'm excited to, to record with Elixir Wizards while we're there and to see Anna in person again, I love it when, when all three get to be together.
Chris: Elixir Wizards, I don't think I don't think- wiz-ard- is that also iambic?
Amos: e-lixir- wiz-ard-s. Maybe? I don't know. I think the s on the end kind of messes it up,
Chris: Right? Yeah. It doesn't, it feels as if, I don't remember all the words. Is it a trochee?
Amos: I don't know. I love the name though. I think it's a fantastic name. And I hear that they have, have a good surprise for our last, but unfortunately I'm not sure that, that we have the same level of surprise. I'll tell you about it off-air.
Chris: We don't have the same level of anything that they have on their show.
Amos: That's true. That's true.
Chris: Like production quality, uh, guests, topics. Preparation.
Amos: Just because we were guests on their show doesn't mean they have better guests than we do.
Chris: Well we just don't have guests, like that often.
Amos: That's true. Like very rarely.
Chris: No, sorry, I was not trying to denigrate the guests that we have had. It's just that they have them. It's like we don't have guests.
Amos: Fair, fair. They have guests all the time. I think they've had you, they're planning on having Anna.
Chris: So the problem is, we're not opposed to guests
Amos: But nobody has me. Probably because I don't do anything but this podcast. I'm trying to change that.
Chris: We're uh, you know, like we're not opposed to guests. This is more inside baseball on the, on the hos podcasts, on how the podcasts sausage gets made.
Amos: Right.
Chris: But we're not opposed to guests. It's just that having guests would require us to plan. And we are adverse to planning.
Amos: Look, if you want to be a guest, let us know. That's the quickest way to be one, cause we're probably not-
Chris: Just show up,
Amos: Probably not reaching out to you.
Chris: We'll give you the call. We'll give you the link to the call.
Chris: You just be here.
Amos: There's nothing that's scripted on the show. I think that's not obvious. So we just sit down and, and BS for a while.
Chris: What are you talking about? I, I, uh, I sit and take notes on this material. I workshop this material.
Amos: That's true. Chris plans his jokes out. Weeks in advance.
Chris: I'm developing a real tight five on our Casper mattress, directionless flight of Phoenix, bits, just a real tight five.
Amos: Oh man. Look at this. I try to say nice things about Lone Star and here we go back to complete jokes.
Chris: We should probably do an Elixir conf improv night.
Amos: Oh, sweet. Totally.
Chris: We can totally, uh, you know, develop all kinds of material.
Amos: We can let people get up right next to the waterfall. That's super loud. Um, we won't have microphones and nobody will hear it.
Chris: It's obviously a three drink. It's a, it's also a three drink minimum.
Amos: Yeah. Right. You don't even get to show up until you've had three drinks.
Chris: Exactly. That's what I'm saying.
Amos: Because before that, it won't be funny. Uh, so I, I really am trying to change, uh, a lot,
Chris: Of topics?
Amos: No, maybe, uh, trying to, to be more productive lately. So it's really helped me. So, uh, Connor Rigby came on with my, with the company. I might as well say it. I feel like I shouldn't cause self-advertising, but I'm going to say it. It's Binary Noggin, and one day a week we work on open source stuff or podcasts like we are now. And, um, so I've been, been pairing with him a lot. We, um, it keeps me, that helps me stay focused to working with people. Um, so we released a library for changing from YUV image format to JPEG format. Why YUV is, is used for video. Cause we need that. And then, uh, today we were working on mogrify to change, mogrify to be able to generate random images, um, so that we can use that for some property testing on our JPEG library. So yeah, it's, it's been a lot of fun to see like these little pieces come together. I also would like to make up a, we'll see, I gotta read about that today cause I've never done it.
Chris: That's cool.
Amos: And I've been reading distributed systems, papers that, again, that you sent me a long time ago, I started over on them, uh, and going back through them. So that's been pretty awesome too. I've been really, um, motivated lately. It makes me happy.
Chris: Nice! You feel like that motivation like comes in waves sort of, like where you go through periods of time where you feel way more motivated than you're doing like tons of stuff.
Amos: Oh yeah. Like day to day sometimes.
Chris: Right? Yeah. So yeah.
Amos: I will say that a lot of it seems to be how I start my day, if I start motivated and moving, um, and getting stuff done, it usually carries along all day. If the first thing I have in the day is some kind of frustration or slow down then it's, that seems to carry all day no- even if I switch tasks. So that's one of the things that I've been doing is something that I can just know that I'll be able to accomplish do that first, very first thing. Uh, even if it's like grab one of those white papers and make one of the passes at it, like reading the conclusion in the intro, like that first pass or reading the whole thing, just to like something simple that I can feel good. Like, Hey, I've, I've made some progress and then move on to the next thing.
Chris: Sure. Yeah. I think that's, I think that's hard. I think the sort of maintaining, uh, a certain level of like motivation, I think that can be challenging. And it's I think often what I see people do is they treat it almost like a, uh, they treat it almost like a, like a sprint, right. They're sort of like, oh, I have motivation today. So now I'm going to do all of it all at once. And then you kind of like, uh, just sort of, oh, that's, that's a real quick, like way to burn out.
Amos: Yeah, I think, so-
Chris: So to your point earlier, even though I made fun of you, I think there is something to the idea of like cultivating a, like certain types of habits about that stuff. Um, that does help, uh, in a lot of ways.
Amos: The other thing that helps is lots of coffee.
Chris: Yeah. See, I, gross. Wow. That's awful.
Amos: Look at this French press I have.
Chris: Yeah. It’s certainly a French press.
Amos: It's it makes like 12 cups of coffee, French press.
Chris: That's too many cups of coffee.
Amos: Well, not when you're this motivated. Hey, uh-
Chris: Well this is, so, so like I was saying, so people approach this like a sprint and then they burn out, uh, because you know, it's, it's fueled, uh, by slightly too many endorphins.
Amos: So, um, that's my same argument with why I hate the fact that people call things well, scrum calls things, sprints, and like you starting out with a bad mindset, it feels like, and then it's a sprint every week, every week or two weeks or whatever your sprints are. And so then it's like never ending sprinting, which is not sustainable. Um, I think it's no secret to you. I don't know about the show. I, I love Ireland and the Irish culture and, um, my wife always points out whenever I'm sprinting to sort of say, is that the people that we met in Ireland, they all work really hard, but they just work at a steady pace. And then at the end of the day, they stop. And they just enjoy life. And I feel like here in the US there's this drive to just keep pushing and pushing as fast as you can and as hard as you can and you feel like you're not gonna make it. Um, and when I don't, when I don't do that, I actually get more done.
Chris: Yeah. I tend to, I, same. I mean, I tend to find that I'm, I'm generally happier when I am, uh, regimented about the kinds of things that I'm getting done. I'm not, you know, just like burning myself out at either end I'm more motivated, I'm more creative. I come up with like more interesting solutions to problems, all that kind of stuff. Um, and that goes back to like the whole idea of like getting, you know, eight hours of sleep at night or however many, you know, that's, that's, for me, it's like, I'm somewhere in like the seven to eight range where I feel like that's a pretty good amount, um, for me. And, uh, you know, there's something to be said about really monitoring that kind of stuff. And I don't, I, you know, I don't know necessarily the best ways to cultivate that. Uh, I do know what works for me, which is you say no to basically everything. Um,
Amos: I need to get better at that.
Chris: Like, that's, that's a huge part of it is like, you know, the fastest way to, to get more, I mean, it's like Lean or like, uh, if you wanna, if you wanna draw a really, really bad analogy or comparison, uh, one of the best ways to free yourself, your free your mind to like actually work on a few key important things is to not have a ton of like peripheral things to say, no, I'm not going to do that right now. Like, no, I'm not going to work on this. No, even though I know that that would be fun, even though I know that, like, that would be interesting to learn about I'm not gonna do it right now. And this is basically the reason, uh, like, I continually am telling myself that this is, this is the month, or this is the week, or this is the day or whatever, where I'm really going to actually learn like some machine learning stuff. I have a cursory understanding. I did the Andrew Ng course I've read books on it and all that, but I've never really, like from first principles found a problem and then like solved it, right. And the reason I've never done that is because when it comes down to it, uh, that's not important. It's not important enough to me at the time for, for that specific thing. Like for me, for that specific thing today, you know, or this week or whatever, like that project isn't as important as working on norm stuff or working on, uh, something more work adjacent or reading a paper or just reading a book or, you know, whatever, whatever the thing is, right. And because of that, it's like, that's hard because it's something that I think would be valuable to learn, something that I think would be interesting and fun, but it's also like, it's just not as important to me, to me personally, as a bunch of the other stuff. So I just keep saying no. And, um, and that's fine. And that's like, that's a, that's a way to, you know, work on other things, you know, and then you will, and it provides room to allow yourself to do silly stuff. Like I've got this toy language I've been building off and on for, I don't know, six months. And I don't make a ton of time for it, but I keep, I like, you know, take little stabs at projects on it and stuff like that. And then it's all just fun, you know what I mean? But like, you're freed up to be able to do that when you also don't have 10 papers that you want to read or whatever. Cause, you know, you can, because you say no, even though they are, as they are ostensibly would be good to read and you'd learn stuff and that'd be fun, and you'd be bettering some part of your career potentially and all that kind of stuff. Like, I don't know. It's hard to say no. And I think most people don't say no to all the little things that they end up doing. Um, and I keep coming around, coming back around to the idea that like the superpower for getting a lot of stuff done is kind of saying no to like a thousand other things or like having the, having the mental fortitude to say no.
Amos: Well, in order to have the time to do anything, you have to say no to a lot of other things.
Chris: So, I mean, so you use like a really, really stretched analogy. Um, imagine you're working on a, like a fix for something in a code base and you need to go in and fix the bug, but the bug is three layers deep in this stuff. Right. And you need to fix it. Uh, but you're having to like unpeel these layers and get down to it. Right. And you're like, ah, it'd be a lot easier if I like actually started, you know, to use a terrible term that I don't like, if I started refactoring all of this that would make solving this bug easier. Right. Or this happens a lot more in like feature development, like, ah, I need to like support this new thing. Uh, what I really should do is like build a new abstraction for this. And then dah, dah, dah, like, you know, you have this, you have this larger set. Right. And all of a sudden, like the feature now grows and also by doing it, you incur bugs. You, you introduced new problems that you need to solve. You need to rewrite all the tests because you know, you did TDD and you wrote way too many tests around all the things. And so now you're like coupled everywhere to these like tests that you wrote. And so because of that, that's like the, you have to have, if you actually just want to get your job done that day and then maybe come back and fix that stuff later, you have to have a ton of mental fortitude to be like, I'm just going to accept that this is how this is, work within the system, for today, extend this thing to do what I want it to do. And then once we've done that, we can maybe take a different and maybe come back at a different time and actually, you know, pull that abstraction out of there and rebuild this in terms of an abstraction or, uh, encapsulate something better or whatever the case may be, right. Whatever it is, whatever change that you're actually trying to do in the code base. But that takes a ton of mental fortitude. Like you have to have like real discipline to not do that. Um, and I think that that's the same as like the ever-growing to do list. Like you have to have discipline just to be like, nah, that's not as important. I'm not going to let that take up room in my head.
Amos: And when it does, your weekly review, should have you take that off.
Chris: I mean, One, one would, yeah, one would think.
Amos: I quoted David Allen to somebody yesterday. I was like, oh my gosh, I've been reading too much, but that's been one of the things that I've started saying yes to, as I've said no to other things is reading more. Um, which makes me very happy, but you, I, I know it wasn't the point of your conversation, but I, or what you were saying, but I have to step in here because I think that refactoring and TDD are good things. And, and I think-\.
Chris: But refactoring doesn't mean anything.
Amos: Well, no, no. Just because Google doesn't have it or Webster doesn't have it listed doesn't mean it doesn't mean anything, but I think it's the meaning of it too-
Chris: I don't know, the dictionary, like I'm pretty sure, like pretty sure yet is in the dictionary at this point. So
Amos: Fair. Well, it's, it's a, it's a yeah-
Chris: Fun story. We have a Kafka thing where.
Amos: You're interrupting my important point.
Chris: Where when you skip messages, you literally return the tuple where the first atom is yet, to tell it to like skip the message. Continue.
Amos: Nice.
Chris: You were stepping in to defend TDD and refactoring. Continue.
Amos: Okay. So I'm gonna start with refactoring. So-
Chris: Post repost.
Amos: What refactoring should be is that you change the internals of something without changing the external interface. Unfortunately, most people don't do that. So it becomes a big problem.
Chris: Sure, sure.
Amos: So I will defend refactoring in saying the things that I've heard you in the past say that you don't like about refactoring are people not doing it right.
Chris: Well- sorry. Are you done? Do you want me, um, I'm ready to reposit, so
Amos: No rebuttal yet, I'm going to TDD.
Chris: Okay. Okay. Sure. I will take these in order. Go ahead caller.
Amos: TDD is something that helps me think through a lot of things. Um, and I, and I will say that it helps me, simplifies interfaces for me because I don't want to write a whole bunch of crap in order to test anything. And I have a harder time with it in Elixir, I'll say, of not making brittle, um, because I don't have as much experience in it, but in, in languages, in the past and, and how I test, I have found ways to create tests that are less brittle and allow me to do the real refactoring, which should be not changing the external interface. If you don't do that, then your tests are often a lot, they're a lot less brittle too, and they may still matter. But I think that that comes with experience and it's hard to do without being completely disciplined about it for a long time. And I don't think it's for everybody.
Chris: Yeah. So I'll set TDD aside. Cause I actually don't have that much vitriol for TTD. I do think like most people write way too many tests, just generally speaking, in terms of like actual lines of code, because, and the problem being that like when you it's called coupling, right? All your tests are coupling. And most, most people view that as like a good thing. I don't, but I think it's not, not on its face. Like it's not a good thing to have coupling in your system. Like that's a trade-off that you make to ensure that the system works, but it is coupling. Like, it's like, you know what I mean? Like it's, it's, it's, uh, like it's just definitional. It is, it, it is coupling.
Amos: Yeah, at some level your system has to have coupling or it's useless just like you have to have side effects.
Chris: So like just don't write that many tests, right. And it's like, it's like, you know, just, don't just don't write that many of them like, or write, or like, don't spend that many lines of code on them. Even if you don't write property-based tests or something like that, write things that like do a lot more inside of like a single test. So you don't have to like, like generate the values yourself by hand or whatever. Like, like make your tests take up less room, just like treat your tests, like real code, stop writing like all these examples, like a monster. Like write them, you know, like treat them like real code and like keep them tidy and like all that stuff.
Amos: Right. If you would refactor your real code, refactor your tests.
Chris: Where refactor means whatever you want it to be, because it's a nonsense word that doesn’t mean anything, so-
Amos: I will, I also have a thing where if I write a test and it already passes, unless I'm trying to add a test around something. But like, if I'm doing TDD and I write a test and it already passes, I delete the test. Cause I figure it's useless. I've got it covered.
Chris: Yeah. And there's all the tricks too, of like, you don't work on the implementation until you see the test fail because you actually haven't confirmed that the test actually tested anything and you get false positives and all that stuff. There's all of these rules to TDD. And I'm not here to actually to knock TDD. If TDD helps you, you should do that because it is a design tool. I am knocking coupling and tests and you should be aware that that's what you're doing even. And you probably will decide that it's worth it, right. Everything is about those sorts of trade-offs like, you probably decide all kinds of bad things that you're doing in your systems are worth it. I mean, I do all the time, right? Those are all the tradeoffs that we're making. Like we're going to allow this to happen because like our jobs -cause code is code is meaningless on its own. Code only exists to solve problems. And, like, code has no value as code. Like it has literally zero value as files and a Git repo.
Amos: Right.
Chris: The only code that matters is, is like running software, solving real problems. So, you know, that's something to always keep in mind, but like we always make those trade-offs, which is fine. I am going to like, but like I said, I don't have that much vitriol for TTD. I have actual vitriol for the word refactor and also for the specific thing that you called out. So I will address them if I may continue.
Amos: Go.
Chris: I will, I will address them.
Amos: Go. I might interrupt you.
Chris: That's fine.
Amos: I'm a cop- bloop, la, la, loo 5th cup of coffee. So we're ready. Excellent.
Chris: Fifth cup. You're gonna die.
Amos: I've been up since five.
Chris: I -okay. Whatever. Anyway, so we've been up for the same amount of time because you're an hour behind me. Okay, great, cool. Weird flex, but okay. Uh, um, anyway, my problem with the word refactor is it's nonsense word. It doesn't mean anything. It's like saying performant. Like it doesn't, what does that mean? That doesn't mean anything. That's just like, that's a stupid word. It doesn't say what you actually mean or saying like strongly typed. Strongly typed doesn't mean anything. Say what you actually mean.
Amos: So what do they mean?
Chris: What does refactoring mean?
Amos: Yeah. What do they mean when they say that?
Chris: What people mean is change stuff, but there's a whole wide variety of change stuff, right? And like, you can actually just use real words that actually are well-known and still, and like get your point across, but get your point across better. And then you might actually catch yourself when you start, when you realize like you're, you're quote unquote breaking APIs. And so a lot of times when people say like refactor, what they mean, the quote unquote, good way to use refactor is to do what you're describing, which is like change the internals of something, which I'm going to get back to in a minute. But we'll assume for a second, that that works and has no effect on the outside world. Spoilers, it doesn't, uh, it or it does, but we'll pretend for a second it doesn't just for the sake of argument. I don't want anybody to run off thinking that it, that it doesn't affect the outside world. Uh, cause it does, but we'll suspend our disbelief. So let's say that, you know, it has no effect in the outside world, that's the right way to refactor is you change the internal stuff without affecting the external API and you've refactored quote unquote. Right. But why not- why is that a better word than saying like we improve performance that like change the internals improve performance because we switched from, you know, a naive unbalanced binary tree to a red, black tree. Like those are real words. You can actually say what those words are. Right? Like you can, you know what those words mean? Even if you just say I'm improving performance, you don't need to say why, but at least you're saying like what you're doing right. Or what happens most often is you find some sort of interesting abstraction. You find, and by abstraction, I don't mean the way that people often use abstraction to mean like finding a function somewhere that looks similar to all the other places that you call a similar function. I mean like actually abstracting things, which is to say, like finding the essence of the thing and extracting the essence of the thing into a reusable pattern, right? If you do that, then you can, then your internals can all use the abstraction. Like, and that's a, that's a win because often abstractions, especially things like, like type classes in Haskell or traits in Rust or protocols in Elixir, those are all extensible things. They allow you to grow the system over time. Like, as a side note, why are we not using protocols like way more? Like, I don't get this. I literally don't get- I mean, I do get it because they're tied to structs and structs are, and that's like, it is like a weak, they're very underpowered because you have to tie them to structs. Well, no, but like most of the time, like you want to dispatch based on two things or more multiple things you don't want to dispatch based on just the struct type you want to dispatch based on like something in the struck, like a string key or something like that. Like you want to dispatch on like concrete things or multiple concrete things. Like, but you can't do that with structs. You can't dispatch on like a list of a type of struct, right? Like you can't dispatch on any of these interesting things, which is actually kind of what you'd really want. Uh, but in any case, like I've never been unhappy using a protocol just because it allows you to like keep growing the system. Like you just add stuff and like, that's great. That's awesome. That's exactly what you want. But like again, if I say like, what I'm actually doing is extracting this singular essence of the thing in order to make it more reusable like that conveyed so much more than saying the word refactor, they like actually conveyed what you wanted to do and what you intended to do, right? Like refactoring could mean anything right. Refactoring can also just mean like you just broke a bunch of stuff. Like who knows? I deleted a bunch of code.
Amos: It shouldn't, it shouldn't.
Chris: It shouldn't. But it does.
Amos: That's not the intention.
Chris: And so like, if you stop using, but if you stop using the word refactor as like a catchall for just anything you don't like or anything you do like or whatever, right. Then all of a sudden, like you actually have to use real human words of like state, like a real problem statement and justify why you're doing any of the things, which I think is like a win. I think that's like a net win, uh, like for the system, even if it's just you communicating it to other people, like, here's why I'm doing it. I just like, it's not hard. Just justify why you're doing something.
Amos: Fair. Uh, I, I think you have a fair point. It doesn't make me not like the term refactor. Like to me, that's like saying I don't like the term animal because there are monkeys and there are elephants-
Chris: But did you refactor it in the first place? What was, what, how did you factor?
Amos: I don't know. I don't know.
Chris: And also, so, so like, did you factor it to begin with, so why, how could you possibly refactor it? Cause I can't, you know, most of the time when you people say refactoring, it's like clean up a mess that somebody else made.
Amos: If it had been invented in-
Chris: But like if it had been, if it had been factored in the first place, wouldn't it be good fact or factored is like, did you break it? What's the definition of the word factor? Did you break it down? Like-?
Amos:
It would be, if it was created in the Midwest, if the term came from the Midwest, it would be refigured because the first time you did it, you figured it out and it would be refigured. You know that. And I know that. So now everybody does, but so, so I, I don't know where the term came from.
Chris: And you can get a coupon to Menards for it.
Amos: To refigure it. So maybe I'll just start using the term refigured . Yeah. I'm not sure. I'm not sure what, cause I don't know. I'm trying to think. Cause the only terms that I can think of when I think of factor are like factors in math. So I'm not sure where it came from. Are you looking up factor right now? I see you, you're intense.
Chris: I am.
Amos: I'll just I'll wait. Maybe not so patiently
Chris: These def, you can this, come on now I'm free dictionary, which is the first thing that showed up. When I typed this into Duck Duck Go, did not.
Amos: You got to go to Webster.
Chris: Yeah. Hang on. Just talk to fill the air here, will ya?
Amos: Do I need, do I really need to fill the air? I mean, we can get it cut out if I'm too quiet, but-
Chris: One that actively-
Amos: Ope, you got factor?
Chris: One who acts for someone else. An agent. Yeah. That's just factor though. That's not factored like, verb. Anyway, the point is so like, but just like it's, doesn't take much just like say what you actually mean. Say what you actually intend. Use, use words that are explicit instead of using these like weasel words, to like justify to justify rearranging the puzzle pieces in your puzzle.
Amos: Yes. I think that whenever you're, you're saying I am refactoring this code that you should probably give a little more context there, but if you're talking about the, in general practice of refactoring, meaning changing the code without changing any of the external behavior or interface, I think that's okay. And yes, people use it wrong, but-
Chris: Well, so I also want to get back to this fundamental idea that there's some sort of magic way to, to not break an API's interface, but change its internals and not affect the outside world. Right? So, uh, let's, let's dive into that. Shall we?
Amos: Sure. It's hard.
Chris: Your honor, If I may approach the bench, I like to call my next witness.
Amos: Every time the Southern lawyer comes out, I get a little bit angry.
Chris: So the thing-angry? Why do you get angry?
Amos: Cause I know it's about, I'm not, I'm kidding. I don't really get angry. I laugh. I was going to make a joke, but like I can't now. I got interrupted by, that I had to send out of the room. Lost it.
Chris: So it depends on what you're talking about. So, so it worked the idea being, you have some external API, you never change the external API. You can only change the internal API. And if you do that and if, if all your tests, let's say, touch just the external API and they don't affect the internals, then you could swap-completely swap out the internals for some completely other thing, as long as it still, as long as the external API was still satisfied and you would have done it correctly, right? I think that is not a real thing. And it's only a real thing in highly trivial situations. It's like, I liken that to the people who are like, well, if you use an arm,- I'm bringing my new, my new nerd voice to the, to the stage here. Well, if you knew the ORM then you could swap out any backend- I figured, I felt like I was making fun of nasally people too much.
Amos: Yeah, that doesn't really work.
Chris: Oh. So just nasal, nasal voice?
Amos: (nasally) Hi.
Chris: Well if you use your ORM, then-Oh that's a Southern lawyer. Hang on.
Amos: Nasally Southern lawyer. You need a Joe, Joe Pesci lawyer. Just fight the Southern lawyer.
Chris: Oh right, yeah. From My Cousin Vinny.
Amos: Exactly.
Chris: Yeah. There you go. In any case, people often, it's like people who say like, if you use an ORM, then you could in the database, doesn't matter. And it's like, well that's dumb. Cause like we all empirically know that database does matter. Like it totally matters what database you choose. And if you think it doesn't, you aren't actually using that database very much. Like, because they all have different transactional guarantees. They all have different querying capabilities. They have different ta- like column types in their tables like, like it, it fundamentally matters. So if you're not, if you're going to use something that eliminates your ability to actually use any of the interesting things that make your database a database, then yeah, I guess you could say that that's true.
Amos: So are you- you're arguing that refactoring isn't a thing except for in trivial circumstances because of the complexity of systems, right? Like at some level, there, there are things that you're going to change that are going to have an impact on the end user you don't even realize. Maybe the end user doesn't realize it right away.
Chris: Or, or they're using it- so like for instance, here's a, here's an example. Let's say that you've got some external API, like if you don't change the external API, but all you do is change the internals, right? Like you've, you've maintained the illusion of compatibility, but it's highly likely that you've made the two things incompatible in their semantics because like, the not interesting thing is did the amount of arguments that you pass to the function change? Like, you know what I mean? Like the thing that does not matter is the name of the function and how much you, like, what the arguments that you pass through it were. That super doesn't matter, except in like super trivial cases.
Amos: Right. I've, I've, I've changed internals of something that didn't change the external interface, but it made it faster, which actually caused breaking across the system because nothing else could deal with the, the new throughput of that item.
Chris: And like, and also even if, even in certain, even in like the case where let's say you, you pass numbers to a function and it happens to divide those numbers. And before what it would do is happily divide by zero and raise a math exception. Or I think it throws in Elixir, but whatever, you know, if all of a sudden you star- you no longer allow, like you change the internals of that, which is like, we're not going to divide by that. We'll now catch that. Like, we didn't change the external interface. We didn't make you only pass in zeros or whatever, but we changed, like we changed the semantics that, so that we caught the exception, then return zero to you. Right. That didn't break the external interface, except it totally did because what it broke, because the external interface is also the data that you returned. Like the, the external interface is the range of values. Like, like math range of values that you will return from the function. That's part of the contract, right. And how it behaves with any one of those things is also part of that contract. And so it's, like, people do this all the time where they're like, this is broken. This is, this shouldn't work this way. So they change the internals of it. And then it turns out that somebody depended on it working in the way that it was broken. Like somebody was counting on the fact that, that, that you would throw an exception and has like written logic around that. And so now you've actually like broken them by not throwing the exception anymore, right. Which I get that you could make a pedantic argument that like, that is an external change. Right. And in a language with like a certain, with certain types of type systems like that would force it, like if you were in Java, right, like, you know, you'd actually force the caller to handle that or not handle it. It would be, it would be, it'd be a concrete part of the external interface. But I think that's a, maybe that's like a, not a good example, but I think there are tons of changes like that, that happened all the time. And people kind of justify it by saying, you know, uh, well, it should be safe. And, and I, I, I think the goal there is laudable. Like, that's great. Like we should strive to maintain stable interfaces and you probably are right to make that change. You're probably right in a lot of those cases to change the internals of something and respect those boundaries. Like that's not bad. I don't, I'm not here to say like, that's, that's wrong. I think though, that people put a lot of stock in the idea that if they do that, it won't have any sort of negative effects. And I just don't think that that's true. I don't think that that's accurate. And that it's like, it doesn't mean you should stop doing it, but it does- And much like the testing thing, right? It's like, you're coupling, like that is coupling. Testing is coupling. And in the same way, like you're incurring risk by doing this, right. You're incurring risk every time you change the internals of this stuff and how much risk you want to incur is kind of up to you and how much risk you want to put on your users, right. And it's the same reason that sinner is wrong. I mean, all of this stuff is all of a piece. It's all, it's all one thing it's like, SEMVER doesn't tell you anything about API. What it tells you is the degree that you might be screwed.
Amos: Maybe.
Chris: Right. But you don't know. But you don't actually get to know. Every time you look at, like, each number is a different variation on like potential risk.
Amos: So I'm going to, I'm going to plug Hex Diff then, uh,
Chris: Yeah, yeah, sure. Please do. Please do.
Amos: So, so that's an awesome tool. W I mean, SEMVERs get you so far, uh, in, in that the person setting the version thinks of the version in the same way that you do. Um, but it still doesn't let you know who your full risk, but Hex Diff that Johanna wrote that got pulled back into HEX itself is a fantastic tool for you to understand the risks that you're getting ready to incur by updating . Use it.
Chris: Yeah, you should totally use it. It's really cool. I like that thing a lot, but yeah, but does that make sense?
Amos: I get where you're coming from. And, and I, you know, you're saying think, basically.
Chris: Well and don't, and also accept the fact that you are taking on risk when you do this. And you're, and you're, and you're, um, you're arbitraging that risk across every one of the users of your library or your system
Amos: Good or bad.
Chris: Right. So just being cognizant of that helps you helps in, I mean, in the same way that not using the word refactoring and use really use real words helps you be cognizant of like the choices that you're making.
Amos: I, I think that's why versioning is important. I think it's different if you're writing a library that people can pull in, they can grab whatever version they want and keep the old one, versus I'm writing some kind of web interface, uh, an API that's out there that they can't control what, what version they're using necessarily. So if you do refactor the internals of that, you need to have the fall back to the old version and, and allow people to use that old version instead of a new one.
Chris: And I mean that's hard.
Amos: So it's more complicated when you're, you're in that kind of service interface for somebody else versus them just having a library that they can point to a specific version.
Chris: Right. And you need, uh, uh, re uh, uh, pretty reasonable test suite to actually ensure like, like there's no, again, this gets back to the idea that, like, there's no type system in the world that can tell you, you know, that you didn't break the contract semantically, right. Not yet, not in widespread use. And you know, like you need tests, you need these other ways of verifying that. Like, you didn't break the semantics of the thing that you're gonna return. If you care about that, right. If you care about that contract, I tend to care about it. But I think I care about it more than a lot of people do. And actually, realistically, I probably care about it more than you need to, like, just because, like, I don't know, like at the end of the day, like the costs are low. That's not really the world I want to live in, but I do think it's, I think it's, I think it kind of is the world we live in, like, the costs of that stuff are relatively low versus the risks. So people do it and they get away with it. And like, it is what it is. So I probably care about it more than is warranted, but I don't think there's anything bad can come of using more descriptive language when talking about this stuff. Like, I don't think there's anything negative that you're going to get out of that.
Amos: Yeah, and, and I agree with that. I just don't think that that makes the overarching term bad. It depends on what your, what level you're talking about, right. Well, like, just like hitting your code. What level of the abstraction are you talking about? You're probably not going to talk about moving pointers around if you're up at the top level somewhere. So that's why I don't hate the term, but I do realize that I have to like often clarify, people will say, uh, uh, you know, we'd like to refactor this and I'm like, what do you mean by that? And then they're like, well, I want to change, uh, how the, uh, clients call this API. And I'm like, that's not a refactor. That's a new version completely like,
Chris: Well, you live, you live your life. And I hope you sleep well at night, which you probably will with your new Casper mattress.
Amos: We're not even getting paid by Casper. This isn't fair
Chris: They send you a box. It has a bed in it. You unroll that bed than It just sucks up air like,(slurping whoosh sound effect) and then becomes a whole bed and then you lay on it. And sleep well.
Amos: And then you put your kids, you give them the box and they're happy too.
Chris: Yeah.
Amos: Oh man, what are we at today? I probably need to get out of here.
Chris: Yeah. Need to go have some lunch.
Amos: That coffee's wearing off, I'm feeling that downturn right now. Need an nap.
Chris: Oh man. Just put it on a slow drip, just try to ride the, try to ride the razor's edge.
Amos: I'm, I'm a man of a certain age. And if I have coffee after a certain time of day, I don't sleep. So I need to slow my roll a little.
Chris: You're already, you're already in the phase of like waking up in the middle of the night, walking around the house.
Amos: No, I don't do that yet. If I do wake up in the middle of the night though, I am angry. Cause I'm going to lay in bed for the next two hours wide awake,
Chris: But not anymore with your Casper mattress. We love Casper mattresses. And if you go to casper.com and put in the promo code, Elixir Outlaws and Casper mattresses, you will get a discount. Maybe not. Probably zero. On a Casper mattress.
Amos: Congratulations.
Chris: All right, let's put this up.
Amos: All right. Well, uh, I'm excited to see you at Lone Star and uh, happy birthday again to Noah. Um, who's actually the one that came in and bugged me earlier. Didn't realize I was recording. So that's about it. Everybody have a good day later. Catch you later, Chris.