SE Radio 554: Adam Tornhill on Behavioral Code Analysis
Adam Tornhill, founder and CTO of CodeScene, joins host Giovanni Asproni to speak about behavioral code analysis. Behavioral code analysis is a set of practical techniques aimed at identifying patterns in how a development organization interacts with the codebase they're building. It can be used to prioritize technical debt to maximize return on investment; to identify communication and team-coordination bottlenecks in code; to drive refactorings guided by data from how the system evolves; and to detect code quality problems before they become maintenance issues. The episode starts with a broad description of the techniques, providing some examples from real projects, and ends with suggestions on how to get started with applying them. During the conversation, Adam and Giovanni touch on a set of related topics, including the applicability of the techniques to legacy, green-, and brown-field projects; ethical and privacy implications; and the importance of context when judging code quality.
Adam Tornhill, founder and CTO of CodeScene, joins host Giovanni Asproni to speak about behavioral code analysis. Behavioral code analysis is a set of practical techniques aimed at identifying patterns in how a development organization interacts with the codebase they’re building. It can be used to prioritize technical debt to maximize return on investment; to identify communication and team-coordination bottlenecks in code; to drive refactorings guided by data from how the system evolves; and to detect code quality problems before they become maintenance issues. The episode starts with a broad description of the techniques, providing some examples from real projects, and ends with suggestions on how to get started with applying them. During the conversation, Adam and Giovanni touch on a set of related topics, including the applicability of the techniques to legacy, green-, and brown-field projects; ethical and privacy implications; and the importance of context when judging code quality.
Show Notes
Related Episodes
- Episode 59: Static Code Analysis
- Episode 242: Dave Thomas on Innovating Legacy Systems
- Episode 295: Michael Feathers on Legacy Code
- Episode 331: Kevin Goldsmith on Architecture and Organizational Design
- Episode 363: Jonathan Boccara on Understanding Legacy Code
Related Links
- Twitter: @AdamTornhill
- LinkedIn: @AdamTornhill
Transcript
Transcript brought to you by IEEE Software magazine.
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 Giovani Asproni, and today we’ll be discussing behavioral code analysis with Adam Tornhill. Adam is a programmer who combines the degrees in engineering and psychology. He’s the founder of Code Scene where he designs code analysis tools to that empower teams to build great software. He’s the author of several books, Software Design X-Rays: Fix Technical Debt with Behavioral Code Analysis, the bestselling, Your Code as a Crime Scene, Lisp for the Web, and Patterns CC. He’s also a public speaker. So welcome Adam and is there anything I missed that you’d like to add?
Adam Tornhill 00:00:51 So thank you very much for that introduction. No, I think that pretty much sums it up. I’ve been working with soft development for 25 years, and I still enjoy it very much.
Giovanni Asproni 00:01:01 Good. So well, let’s start then with the first question, which will be basically the definition. So, can you tell us, what is behavioral code analysis?
Adam Tornhill 00:01:10 Sure. So behavioral code analysis is the idea that you approach code analysis from the people side. So, in the behavioral code analysis, the code itself is an important piece, but it’s even more important to understand how the organization and developers behind the code have worked to create it. That’s where the true information is.
Giovanni Asproni 00:01:27 Okay. Can you tell us what kind of problems does it help to solve? Maybe giving also some examples from real projects so as people can understand a bit what they can make of it.
Adam Tornhill 00:01:37 Yeah, definitely. So, there are a number of additional information points that the behavioral code analysis adds. So, if you look at just the code itself or static snapshot of the code, we will never be able to understand the dynamics of what actually happens when you build a system. And that simply means that we won’t be able to differentiate technical debt with a low interest rate, technical debt that’s in stable code, versus technical debt that’s in code that’s much more volatile and actually affects the organization. Another big advantage of behavioral code analysis is that since we take this people perspective on code, we’re also able to do a lot of interesting organizational and social analysis.
Giovanni Asproni 00:02:16 Okay. Can you give us maybe a small example that you some problem you helped an organizational address with this? Just a short one if you’ve got one.
Adam Tornhill 00:02:25 Yeah, there are a couple of interesting problems that behavioral code analysis can help with. I like to think that one of the most important use cases for behavioral code analysis is to not only identify but also prioritize technical debt. The reason you need a behavioral code analysis is because technical debt, I mean the tragedy behind it is that there’s so much of it out there and you pick up a code base at random and it will have tons of application code debt. Most organizations simply cannot fix all of that debt at once. You need to use your time wisely. And by running a behavioral code analysis called a hotspot analysis, you can basically identify which technical debt represents the largest risk, where is most of our waste occurring, and what parts of the code become bottlenecks for the development teams. And the way you do this is basically by looking at the behavioral pattern of which parts of the code do we work with as developers, and how often do we work with that parts of the code. So, by identifying those patterns we can identify hotspots, and hotspots are simply complicated code that we have to work with often. And these are great candidates when starting to pay down technical debt.
Giovanni Asproni 00:03:31 Okay. So, if I’m understanding correctly here you are saying, well as we know, lots of organizations have lots of technical debt in their systems, but behavioral code analysis will help us prioritize where to work on and avoid to address technical debts in parts of the code that actually are not going to change much. And so, addressing that particular technical debt would be expensive but not necessarily a good idea. Am I understanding correctly?
Adam Tornhill 00:03:57 Exactly. That’s a pretty accurate summary. The reason why this is important to prioritize is because if you pick up your average enterprise code base, you could probably spend two, three years just refactoring and paying down technical debt. And if you would do that, I mean, you wouldn’t be able to add a single feature. You would basically be out of business, you would be Netscape, right? And you really don’t want that. If you have technical debt or low-quality code and it’s in stable parts of the code — code that hasn’t been changed in months, even years — then that’s technical debt that you need to be aware of because it could very well be a long-term risk, but it’s probably not urgent right now. So, what a behavioral code analysis lets you do is to identify the parts of the code where you spend most of your time. By focusing your refactoring to those parts of the code, you’re more or less guaranteed that your work has a real impact, a positive influence and moving forward.
[...]