Bayou - AI To Help You Code
Written by Mike James   
Wednesday, 02 May 2018

Programmers tend to imagine that we will be last to be displaced by AI - after all we are part of the team actually making this stuff! In fact, we are likely to see AI programming assistants sooner than you might expect. Bayou is a case in point and you can try it out now.


Researchers at Rice University have used deep-learning using TensorFlow to learn how to generate complete methods from partial implementations. It only works with Java at the moment, but this is just a matter of training. You sit down with Bayou and type in a draft of a Java method of the sort you might write if you couldn't quite remember the API and didn't have time to look everything up. The resulting draft would have "holes" in it where you couldn't write the code. If you provide some clues as to what might go into these holes Bayou willl attempt to fill in the gaps.

At the moment Bayou can only fill in one hole per method, but it can be extended to cope with more. The clue that you have to provide is either an API method call or a data type that you want the generated code to use.

The example given in the documentation is:

public class Test {
    void read(File file) {
            /// call:readLine


The /// is the notation used to tell Bayou that this is a query - how do I use readLine to fill in this method?

In this case Bayou is highly likely to generate, as the body of the method:

      FileReader fr1;
      BufferedReader br1;
      String s1;
      try {
        fr1 = new FileReader(file);
        br1 = new BufferedReader(fr1);
        s1 = br1.readLine();
      } catch (FileNotFoundException _e) {
      } catch (IOException _e) {

You can taylor the generated code by leaving multiple API queries:

/// call:readLine call:close

In this case you would get the same code but now the file would be closed for you.

You can see that it isn't an intelligent coder, but it does try to fit in with what you are suggesting and it saves you generating a lot of almost boilerplate code.

You can see Bayou in action in the video:


You can also try it out for real at the Bayou site and you can  join in with its development at GitHub. It is an open source project under the Apache 2.0 licence. It is also the result of a DARPA initiative to make programming easier and less error prone.

Look out for more and better AI tools to help us program. If you are still coding with emacs and think that the command line is the only way to work, it is time to move into the new century. We can do more with AI tools than a command line prompt. We cannot hope to code everything from scratch in the future and AI assistants and programming buddies are the way that we can get the help we need to navigate the ever-increasingly complex world of APIs, frameworks and complete systems.


More Information


Neural Sketch Learning for Conditional Program Generation

Related Articles

Ubisoft Applies AI To Code

DeepMind's Differentiable Neural Network Thinks Deeply

Neural Turing Machines Learn Their Algorithms

Learning To Be A Computer

AI and Games Pioneer, A L Samuel

The Malmo Challenge - Collaborative AI

Google's DeepMind Learns To Play Arcade Games


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.



Final Date For VBScript Announced - What It Means

Microsoft has announced the official end of VBScript following years of reduced support. VBScript is one of the variations Microsoft created based on the original VB, and it has la [ ... ]

Kotlin 2 Released With Multiplatform K2 Compiler

Kotlin 2.0 has been released. The new version is a major update with improvements including a stable K2 compiler, which is multiplatform from the ground up, and according to JetBrains understands your [ ... ]

More News

C book



or email your comment to:


Last Updated ( Wednesday, 02 May 2018 )