Please help us continue to provide you with free, quality journalism by turning off your ad blocker on our site.

Thank you for signing in.

If this is your first time registering, please check your inbox for more information about the benefits of your Forbes account and what you can do next!

I agree to receive occasional updates and announcements about Forbes products and services. You may opt out at any time.

I'd like to receive the Forbes Daily Dozen newsletter to get the top 12 headlines every morning.

Forbes takes privacy seriously and is committed to transparency. We will never share your email address with third parties without your permission. By signing in, you are indicating that you accept our Terms of Service and Privacy Statement.

Technology is a complicated field, and you never know what difficulties might arise. Developers face many inevitable issues in their line of work, and it’s likely that, at some point, they’ll run into code that isn’t performing as intended.

When this happens, it can feel like you’re trapped in a box with no way out. However, there are tested strategies for troubleshooting and getting to the root of the issue. Below, 14 members of Forbes Technology Council share tips for debugging malfunctioning code.

1. Keep Your Tests Focused

Tests that focus on just one specific piece of application functionality (known as “atomic” tests) are significantly easier for developers to troubleshoot and debug. Because atomic tests are so focused, if and when issues do arise, there’s no confusion about what’s gone wrong. Instead of wasting precious time searching for the problematic code, developers can immediately get to work debugging it. - Lubos Parobek, Sauce Labs

2. Break It Down Piece By Piece

The best way to debug is to break down the code piece by piece and examine the value of the variables involved at certain times and operations by putting in breakpoints. Be aware of all expected values and confirm if that is what you’re seeing at any given point in time. Sooner or later you will see something unexpected, and then it’s a simple matter of understanding why it happened. - Mihir Shinde, B&H Photo Video Pro Audio

I cannot stress how important documentation is at any tech company. Documentation is usually spread out in various places. Whether it is in Quip, Google Docs, Github or inline comments, having one place to store all code decisions is very important both for a developer to share knowledge with other developers wanting to fix the code and for you to revisit the same code when it starts malfunctioning. - Spandana Govindgari, Hype AR Inc.

4. Insert Visualization Statements

We always run into a problem with malfunctioning code. The two best ways to debug the nonfunctioning code is to insert debug and visualization statements. By inserting a visualization statement, one can see at what point code starts malfunctioning. It gives an insight into what specifically is malfunctioning. - Naresh Soni, Tsunami XR

5. Isolate The Problem And Reproduce It

Don’t jump to implement a fix before you truly understand the problem. First, isolate the problem and make sure you can reproduce it at will—then implement the fix. By doing this, you won’t waste time performing blind “fixes” that don’t resolve the problem, and your testing is improved because you know how to reproduce the problem. - Carlos Melendez, Wovenware

6. Look For The Root Cause Before Rewriting The Code

There is a natural reaction by developers when presented with code that doesn’t work—especially if it was written by someone else—to rally for a rewrite. While this is sometimes justified, it’s important to first understand why the code doesn’t work so as not to repeat the same mistake. Only once the exact root cause has been identified can an informed decision be made about the next steps. - William Francis, ENO8

7. Leverage The Right Tools

Whether it’s debugging front-end code in Chrome Debugger or back-end code in your favorite IDE, there is a plethora of tools out there that should let you step through the code line by line until you can narrow down the problem. The keyword here is “narrow.” Problems always look hairy at first; the trick is to reduce the size and scope until it’s manageable. - Joe Conley, Buyside

8. Ask For An Unbiased View

Too often, coders feel so much ownership, pride and responsibility for their work that they’re afraid to ask for help. That’s a mistake—there’s nothing wrong with asking another engineer to take a look. Sometimes we can’t see the forest for the trees. Another eye might be what you need to see the problem in the code. - Abhinav Somani, LEVERTON

9. Look For A Comparable Piece Of Public Code

Many online coding forums (e.g., Stack Overflow) and hosting platforms (e.g., GitHub) offer public code snippets and repositories that provide developers with an unparalleled source of coding information and use cases. To be able to effectively troubleshoot or improve their code, developers need to be good “data miners” and find a comparable or recent piece of code! - Ahmad (Al) Fares, Celitech Inc.

10. Consider The Business Context Of The Problem

To troubleshoot code that precedes you, first get on the level of the business. What does the application do, what is it supposed to do and how is it supposed to do it? This context is incredibly important in troubleshooting. Secondly, read the code line by line. With an understanding of the purpose of the code, you’ll be able to read it like a story, which empowers you to rewrite it. - Kyle Pretsch, Lucky Brand Jeans

11. Try Explaining The Problem To Someone Else

There’s a concept called “rubber ducking” that can work wonders. By explaining the problem and code to someone else (or even just to a rubber duck), often the problem will become obvious. And if it doesn’t become clear from explaining it, you’ll get someone else’s perspective, which might give you the insight you need to solve the problem. - Luke Wallace, Bottle Rocket

12. Read The Error Code

When troubleshooting malfunctioning code, many developers will see there is an error, yet fail to read the error code. The error code can help provide insight into what the issue is—just be sure to run the code each time you make small changes to ensure you can address errors as they occur, rather than an hour into a coding sprint. This helps target where the mistake is for faster resolution. - Marcus Turner, Enola Labs

13. Troubleshoot Beyond The Immediate Problem

Every developer deals with this at some point or another. Your best bet is to change as little code as possible when addressing the immediate issue (assuming there is urgency). From there, add tests around the expected behavior and refractor as needed to clean up the code so the next developer (or perhaps even yourself) is pleasantly surprised the next time they have to look at this code. - Andres Angelani, Cognizant Softvision

14. Take A Break

Try to first investigate and understand what the system is doing versus what it is expected to do. Then go play a round of ping pong or nap on it. Your brain will still be subconsciously working out solutions and trying to connect the dots. - Winnie Cheng, Io-Tahoe LLC

Forbes Technology Council is an invitation-only, fee-based organization comprised of leading CIOs, CTOs and technology executives. Find out if you qualify at Forbes…

Forbes Technology Council is an invitation-only, fee-based organization comprised of leading CIOs, CTOs and technology executives. Find out if you qualify at Forbes Councils. Questions about an article? Email feedback@forbescouncils.com.