Recent advancements in artificial intelligence (AI) have introduced smart tools revolutionizing coding. They are not intended to replace human engineers but rather augment their capabilities. Sam Babic, the Chief Innovation Officer of Westlake, described these solutions as a "second set of eyes," offering a fresh perspective and valuable assistance in programming.
This article will define AI coding, explore its main benefits and features, and evaluate five notable AI coding tools.
What is AI coding?
AI coding refers to using artificial intelligence to assist developers in writing and reviewing their code with the ultimate aim of enhancing code quality and boosting productivity. This practice is rapidly gaining popularity, as evidenced by a GitHub survey revealing that 92 percent of U.S.-based developers are already leveraging AI coding tools both in and out of work.
Technologies used in AI coding
For a clearer understanding, it's essential to grasp the main interconnected technologies driving AI coding.
Natural language processing (NLP) is a branch of AI that makes machines capable of comprehending human language. It harnesses linguistic principles, statistics, and machine learning algorithms to interpret spoken or written language, going beyond literal interpretations to capture context nuances. With NLP, computers can discern a person's intent and analyze expressed sentiments, much like human perception.
Read our guide to Natural Language Processing, to learn more about NLP use cases, tools, and approaches.
Deep learning, a subfield of machine learning, leverages artificial neural networks that excel in analyzing large volumes of data. Deep learning is capable of handling intricate and complex tasks like speech and image recognition. AI coding tools utilize deep learning models trained on extensive datasets of source code, often derived from open-source projects.
Learn more from our dedicated article on deep learning and the future of artificial intelligence.
Generative AI is, in turn, a subset of deep learning. It relies on unsupervised and semi-supervised learning techniques to build sophisticated AI models that can produce new content based on existing text, images, audio files, or, in our case, code. The idea is to create original works undistinguishable from those produced by a human.
If you want more details, read our article about generative AI models or watch a video, explaining their value to business.
Five use cases of generative AI in business.
Large language models (LLMs) represent a subset of generative AI models with the primary function of predicting the next most suitable word to fill in a blank space in given text based on the context. LLMs are trained on large collections of text data and can be applied to a range of NLP tasks.
For a deeper understanding, read our article to learn more about language models and how they work.
The benefits of AI coding
With AI coding tools on the rise, let's explore their primary advantages.
Boosted productivity. AI coding tools can significantly increase productivity and accelerate code development. They save time by automating repetitive and time-consuming tasks like code formatting and boilerplate code generation. In addition, coding tools with generative AI can provide valuable code suggestions, helping developers overcome writer's block and jump-start the first draft of the new code.
The graph illustrates the improvement in task completion efficiency when using generative AI compared to task completion without generative AI. Source: McKinsey Digital
In a study by McKinsey Digital, developers were assigned tasks of varying complexity with specific time constraints. The results showed that participants using generative AI were more likely to meet deadlines compared to those who didn't apply such tools. In fact, the research revealed that generative AI is especially efficient for tasks of higher complexity, improving productivity by 25 to 30 percent.
Improved code quality. AI coding tools enhance code accuracy by providing real-time suggestions based on industry best practices, identifying issues, alerting on potential bugs or security vulnerabilities, and, in general, acting as a safeguard against common coding mistakes. This helps developers create cleaner and more error-free code.
Empowering non-developers and newcomers. AI coding tools make code development more accessible to non-developers and newcomers. By giving contextual guidance and responding to natural language comments, these solutions simplify programming and facilitate the learning curve. They can serve as mentors, breaking down complex concepts and providing step-by-step instructions. In essence, AI coding tools offer comprehensive assistance for non-developers and foster a supportive learning environment for newcomers.
AI coding tools features
In this section, we present the most common features of AI coding tools, exploring the diverse ways in which AI can contribute to optimizing the development process. Apart from the functionality mentioned here, some AI coding tools are also capable of code refactoring, code documentation, providing explanations, and searching for certain files and code snippets.
AI code completion involves suggesting code snippets as developers type by predicting the next code that is likely to be written based on the context. This reduces manual input, enhances code consistency, and minimizes errors, which is especially valuable for repetitive tasks.
AI code generation is a process that transforms natural language prompts describing the desired functionality into executable code. It comprehends the provided suggestions and then offers contextually relevant code, considering established programming patterns.
Read our article on how to engineer prompts to get the best results with generative AI.
Code translation refers to converting the source code into the desired programming language. It allows you to seamlessly integrate code from different teams within the organization or other open source projects. It can also reduce the effort and expense of updating legacy codebases written in ancient programming languages like COBOL or Ada.
Code review is an evaluation process that harnesses the power of AI to increase code quality by identifying and fixing errors. AI coding tools can also generate comments and explanations in natural language. This makes it much easier to understand the review process, which is particularly beneficial for developers seeking detailed feedback to improve their coding skills.
Moreover, AI tools can evaluate code for consistency and readability to ensure that it adheres to established style guidelines and can be easily understood by other developers.
AI coding tools compared
Here, we provide an assessment of five widely used AI coding tools, considering critical factors that influence their suitability for particular needs. We compared them based on essential criteria such as language support, integrations, functionality, and pricing.
It's important to note that since publicly available sources are primarily in English, AI coding tools will likely work worse in scenarios where prompts are written in other languages or contain grammatical errors.
A general overview of five AI coding tools.
GitHub Copilot: Trained on all programming languages and mastering various coding tasks
GitHub Copilot is an AI pair programmer, meaning that it serves as a coding partner for developers, collaborating with them in real time. It is powered by a generative AI model developed by GitHub, OpenAI, and Microsoft.
Integrations. GitHub Copilot works as an extension of Visual Studio (VS) Code, Visual Studio, Neovim, the JetBrains suite of IDEs, and Azure Data Studio.
Functionality. GitHub Copilot offers autocomplete-style suggestions tailored to the project's context. It analyzes the code written before the cursor, the context of the file being edited, and related files.
The tool has a chat interface called GitHub Copilot Chat that lets users ask coding-related questions and receive responses directly within a supported IDE. Copilot Chat can help with a variety of coding tasks by suggesting code snippets, providing natural language descriptions of code's functionality and purpose, generating unit test cases, analyzing code for potential vulnerabilities, and proposing fixes based on the context of the errors.
GitHub Copilot Labs is a separate extension of VS Code that allows developers to automatically translate code from one programming language to another. Although the outputs may not be flawless, the feature still offers valuable assistance in comprehending the syntax of unfamiliar languages. The extension also provides step-by-step code explanations in a natural language to let developers better understand a program.
Copilot Labs is currently at the stage of a usable prototype intended for experimentation, which means there may be occasional issues.
An example of code translation by Copilot Labs. Source: Dev.to
Pricing. Github Copilot offers two plans. The first, tailored for Individuals, is priced at $10/month per user, granting access to the full spectrum of features described above. The second plan for Business users is available at $19/month per user and includes advanced functionality such as organization-wide policy management and corporate proxy support. There is also a free subscription available to verified students, teachers, and maintainers of popular open-source repositories on GitHub.
Amazon CodeWhisperer: Adhering to security best practices
Amazon CodeWhisperer is an AI-powered coding tool primarily designed to provide real-time code recommendations. It uses LLMs trained on billions of lines of code.
Integrations. Besides VS Code and the JetBrains IDEs like IntelliJ, PyCharm, GoLand, CLion, PhpStorm, RubyMine, Rider, WebStorm, and DataGrip, CodeWhisperer is compatible with AWS Cloud9, AWS Lambda console, JupyterLab, and Amazon SageMaker Studio.
Functionality. Amazon CodeWhisperer provides real-time code recommendations, from single-line snippets to full functions, which are generated automatically based on file contents or in response to natural language prompts. The tool ensures the code aligns with the developer's style and naming conventions. Users can choose to accept the top suggestion, explore more recommendations, or continue writing their own code.
An example of CodeWhisperer suggesting functions to extract the second field from a CSV file and return it in a list, with successful results in testing. Source: Amazon Web Services
CodeWhisperer can also scan code to identify issues and suggest code improvements for swift remediation. Recommendations align with best practices for addressing security vulnerabilities, such as those outlined by Open Worldwide Application Security Project (OWASP) and other similar security best practices.
Here, the user has created code that would write unencrypted AWS credentials to a log. CodeWhisperer has identified the issue and raised an alert. Source: CodeWhisperer User Guide
Amazon states that it previewed CodeWhisperer with a productivity challenge. The results were that participants using CodeWhisperer completed tasks 57 percent faster on average than those who did not use it.
Pricing. CodeWhisperer provides a free Individual Tier plan, allowing you to generate code suggestions and get up to 50 code scans per month. The Professional Tier, priced at $19/month per user, extends to up to 500 code scans per user per month. This plan also provides organizational license and policy management.
Tabnine: Сredible LLMs for code completion and generation
Tabnine is designed to provide a comprehensive AI-assisted development workflow, supporting code creators from concept to completion.
Integrations. The tool is compatible with popular IDEs like Visual Studio Code, WebStorm, IntelliJ, and PyCharm.
Functionality. Tabnine produces real-time contextual suggestions as you code, generates full function completion based on the function declaration, and transforms users' natural language prompts into code blocks. The tool combines universal knowledge with developers’ coding styles.
An example of a user typing a function signature and Tabnine suggesting a block of code. Source: Tabnine
Tabnine highlights the fact that its code suggestions are based on LLMs exclusively trained on credible open-source code with permissive licensing.
Pricing. Tabnine provides a free Starter plan, restricted to code completions of up to 3 words. The Pro plan, priced at $12/month per user, extends the capabilities to whole-line and full-function code completions and natural language-to-code generation. Tabnine Enterprise, available upon request for a customized quote, ensures the highest security and compliance standards and offers support for a broader range of programming languages and IDEs.
Codeium: No dependency on third-party data, APIs, and models
Codeium is an AI coding tool developed by Exafunction. It leverages advanced generative models and deep learning model serving software.
Integrations. The tool can be integrated with all popular IDEs and web editors, such as Colab and Jupyter Notebooks.
Functionality. Codeium offers three standout features: Autocomplete, Chat, and Search.
Prioritizing security, Codeium Autocomplete uses proprietary generative models trained in-house. They are capable of understanding the context of the code and comments in order to generate suggestions on what users might want to type next. There is no dependency on open-source models or third-party APIs.
Codeium Chat combines open-ended conversation with IDE context. It can convert natural language comments into lines of code and code blocks. Codeium Chat can also translate entire functions from one programming language to another, offer code explanations, and perform code refactoring. It currently uses a mix of its own proprietary Chat model and third-party OpenAI APIs. The feature is available in Codium’s VSCode and JetBrains extensions.
An example of Codeium Chat answering a prompt asking to write a function to generate a UUID. Source: Codeium Chat
Codeium Search aims to simplify the process of finding files and code related to a developer's intent. Users can ask their codebase natural language questions, and, in response, Codeium pulls out relevant files and code snippets. Currently, the feature only works on VSCode and operates on Python, JS, TS, and Go files.
Pricing. The Individual plan is free and includes all fundamental features. Teams plan starts at $12/month per user and has added benefits like advanced personalization and an admin usage dashboard. The Enterprise plan is available with a custom quote and includes priority support from the Codeium team, along with SaaS and self-hosted (on-prem or VPC) deployments.
ChatGPT: General-purpose solution with the ability to simplify coding
ChatGPT, created by OpenAI, is an LLM-based chatbot that understands and generates natural language text considering the input it receives. Among other things, it can assist with coding and programming-related tasks.
Integrations. Unlike specialized AI coding tools, ChatGPT is not pre-integrated with popular IDEs. To utilize it, you can copy and paste the information or code the tool provides into your IDE manually and vice versa. Another option is to install a ChatGPT extension to your development environment using OpenAI APIs.
Functionality. ChatGPT can suggest code snippets, variable and function names, and method calls based on the code the user has written so far. While it also generates code for the given task, the result will largely depend on the quality of text prompts you give.
An example of ChatGPT generating code for a simple prompt asking to provide a Python function that calculates the sum of two numbers.
Besides that, ChatGPT reviews code for bugs and vulnerabilities, spotting syntax and logical errors, code style violations, and security issues. It compares the code against standard coding guidelines and provides suggestions for improvements.
ChatGPT can also convert a piece of code to other programming languages or explain its logic, functions, and overall structure. Additionally, the tool gives you a helping hand in code documentation, providing guidance on how to write clear and concise comments.
Pricing. GPT-3.5 is available for free. With a $20/month subscription to GPT-4, you gain access to a faster response speed and the most capable model that provides more comprehensive and coherent responses. It's worth mentioning that GPT-4 is currently constrained to 25 messages every 3 hours.
Room for growth
AI coding tools offer significant benefits, including increased efficiency and productivity for developers and ensuring a reduced learning curve for newcomers to the field. However, it's important to remember that AI coding is still evolving, and a complete understanding of its potential and limitations may require several more years of exploration.
One crucial aspect to highlight is the necessity of reviewing code suggestions and responses created by AI coding tools. Despite the advancements in accuracy, AI coding outputs can still contain errors and require human intervention, especially in complex or critical tasks.
Several factors influence the accuracy of AI coding tools, such as task complexity and the choice of programming language, as the accuracy is higher for popular, widely used programming languages. It's essential for developers to assess and validate AI-generated code just like they would review code created by other specialists.
For example, Stack Overflow's moderators noticed an issue with inaccurate responses produced by ChatGPT. These responses, while appearing plausible on the surface, often turned out to be faulty. To prevent the platform from being flooded with incorrect AI-generated responses, StackOverflow temporarily blocked answers generated by ChatGPT and other similar technologies.
AI coding continues to evolve and is expected to provide greater accuracy in the coming years. As it advances, developers should continue to harness the power of AI while carefully assessing the quality and accuracy of the code generated.