- Podcasts
- Two's Complement
- Getting CRUFTy
Getting CRUFTy
Two's Complement
- January 12, 2025
- 35 min
About this episodeBen unveils his latest acronym-based software discussion framework while Matt patiently waits for the punchline. Our hosts explore…
Ben has written a blog post going into more detail since the recording.
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
Getting CRUFTy
ah Names, if you're if you're a regular listener of this podcast and you heard us talk about patterns thinking and how patterns thinking is an important part of learning new skills, learning to think in patterns and giving those patterns names. If the patterns don't have good names, no one will remember them.
No, but it's, I mean, let's just in in terms of in terms of the gang of four patterns book, you know, part of the the thing that gave that the power is the fact that now we have a new language we can use, and I say a singleton, and you know what I mean, or I say a flyweight, and you know what I mean, and we and it carries a lot of baggage with it.
Exactly right. And that's the problem with iterative versus incremental because they both start with I and no one can remember what they mean. But there's another name that we have that ah we use a lot in software and it doesn't really have a single meaning and that is technical debt. And we talked about that a little bit in the prior episode.
And therefore, it's lost a lot of value as a thing that we can use as a pattern to talk about, unlike the singleton or the flyweight or the decorator or any of those gang of four patterns, where it's like, people, I think generally agree on what those mean. I literally yesterday asked a whole room full of software engineers, what does technical debt mean to you? And I got 10 different answers, right? And they were all sort of related
But basically, like the useful the useful accent aspects of your software, which are arguably the most important part. right It's the thing that you know hopefully hopefully, if you're doing it right, is making use of money, but not necessarily. ...Feedback, which is an essential part of any software development process.
And so my hypothesis here is that when you're talking about technical debt, what you're probably doing, and I think this is actually true of most senior software engineers, and they just, unlike me, who you know they don't spend the time to like build systems out of the way that they think because they're not trying to teach them to other people. It's like, Ben, why did you do that? It's like, I don't know. It just seemed like a good idea. It's like, no, I need a better answer than that, right?
It's like, I don't know. I can't really explain it to you. So because I'm in this situation where I'm forced to explain my thinking to other people, ah I think that there are lots of situations in which senior engineers are making decisions along these dimensions and not even realizing that that's what they're doing. They just sort of do it out of their experience, right?
Exactly, exactly right. um And it was not lost on me. so Somebody, when I was explaining this, mentioned to me, it's like, okay, so your problem with technical debt is it's a financial metaphor for financial people, and then you replaced it with another financial metaphor. It's like, okay, yeah, that's good observation.
There's no interest rate of technical debt. you know, despite how many times people want to draw that, there's no, that's not a real thing. That's a pretend thing. It's not a real thing. um But I think that these dimensions are real in the sense that they are quantifiable. And um I think I can explain how you could quantify every one of them.
Interesting. Okay, the U I'd be interested in because that would seem to the weakestly defined thing. But yeah, I get the complexity can be somewhat defined as any number of are both algorithmic, you know, complexity, but also just lines of code is not a bad proxy for complexity, or number of systems or libraries or dependencies or something like that.
So if you really wanted to stand on the shoulders of giants, there are many people who have tried to quantify software risk in the past. And I think a lot of those techniques are very effective if you want to apply them rigorously. If you want a very rough estimation of this, just look at the incident issues in your backlog or the, you know, the error incidents in your backlog or whatever it might be.
Right. That's what I'm used to doing. Yeah. It's not the idea of like, you know, you you write down the risk of like, what would happen if, and you come up with a few of the things that are really important and you go, well, how do I offset those? And the more of those you can think of, like, well, what if this happens? What if that have we accounted for this? What if the business changes direction, whatever, those kinds of things could be seen as risks. But yeah, I get it. Yeah. GitHub issues is not a bad proxy for it. At least in some mechanism um of, you know, anything, any outstanding known issue that you have is definitionally a risk. It's like, Hey,
If two people try to do this at the same time, then we get an exception thrown and then we, somebody has to deal with this out at customer services. That is a risk that we're, and we're riding that risk and yeah, got it. yeah Okay. So we'll see our, and this is an easy acronym to remember at least and very, very apt.
Oh, that is interesting. Yeah. Okay. So uses here in this instance is like, yeah, functionality that people are happy with or are happy enough with that's providing value to someone somewhere. As you say, maybe it's making the company money. Maybe it's like the raise and debt for a few open source so project, whatever it is. And that that is one of the things that has kind of a, ah it'll have in the optimization problem, it should have a negative weight risk with respect to complexity and risk, we hope it should have the opposite sense to that because obviously, you want to optimize for the highest uses and the lowest risk, presumably amongst all these things or the things.
Even, and and this and this is this is where it's like, the applying this practically, I think you're going to wind up with the constraints where it's really not possible to, or it's very unlikely that you're going to be able to increase the uses without increases increasing complexity or risk or some other factor that's bad.
Yeah, absolutely. And I mean, we don't do that often enough, I think is is probably the point that you're sort of getting at here, or at least, you know, without it being, you know, there in front of you in in numbers, you know, want one way to change our objective function that says, you know, we wish we we we do want to maximize, which is some kind of relation, as you say, a ratio of these things is to say, well, let's just get rid of the thing that doesn't really work that people don't really use.
I like it. I and it's not the inverse of either C or R. And in fairness as well, while there are sort of correlations between these things, they're not all totally orthogonal axes. Are they, um you know, like complexity and risk sort of go hand in hand. I mean, like some of the risk is the fact that something is complex.
Sometimes they are maybe different or whatever. There's some, yeah, some, something, something portfolio optimization problem here risk. So that's actually interesting because and maybe we should pause here on the U, but like one of the things that we do in our day jobs is that we have ways of taking the many things that we have and and applying a risk model to it, which obviously is different from the risk we're talking about are here.
It's like, which is essentially the objective function is a thing you want to minimize um ah or at least take into account when you're trying to maximize something else. You know, in ah in the case of what we do in our day job, it is maximizing the amount of money you make while reducing the risk that that requires to go forward the risk. And that's, ah that's kind of some weighted sum of all of those things. um And so yeah, here, that's what you're talking about with the ratio of like, well, okay, we we increase the uses, but it also increases the risk and the complexity, maybe those net out, and we don't actually, that's not actually better.
So how do you know if your uses are valuable? I think that's like the most important form of feedback. It's like, did the software that we build actually make any money? And in trading that's easier to do than in a lot of different contexts, which is, you know, you put the strategy into production, you see if it makes any money, but there's lots and lots and lots of other situations in which you need to create feedback loops to write.
That is interesting. Well, that is true. Okay. I will, but but I'll take you back on that because one of the things that you were saying is, you know, like things that people want that are used to evaluate generating business value, because I can sit down and write a thousand tests for a piece of code that nobody actually needs or wants.
Uh, it's just anything you can measure objectively about your code. Um, what about things, you know, like. you know, ah log incidents, I mean, you kind of alluded to this with the R thing here, but you know, like, you know, the number of warnings that you're logging out or, you know, info, that's all, I mean, it all falls under feedback, but it may well be that that feedback, in some ways is again, very sort sort of collinear with risk, if you're saying, well, one of my risk metrics is how often do we get an exception thrown that we track in our exception tracker or whatever, and then that's part of the feedback.
Yeah, absolutely. So one of the things you can do is you can mitigate risk by adding feedback. right So if you have better observability in your system, right you have better application metrics, you have better alerting, you have better things like that, then you can probably take more you know you can have more risky things that don't ah result in as much risk because you'll be able to respond to them quickly. Like we're going to put this strategy into production.
If it starts tanking, we'll know about it right away and we can turn it off. Or if the exception starts happening, we can we can handle it right away. Whereas if your feedback is lower because your observability is lower, then that risk is effectively higher because you can't see what's going on, right?
Can we, can we stop, let's stop talking about buses running people over. We, you know, you, you and I know that the way that we used to do kiddos in our, in an old job that we were in together was the crypto factor where some arbitrary coin that somebody had bought on a whim because it had a funny name goes massive and they never have to work again.
Oh. if Trevor, if Trevor ever quits, we're doomed because nobody knows what Trevor's doing, you know, or whatever. And that then, okay, and so I think there are ways you could build to quantify it might be, excuse me, might be a bit trickier than the other ones, it might involve a little bit more gymnastics.
But I do think it could be done. I mean, you could even have like labels and get whatever and say, hey, it could be done by blah, blah, blah, rather than in assigning it to people specifically, and then go, hang on a second, which, which, which issues do we have that only has one person on it.
Yeah, CRUFT. And I think if you try to relate this back to what a lot of sort of colloquial uses of technical debt are. So like going back to the original thing here, but you got a room full of six people and you got 12 opinions about what technical debt is. Those opinions are are probably not wrong. They're almost certainly not wrong. They're probably born from direct experience and sort of Hard-fought lessons it's just that they mean different things but we're using the same word to refer to them right so a real basic example of technical debt as many people use it is essentially abandoned where right like you got the haunted graveyard project where it's like you know.
Yeah, yeah, you can't manage the risks anymore. You can't manage the complexity anymore. You can't add new use cases to it anymore because T is now zero, right? um Another situation is when things get too complex, right? Like the complexity factor goes way up. It becomes very hard for people to understand. And now you can't add new use cases to it anymore, right? Because you're by doing so, you're probably taking on a risk.
I mean, everyone has sort of some gut in understanding of what I say when I say like, "Hey, I'm going to do this quickly, but it's going to cost us in the longer run". And you're like, "Oh, I get it. You're borrowing from some mythical thing and that puts you in debt." And later on you have to pay it back with some kind of interest, which again, we've said doesn't really exist in the same sense, but like it doesn't, it does. bring some of the thought processes through, a not thought, process it it ah does have the right kind of smell to it, right, for for for for it, which is why it's so attractive. CRUFT, obviously, is a great acronym, and it is an acronym, I just had to think to myself.
But I mean, the thing is, it does, I mean, to, to, to pick holes, uh, it is still an incredibly broad set of things that you've just defined in that, which is fine because presumably you're covering, ah this is like all things. In fact, CRUFT in this instance is a an all-encompassing aspect of the entire project, right? It it covers all of the parts of it, the good and the bad, because you've got the you in there that's a usage, and you've got like the feedback, which is usually good, and and the team, which is hopefully a good thing. And so it's not like ah it isn't in its own right and negative sense. Like if I say, oh my gosh, this is a bit this is a lot of cruft here.
It's like there the goo around the edges that you have to pick out. Um, but so yeah, I guess it's a good acronym to think about how to um how to run a project and think about when you're when you're making a decision about whether I should add a new feature or whether I should test this in a particular way or whether or or not, we should just send Trevor off on his own Odyssey for three months and then see whatever he comes up with. You can measure it using the cruftometer and say, are we OK with this? Are we still within the bands of cruftiness that's OK? Maybe that's how you could accept this. Like: We accept that all projects are crufty because they're programs, right? And they're written by humans. And they're an engineering solution to ah a very high dimensional optimization problem of like, Well, we need to get this out by Thursday. Oh, I don't really understand how this thing works. All right. I'm going to use a library. I already know all these kinds of things are being balanced and I had all the time. Um, yeah, I suppose I'm trying to rationalize what CRUFT really means.
That's great. like That's what Ward originally intended. That's a great way to describe to somebody who's not a programmer why you're doing things other than adding new functionality that's going to potentially make you money. It's like, why are you guys refactoring? What's refactoring? Why are you spending your time? Use technical debt. It's great. That's what it's for. If you have programmers talking to other programmers about the trade-offs that they are making in code, you can do much better than saying, ah, that that thing's got a lot of debt. You can be more specific because you're a programmer and you should. So for example, if you are reviewing a PR and you see ah some code in a PR and you're like, I don't think this complexity is worth the use. Like you added in this super complicated arg parser thing instead of just slicing off the first two string parameters. And you added like 10 lines of code and it's like, I get that that's better, but I don't think it's worth the complexity, right? And then you can have a discussion about whether that's true as opposed to like, this code says it's full of debt.
Right. That, that makes a lot more sense to me. yeah Yeah. Essentially you're handing someone a cheat sheet of things to talk about when either justifying a decision or considering tradeoffs and, you know, in a code review situation, these are the words that you should be using. You know, this seems risky. Or are we okay with the risk that that this thing won't work? Is it tracked in an issue somewhere? If it does go wrong, do we have the feedback that will tell us how to come and find it quickly?
um Who else knows about this? Does anyone else understand this piece of code? um You know, is it could it be less complicated than this? Maybe we should just is there something on the shelf off the shelf we could already use, right? And I've presumably missed one of the letters in this. this example or Yeah, who even asked for this?
We are capable of talking about lines of code complexity. We are capable of talking about potential risks like, oh, if we get this message type, we don't handle it. What will happen? Oh, the system will restart and it'll go into the dead letter queue. Okay, that's an acceptable risk. Great. right We are capable of talking about these trade-offs in more specific terms that isn't a metaphor, a financial metaphor, and we should. And if you don't like cruft and you can't remember what the words are, that's fine. You should come up with these terms for your own team. right like For your the group of people who are going to be in this code together, who are going to be wearing those w risks, who are going to be getting those pages in the middle line, come up with your own terminology for this. But you don't have to use the same metaphor that you use to explain to the CFO why you need another person on your team that you do when you're talking to another programmer about code.
No, I'm i'm with it. I'm with it. um I don't know how to weave this in, but it must be said.... "Oh, no", he says, Ben, I can see the look on your face and...But ah just ah just for for our international audiences, I believe we we we have, um you should know that Cruft or Crufts is a dog show in the UKIt's the equivalent of the what is the the big dog show in the the u US? s I'm trying to think what it's called now.
Is it Kensington? No, I feel there's something else now. and Now I should have, I was going to try and Google it, but in this particular position, my keyboard is so close to the microphone. All you'd hear is at the clacketing. But yeah, so whenever we say cruft, it's exactly what I think of. In fact, you know, ah two two, three jobs ago, we had the, C++ library of things that C++ really should come out of the gate gate with, you know, command line parsing and printing strings with commas between them and stuff like that, was called ccruft, as in crufty bits of C and C++ that were just like, we just needed to do this because it's pasting the language together. So cruft is well, well taken, one not well understood, but I don't often think of the dog show whenever anyone talks about it. So if you can come up with S on the end of your acronym, if you need another thing, then that would make my day.
okay well i I appreciate trying to poke holes in this because the temptation with all of these kinds of things is you know like you're you're you're building castles in the sky and they're not really applicable. And like I try to think about things where it's like, is someone actually going to respond in a PR using these terms, the way that they've defined them here, and result in a better conversation and a better solution? And if that's not actually happening, then you're just You're just wrapping yourself around an axle being like, oh, and then I'm going to define this like this, and I'm going to do this like this.
No, i think I think it's valuable. I mean, these are these are not... No disrespect to your insight here. These are not novel concepts, right? You've just found a really good way of putting five key of them key concepts together that make sense and have a catchy acronym, which is a great way of you know um of making it memorable and giving you a conference talk to prepare for, which I'm accepting expecting anytime soon then.
And I'm not special. There are lots of other senior software engineers who have built things for a long time, internalized this stuff. And they sort of intuit things in this way. And it's just taking those and just putting a name on them. So right like we're not doing anything new or interesting here.
We're doing things that we've done for years, especially some of the risk management stuff. it's like years and beyond software, years and years and years. We're just giving it a name so that when we talk about it, we can say, yeah, I think this is too complex, or I think this is too much a risk, instead of like a very long-winded explanation of all the things that no one is ever actually going to read in a PR because they're just like I TLDR.
And ah yeah, so um this gives me a new tool in my arsenal to start thinking about things there. that I mean, there is a project, my friend, that has a lot of you, for sure, but an awful lot of people have added a ton of things in that are useful for them. And then they've disappeared off the face of the Earth afterwards, which is completely reasonable. It's an open source project. You know, you add your thing. but we don't necessarily have the test to cover those things, which means that they may break and we don't know.
