15. AI-Assisted Coding

15. AI-Assisted Coding

🎯

Learning Goals

  • Integrate AI assistance into a JavaScript project
  • Describe the potential pitfalls of using AI-suggested code and how we might avoid them
📗

Technical Vocabulary

  • AI-assisted coding
  • Debugging
 

What is AI-assisted Coding?

AI-assisted coding means using AI tools (like ChatGPT and GitHub Copilot) to assist with writing, debugging, and improving code. In this curriculum, we’re going to use CodeSandbox’s Codeium to assist us in our coding.

Turning on AI-Assisted Coding in CodeSandbox

Similar to large language models like ChatGPT, CodeSandbox’s predictive code completion model, Codeium, uses machine learning to make predictions and suggest relevant completions.
  1. Your Sandbox needs to be a Devbox. Convert it into a Devbox by clicking the button next to Fork and select Fork as Devbox. Click Convert. This may take a few minutes.
    1. notion image
  1. Go to your workspace settings. Choose a workspace. Click Permissions and make sure your AI permissions are enabled.
    1. notion image
  1. Open your Devbox from earlier. Click the square in the upper left-hand corner. Select Settings. Toggle Code completion by Codeium to be on.
    1. notion image
There are a few things to consider related to using the predictive code completion tool:
  • The suggestions aren’t always accurate. As we know, machine learning models are really fancy prediction machines based on past data and they won’t always correctly predict what you’re trying to do. Be sure to review any suggested code carefully before accepting it.
  • It can be distracting. Some developers find predictive completion helpful, while others find it intrusive. Pay attention to how it affects your workflow over the next few lessons and decide if it’s beneficial for you.
  • Suggestions may not follow best practices. While the suggestions can speed up coding, they might not always align with best practices or the most efficient solutions. Always double-check for readability, efficiency, and adherence to coding standards.
Ultimately, predictive code completion in CodeSandbox is a tool that can enhance your workflow, but its usefulness depends on the complexity of your project and your personal coding style! As you work through the next capstone project, take note of how it impacts your efficiency and decide whether it’s a feature you want to keep enabled.
page icon
For a summary of this lesson, check out the 15. AI-Assisted Coding One-Pager!
Â