SE Radio 577: Casey Muratori on Clean Code, Horrible Performance?
Casey Muratori caused some strong reactions with a blog post and an associated video in which he went through an example from the "Clean Code" book by Robert Martin to demonstrate the negative impact that clean code practices can have on performance. In this episode, he joins SE Radio's Giovanni Asproni to talk about the potential trade-offs between performance and the qualities that make for maintainable code, these qualities being the main focus of Clean Code. Brought to you by IEEE Computer Society and IEEE Software magazine.
Casey Muratori caused some strong reactions with a blog post and an associated video in which he went through an example from the “Clean Code” book by Robert Martin to demonstrate the negative impact that clean code practices can have on performance. In this episode, he joins SE Radio’s Giovanni Asproni to talk about the potential trade-offs between performance and the qualities that make for maintainable code, these qualities being the main focus of Clean Code.
Show Notes
Related Episodes
- Episode 520: John Ousterhout on A Philosophy of Software Design
- Episode 430: Marco Faella on Seriously Good Software
- Episode 310: Kirk Pepperdine on Performance Optimization
- Episode 225: Brendan Gregg on Systems Performance
- Episode 125: Performance Engineering with Chris Grindstaff
Links
Transcript
Transcript brought to you by IEEE Software magazine and IEEE Computer Society.
This transcript was automatically generated. To suggest improvements in the text, please contact [email protected] and include the episode number and URL.
Giovanni Asproni 00:00:16 Welcome to Software Engineering Radio. I’m your host Giovanni Asproni. And today we’ll be discussing the tradeoffs between code quality and performance with Casey Muratori. Casey is the host of Handmade Hero, an educational programming series, and the lead programmer at Molly Rocket 1935, which is an upcoming interactive narrative game about organized crime in the 1930s New York. His past projects include the Granny Animation SDK, Blink2, and the Witness. Casey’s past research contribution include the n-way linear quaternion blend, the immediate mode graphical user interface (IMGUI), and the first geometric optimization for the Gilbert Johnson KT algorithm. His current research interests include interactive fiction, concurrent computing, and operating system architecture. Casey, welcome to Software Engineer Radio.
Casey Muratori 00:01:02 Thanks so much for having me on your program.
Giovanni Asproni 00:01:04 Well, thank you for coming. Let’s start. Now this interview is actually being prompted by your blog entry with a video entitled Clean Code Horrible Performance published at the end of February this year, which caused, let’s say, some strong reactions. Yeah?
Casey Muratori 00:01:19 Yes, certainly did.
Giovanni Asproni 00:01:19 With many agreeing with your points and many other disagreeing very strongly as well. So you polarized the audience a bit.
Casey Muratori 00:01:26 From what I could tell in many ways I seem to have given the audience an excuse to argue amongst themselves more than anything. There were so many arguments between people that did not involve me that came out of this video that that seemed to be the biggest actual result or the thing that it caused the most was other arguments that I was not even aware of.
Giovanni Asproni 00:01:49 Okay so can you actually give us a very brief summary of the main points of the video for the listeners that maybe haven’t seen the video yet?
Casey Muratori 00:01:56 And I can also perhaps give a little bit more context to the video because one of the things that is interesting about the video is it comes from a course that I made and nobody really knows the context of it if they haven’t looked at that course. For example, they’re just seeing like this little slice, right? So I have a sub stack, it’s at computer enhanced.com and on there, there’s like a table of contents that has the listing of what is in this course. And the first thing that it has in this course is a prologue. And the prologue is not designed to teach anyone any of the concepts yet. It’s just designed to teach people, I should say that the course is about understanding performance or being aware of performance. It’s designed to teach people effectively, like what are the things that can affect performance?
Casey Muratori 00:02:44 And I’ve got a thing in there about IPC, about multi-threading, about cache, you know, that sort of stuff. And this material for the Clean Code Horrible Performance, was something that I basically included as a bonus video that didn’t quite make the cut for the prologue. because I was like, yeah, you know, virtual functions are kind of this subset of a different thing we talked about, which was this sort of idea of waste, which is making the CPU do things that you really didn’t need it to do. And so this is just like a little tiny snippet from this larger context. And of course it’s the only thing that anyone has really seen outside of the people taking the course, which is a paid course. So I don’t blame people like they don’t want to go take the course totally fine by me.
Casey Muratori 00:03:25 But this video has to be understood as something that is part of the larger context of things you need to be aware of when you’re thinking about performance. So in this particular video, what I talk about is the fact that in a lot of the sort of traditional textbooks that people cite when they talk about clean code, including, I don’t say this overtly in the video, but including the book that is literally called Clean Code and is the first hit on Google if you search for the word clean code. So it is if a novice who does not have their own idea about what clean code is was to type clean code into Google and hit return, they will find like that book, they will also find right on that front page like summaries of the rules from that book, which include the rules I use in the video and so on. So in this video I go over what some of those rules are and specifically what some of the rules are that actually are directly related to code architecture. Because some of the rules when people talk about clean code, have nothing to do with code architecture. They’re things like, what do we name variable names? Well that’s about readability to the programmer, but it will not affect the program at all.
Giovanni Asproni 00:04:32 So with the code architecture, you mean things that actually influence the runtime behavior of the program somehow after compilation maybe.
[...]