|Google Adds Code Generation To Bard|
|Written by Kay Ewbank|
|Wednesday, 26 April 2023|
Google has announced that its Generative Pre-trained Transformer (GPT) Bard now has the ability to generate programming code, and to debug and explain existing code.
There are a few AI code assistants out there - Copilot, Codex, Bayou and CodeWhisperer to name just the best known, but Google's Bard hasn't been promoted as such until now.
When we asked Bard how you can use it to help with coding, it said we could ask it to generate code, as an example
"you could ask me to generate a function that takes two numbers as input and returns their sum".
Another option was to ask Bard to debug code
"For example, you could ask me to find the error in a piece of code that is not working correctly."
You can also ask Bard to explain code. To test this out, we gave it some code from the extracts from Programmer's Python Async on process based parallelism elsewhere on the i-programmer website:
import multiprocessing def myProcess(): while True: pass if __name__ == '__main__': p0=multiprocessing.current_process() p1=multiprocessing.Process(target=myProcess,
and it responded with:
The code you have provided is a simple example of how to use the
I then tried it with some SQL, asking what was wrong with the query:
SELECT user_id, first_name, last_name, class, COUNT(*) AS total_students FROM students GROUP BY class HAVING class IN ('JSS1')
The answer correctly suggested that the query is missing a WHERE clause, as the HAVING clause is only used to filter the results of a GROUP BY query, but it cannot be used to filter the rows that are selected before the GROUP BY operation is performed. There was more detailed explanation, and the suggested improvement was:
Some commentators have suggested that Bard's programming abilities aren't real, but based on my afternoon of testing, it's a lot better than that. The Bard site says that "Bard is still an early experiment, and may sometimes provide inaccurate, misleading or false information while presenting it confidently. When it comes to coding, Bard may give you working code that doesn't produce the expected output, or provide you with code that is not optimal or incomplete."
I'd recommend you sign up for the experimental version and try it out - Bard may surprise you. The age of AI coding assistance is here and Bard is the latest member. Will it soon be the age of the AI coder?
or email your comment to: email@example.com
|Last Updated ( Wednesday, 02 August 2023 )|