To become adequately productive and proficient, developers new to software applications often require months — even years — of on-the-job training to avoid making dangerous mistakes that put systems at risk. Discerning the true intent of functionality in code is no easy feat, and developers today spend roughly 75% of their time searching through source code to identify the code representing the functionality that needs to be changed or modernized.
While code search tools, linters, and static and dynamic analysis tools can all help developers significantly improve their efficiency and effectiveness, entirely too many of these tools are insufficient when it comes to actually identifying the specific lines of code that require attention — especially with how entangled throughout a system that code often is.
Current approaches employed by today’s AI are helping ameliorate this challenge, but they fall short in many significant ways. Fortunately, employing a novel approach to AI vastly improves a developer’s ability to efficiently identify the specific lines of code relevant to the tasks they spend enormous amounts of time on every day.
The Deficiencies of Today’s Tools
As software repositories continue to grow unchecked to unprecedented sizes, those responsible for maintaining and preserving a system’s functionality say it’s becoming more difficult to find bugs in code without machine assistance. Even worse, debugging consumes about half of a developer’s time, and correcting and then validating the fix of a single bug can take days, weeks or even longer.
From bug localization to program repair and code synthesis, today’s tools can be helpful to analyze millions of lines of code, flag errors, and suggest fixes or best practices, but a number of challenges in existing code search tools remain. Code navigation in a tool like Sourcegraph accelerates the rate at which developers can build a mental model of the code, helping them understand the parts of the universe of code that are most relevant and important, but the tool doesn’t actually build the mental model. The tool only gets a developer closer to code that could be relevant to the sought behavior, but the developer is left to piece together that mental model. With how time-consuming, mentally challenging and fraught with error that effort might be, humans are ultimately fallible even if they are using the best available tools to help them.
For example, security vulnerabilities are simple enough to identify with current tools, but zeroing in on all of the relevant code to remediate is difficult and time-intensive — much more so than writing the program in the first place. Often, the relevant code is scattered across many files, increasing the complexity of the task. When debugging unfamiliar programs, developers typically begin the process with a “why” question about their program’s behavior, but they have to conceptualize that question into a series of actions and queries to address the issue at hand. As a result, programmers must simultaneously keep track of several aspects of the program’s detailed execution path, however, the ability to do so is incredibly challenging for even the most experienced developers.
If a programmer fails to understand how changing code in one area of the code impacts the system as a whole, even a minor tweak can break the entire system. Since it is important that developers comprehend what an application actually does, debuggers are not used as widely as one might expect, especially in functional programming environments.
Unfortunately, even the most advanced static and dynamic analysis tools, search tools and linters are extremely inefficient in transmitting that knowledge. Whether drawing pretty pictures, tracing out code, seeing how the code behaves with specific data as input or providing a summary of searched-for words followed by complex changes, these tools help developers identify the relevant code in different ways, but developers still have to conceptualize to surface the intent of previous developers encoded in the software and reveal the bug that they seek to fix. At the end of the day, even with the most advanced tools, human software developers still have to build a mental model of what the code does by deciphering the code directly to match the behavior they seek to change so that they may effectively modify complex and critical systems.
Leveraging the Power of AI to Overcome Deficiencies
From Intel to Amazon to Microsoft, some of the world’s foremost tech companies are turning to and creating artificial intelligence-based tools that propose code snippets to developers whilst they code. By leveraging AI, developers are witnessing productivity gains, a reduction in the time spent writing code and the mitigation of risks.
However, by using AI in a novel way, the code repository can become a knowledge repository that represents source code in the same way that a human thinks about the world, in cause and effect. When AI-powered tools know each and every one of the behaviors throughout the source code, the tools can then “collaborate” with developers to narrow in on the code that needs to change, without searching through and understanding all of the surrounding code. Using AI in this way stands to increase developer productivity by orders of magnitude.
Enabling developers to ask this knowledge repository for the specific code of a behavior, AI helps developers to deal with only the relevant code, thereby empowering developers to make changes with confidence that they won’t break the entire system. Even better, developers are able to “propose” a change while they are coding without recompiling or checking the code in, so the use of AI mitigates risk by verifying whether the change is isolated. This capability is also extended into the CI/CD pipeline by having the AI check the code after every build to guarantee that behavior will never change in the future.
Employing AI in this fashion focuses a developer on only the code that matters, without the excessive cognitive load of understanding code that is irrelevant to the task at hand. Unlike code search tools, linters, and static and dynamic analysis tools, AI ultimately empowers developers to safely, efficiently and effectively make any necessary changes.