In the near future, AI and robots will replace humans in most jobs. Until recently I thought programming would be one of the last jobs where humans would be replaced, but I don’t think so anymore.
AI-based static analysis
AI will soon find its way to help us in everything we do. Today, computer programming has lots of challenges, writing correct and bug-free programs is hard. However, I would not be surprised if there was already a startup developing a new AI-based static analysis tool to aid programmers.
We already have all the technology needed to create such tool for, let’s say, C++, or any other programming language for that matter. Here is how such tool could be crafted:
- The source code can be turned into an abstract syntax tree, in case of C++ libclang can be used for that with little effort.
- The AST can then be fed into a neural network. A library like cuDNN can be used to build such network.
- Github is a trove of source code, which can be used to train the network.
- The real innovation and the main challenge is annotating the source code with issues which the network should detect. Initially, this could be done using existing static and dynamic analysis tools, like Coverity, valgrind or sanitizers.
- The output from the neural network would just highlight issues in the source code.
The tool could be available from the command line and it could be integrated with IDEs.
The static analysis tool described above could be further improved in several ways.
If fed with a single function as input, the tool would produce output only relevant to that function. When more context was given, e.g. a file or an entire program, the tool would detect more types of issues.
It would be easy to extend it to accept AST for more programming languages. Eventually, the neural network would be able to recognize problems in programs written in any programming language.
The output could be enhanced beyond just highlighting errors. The neural network could produce one or several proposed fixes for the problems found. At some point, the tool should also be able to select and apply the fixes automatically.
An even more interesting enhancement would be extensive code refactoring. This would require the tool to recognize problems with the design.
In a more advanced version of the tool, a human programmer would only be writing the outline for the program and our tool would be filling up the functions with code and fixing any issues in the design. Eventually, the “programmer” – actually the user (e.g. grandma), would describe what is needed using words, and the tool would generate the program directly in the machine code form, no intermediate code would be necessary.
In an even more futuristic setting, such tool could also work with an advanced 3D printer, and produce a design of a chip to print for the printer.
Do you think programming as a job for humans has a future?