Software Development can have moments of writing repetitive code. Following the DRY principle can help avoid this, but sometimes one block of code isn’t doing the same thing as another, although it is doing something similar (such as mapping objects in a collection). In these cases AI can be a helpful aid, but it does have drawbacks too!
The Good – AI Accelerated Development
Artificial Intelligence and Machine Learning have been applied to these kinds of problems for a while, and now they are being applied to improve developer productivity. AI-assisted developer tools can help to speed up the development process by making code suggestions, highlighting major changes as part of a code review or by detecting possible errors (such as providing method parameters in the wrong order).
Microsoft have been experimenting with adding AI assistance to software development since the release of Visual Studio IntelliCode in 2018. This Visual Studio extension aims to improve the developer experience by providing more “common sense” suggestions for the code being written. Some examples are, suggesting changes to ensure a consistent code style and changing the order of suggested methods and properties from IntelliSense to reflect how likely you are to use them.
GitHub (owned by Microsoft) has also recently released a technical preview of GitHub CoPilot, which is described as an “AI pair programmer”. This provides AI assistance to complete the writing of repetitive code (such as mapping between two objects), helping write tests, or even suggesting entire methods based upon the name you start typing or a comment describing the desired result.
These AI-based tools have the potential to make software development a faster and easier experience. They can reduce the repetitive elements of coding and potentially be used to assist individuals new to programming. This may be through suggesting improvements to code which has been written, such as ways to make it more efficient. However, there are some potential downsides to these tools at the moment.
The Bad – Undesirable Code
Applying artificial intelligence to solve problems isn’t a new concept, and it is important to acknowledge some of its limitations. AI systems can replicate unwanted bias which may exist in the machine learning training data.
In the case of AI-based development tools, they often use publicly available code for training data. As a result, they can replicate bad coding practices as well as the good ones. This can lead to them suggesting insecure code, code which contains bugs, or other undesirable consequences.
There has also been speculation that GitHub CoPilot (and similar tools) will reproduce secret or personal information if it is prompted in the right way. Although these secrets would have already been public, a tool such as CoPilot definitely improves the chances of it being discovered. In fact, it could be actively recommended to a developer.
The Ugly – The Legal (or Ethical) Side
There are also potential legal and ethical aspects to consider with how the model for the AI has been trained. GitHub says that CoPilot was trained using information available from publicly available sources. This would mainly consist of publicly available examples and public repositories hosted on GitHub.
The ugly part is, if the code which formed part of the training data is licensed to require any derivate work to also be freely released (such as under the GPL license), is the resulting AI model required to be open sourced?
There is also the possibility that code could have been leaked or released online without the original authors’ permission. In this case, would it be fair and reasonable for this to be used in the training of the AI model? Especially with the risk that the AI could suggest an exact reproduction of that leaked code?
AI-assisted software development is definitely an area that looks like it is here to stay. It has the potential to lower the barrier of entry to software development and increase automated code generation. This would certainly make developers more productive and make writing software easier.
However, there is also the possibility that AI tools can make bad recommendations. These could be minor bugs in functionality or security vulnerabilities which could then be exploited. This would be a risk for any developer, but could be especially risky to developers who are just starting out.
Software developers can certainly benefit from AI-based tools, however, I am sure there will be some interesting ethical debates over the data used to train them in the future.