Artificial Intelligence and Coding: Future or Present?

AskJarvis_EXM

State of the art considerations regarding tools and knowledge on the integration of artificial intelligence and coding

It’s very easy to imagine an artificial intelligence (acronym: AI) that can program, or even program and modify itself as it likes. This collective imagination comes from numerous movies or books on the subject, but also from the simple fact that since AI is developed in some way through code, many people connect the two, assuming that AI is particularly well versed in the foundations from which it was created.

But, then, can an AI really program? The answer is YES*.

The asterisk is a must: despite some incredible developments in the field brought about by technologies such as OpenAI, whose AI can write some simple programs from the description of how they work, in truth we are still a long, long way from developing an AI that can program anything remotely complex.

In general, AIs are very good at learning to perform simple, repetitive tasks or tasks with strict rules, but the same cannot be said about creative jobs (although some very recent developments such as Google’s recent AI, Imagen, may make one reconsider this claim). I will not dwell on this topic as it has already been blogged about by a colleague of mine and you can find the article here.

Is it therefore not possible to use AI for this purpose?

Since the future of coding, at least for the time being, does not lie in AI, developers have seen fit to find an easier and more suitable task to entrust to it: assisting the developers themselves in writing code.
AI can assist the developer in a number of ways: writing code directly or even simply helping the developer understand parts of the code he or she is working on (in this regard, an interesting statistic to show is that programmers spend about 58 percent of their time on code understanding activities).
Many tools are springing up for this purpose, we at Ex-Machina have recently started experimenting with using one of them: askjarvis.io

This tool helps the developer by proposing code starting with a small description in natural language (in English).
 The tool is also able to generate tests or documentation for already written code.
The experience was quite positive, but it also showed decise limitations that are inherent in the methodology proposed by the tool or, surprisingly, from the fact that, learning from humans, even code written by AI contains errors and oversights that can be difficult to detect.

Specifically:

  • The code generated from its description is often very accurate
  • Automatic test generation can be very convenient, especially to get an idea of possible tests or a skeleton of the code
  • In certain situations, it reduces the time the developer would have to spend documenting to write the same code
  • Great for small and specific parts of code

Some downsides:

  • Long or complex code generated by the tool is not usable
  • Code is not “customized”: it often does not follow the developer’s style and therefore “clashes” with the rest of the code.
 The developer must, therefore, rewrite all or part of the proposed code
  • The generated tests are, at times, too imprecise and/or extravagant
  • Code cannot be accepted “blindfolded,” it is important, especially for parts of the code that are sensitive or related to program safety, to read carefully and possibly correct possible errors in the code

A rather positive experience, then, but one that immediately leaves plenty of room for improvement that only time or new technologies can bring.

Are there other tools with similar functions?

Dozens. Other tools or approaches to the problem exist, each with its own pros and cons. 
In my dissertation I worked on such a tool: a plugin for a development environment that offered the possibility for the developer to search for small parts of code from an English description. The idea was to prevent the developer from constantly changing environments (e.g., between browser and development environment) by offering code parts “on the fly.” The approach used here was not based directly on AI, but more on a search engine based on a huge database of <code, description> pairs automatically extracted from open source code.  Comparing my approach with other tools that existed at the time, I noticed that the pros and cons were, often, common: excellent ability to produce small and precise code resulting in reduced time spent, but great inaccuracy for complex or uncommon code (e.g., employed in precise contexts or for little-used features) with added need to verify correctness and/or adapt the generated code to one’s needs. Another similarity with other approaches, particularly based on Machine Learning, is that a larger database to build on inevitably leads to better results.
This is a feature that, personally, I find very interesting: this kind of approach could virtually lead to 99.9 percent perfect and accurate results if it only possessed enough data on which to rely. Unfortunately, this is an incredibly large amount of data that is almost physically impossible to accumulate. AI being able to improve with each piece of code served and assimilated also means that, the same approach projected 10 years into the future will bring significantly better results without any external changes being made, but, simply, by having more data at its disposal.

In conclusion

It’s difficult at the moment to predict future, ever-faster developments in AI and consequent technologies, but, we can say with certainty, that an AI capable of programming large projects independently is still a long way off.
 Instead, many tools are emerging with the aim of helping developers, but it seems certain that, while they can help save time, they also present a number of problems, unfortunately, that are not yet negligible.

Share this post on