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.

bayoubanner

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:

1
2
3
4
5
6
7
8
import java.io.File;
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) {
      }
      return;

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.

bayouicon

More Information

Bayou

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.

 

Banner


Golang Back In TIOBE Top 10
21/02/2024

Google's system language Go is ranked #8 in the TIOBE Index for February 2024. This is the third time it has entered the Top 10. However, it is now in the highest position it has ever had to date.



Pi Day - The Great Unanswered Questions
14/03/2024

It's Pi day again, again, again... Even after so many, I still have things to say about this most intriguing number. The most important things about Pi is that it is irrational and one of the few tran [ ... ]


More News

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

 

Last Updated ( Wednesday, 02 May 2018 )