Diffblue’s tagline is AI for Code, but what exactly does that mean in the context of Diffblue cover, our product that automatically writes Java unit tests? AI for Code refers to technology that is capable of writing software, and this is what powers Diffblue Cover.
To explain the term “AI for Code”, we first need to start with AI. Artificial Intelligence (AI) is an area of computer science that is popular in the press and the technology industry, but it is often misunderstood.
AI as a discipline is about understanding and creating reasoning. The research on this runs back many years, and there are a number of different approaches to do reasoning that are described in AI work. Two of these are particularly important to AI for Code: inductive and deductive reasoning.
In order for machines to make productive and intelligent choices, they must use a variety of reasoning patterns, much like humans. And we stand to learn and gain a lot from each of these types of reasoning and their combination.
The core technique used in Diffblue Cover is reinforcement learning, which is an unsupervised machine learning approach. Supervised learning—of neural networks, for example—has received the lion’s share of attention around machine learning techniques. This is largely because convolutional neural networks and other supervised learning approaches have created solutions for previously unsolved computer science problems like highly accurate image recognition.
Supervised learning is split into two phases: the first is the training phase, where the model is generated by showing it large numbers of labelled examples. In the case of the ImageNet image recognition neural network model, it is trained on labelled images found on the Internet. The second phase is inference, where the trained model is shown a previously unseen input and it returns a prediction. In the case of ImageNet, the input is an image and the model infers a collection of probable image labels from it.
Unsupervised learning, in contrast, has no training phase. Learning takes place in real time as the algorithm searches a space of potential answers to find a probable solution to the problem at hand. Reinforcement learning in the general case uses an agent to find the maximum possible reward. The agent takes an action on the environment, observes what happens (the resulting state) and is given a reward value (a score, if you like). A positive reward indicates that the action improved the state. There’s a strategy function that evaluates the state and reward, and decides the next action. The strategy function seeks to optimize the long-term value.
In Diffblue Cover, we’re searching for the best set of tests we can write that exercise a particular Java method, achieving the best line coverage while also being as human-readable as possible. We do this with reinforcement learning.
Perhaps the most famous example of reinforcement learning is Google AlphaGo, the program that was able to learn to play the game of Go well enough to beat several Go Masters. AlphaGo (and its successor AlphaGo Zero) combines reinforcement learning and neural network approaches, applying each to the areas of the problem where they are the best fit. To learn more about this, check out our webinar: ‘Using Reinforcement Learning to Write Java Unit Tests’, presented by Diffblue’s CEO Mathew Lodge.
AI is fuelling a revolution in the software development world. With demand surpassing current supply, software developers are a precious resource. AI can bring deadlines back on track, make significant changes to legacy code, and decrease time to market for new or iterated code, freeing up valuable coder time to develop new features, instead of writing tests.
If some of the points below describe your business, then adopting AI for Code could be your organization’s next upgrade:
Diffblue’s unique AI tool Diffblue Cover lets a machine do the unit testing tasks that human programmers would rather not do, therefore releasing those resources to improve the firm’s software product.
AI is already making its mark in the automation of test writing. Goldman Sachs and others have already used AI to write Java unit tests and rapidly increase coverage, increasing developer velocity and quality.
To see how Diffblue Cover and AI for Code work in your environment, get a free trial here.