Coding Support with Brad

Dharshitha Senevirathne
5 min readJun 29, 2023

--

Brad is a large language model (LLM) chatbot developed by Google AI. It is trained on a massive dataset of text and code, and can generate text, translate languages, write different kinds of creative content, and answer your questions in an informative way.

How Does Brad Work?

Bard works by using a technique called neural network programming. Neural networks are a type of machine learning algorithm that can learn to perform tasks by example. In the case of Bard, the neural network is trained on a massive dataset of text and code. This dataset includes books, articles, code repositories, and other forms of text.

When you ask Bard a question or give it a prompt, the neural network uses its knowledge of the text and code in the dataset to generate a response. The response is not always perfect, but it is often very good. Bard can also be used to generate creative content, such as poems, code, scripts, musical pieces, email, letters, etc.

When it comes to coding, Brad can:

  • Generate code from natural language descriptions. For example, if you ask Brad to “write a function that calculates the factorial of a number,” it will generate the following code:
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)p
  • Answer questions about code. For example, if you ask Brad “what is the difference between a function and a class?” it will provide a detailed explanation of the two programming constructs.
  • Translate code from one language to another. For example, if you ask Brad to “translate this Python code to Java,” it will generate the equivalent Java code.

Common Features for Coding Support

Like almost all the AI tools, Here are some common features that Brad provide.

  1. Syntax highlighting: Format and highlight code snippets to improve readability and help identify syntax errors. It can handle various programming languages such as Python, JavaScript, Java, C++, and more.
  2. Code completion: Suggest completions as you type, based on the context of your code. It can help you with function names, variable names, class definitions, and other relevant code elements.
  3. Documentation lookup: Provide information about functions, classes, libraries, and frameworks by looking up documentation. It can fetch descriptions, usage examples, and parameter details to help you understand and utilize different code elements.
  4. Error handling: If you encounter an error in your code, these AI tools can assist in diagnosing the issue. It can provide suggestions or explanations to help you troubleshoot and fix common coding mistakes.
  5. Code refactoring: Assist in improving the structure and efficiency of your code. It can provide suggestions for refactoring, optimizing algorithms, or adopting best practices to enhance your codebase.
  6. Language-specific assistance: Has knowledge about various programming languages and their specific features. It can offer language-specific guidance, such as Pythonic coding style, JavaScript event handling, or Java class inheritance, to help you write idiomatic code.
  7. Algorithmic assistance: Help you with algorithm design and problem-solving. It can provide guidance on selecting appropriate data structures, optimizing algorithms, or approaching specific coding challenges.
  8. Code snippets and examples: Generate code snippets or provide examples to illustrate concepts or solve specific coding problems. These examples can serve as starting points or references for your own code.Nowadays we see many AIs support coding. Usually, they provide following features.

Extra Features

Here is an example of a simple build issue I was having. Both ChatGPT and Brad gave reliable answers. However, there was extra help from Brad.

  • No registration required
  • Links to potential answers
  • Googling support
Example result

Comparison

For this let’s take ChatGPT which is arguably the most popular language model chatbot that can also generate code. However, there are some key differences between Brad and ChatGPT when it comes to coding support.

  • Brad is trained on a dataset of text and code that is specifically designed for programming tasks. This means that Brad is more likely to be able to generate accurate and efficient code than ChatGPT, which is trained on a more general dataset of text.
  • Brad can generate code from natural language descriptions. This means that you can ask Brad to write code without having to know the specific syntax of the programming language you are using. ChatGPT, on the other hand, requires you to provide the code in the correct syntax.
  • Brad can answer questions about code. This can be helpful if you are stuck on a coding problem or if you need to learn more about a particular programming concept. ChatGPT, on the other hand, is not as good at answering questions about code.
  • However, I don’t see a feature in Brad to store the previous queries like in ChatGPT.

Releases

Bard is still under development, and there are no official releases yet. However, there are a number of different versions of Bard that are available for testing and experimentation. These versions are typically named after their internal codenames, such as “LaMDA” and “Meena.”

The different versions of Bard vary in terms of their size, training data, and capabilities. For example, some versions of Bard are trained on a larger dataset of text and code than others. This means that they can generate more comprehensive and informative responses. Other versions of Bard are specifically designed for certain tasks, such as coding or translation.

As Bard continues to develop, new versions will be released with improved capabilities and performance. These releases will be made available to the public through various channels, such as the Google AI website and the Google Play Store.

Here is a table of some of the different versions of Bard that have been released so far:

Releases

Conclusion

Overall, Brad seems to be more powerful and versatile tool than ChatGPT when it comes to coding support. This is because Bard is trained on a larger dataset of code and documentation, and it uses a more powerful language model. However, Brad is still in a experimental phase. Therefore, as developers let’s keep using these AI tools because they can help to improve productivity, save time, and reduce the number of errors in code.

--

--

Dharshitha Senevirathne

Senior Software Engineer | Helping folks interested in software engineering, data science, and cloud technologies.