Since the launch of ChatGPT in 2022, developers have been split into two camps: those who ban AI in coding and those who embrace it. Many seasoned programmers not only avoid AI-generated code but also prohibit their teams from using it. Their reasoning is simple: “AI-generated code is unreliable.”
Thank you for reading this post, don't forget to subscribe!Even if one doesn’t agree with this anti-AI stance, they’ve likely faced challenges, hurdles, or frustrations when using AI for programming. The key is finding the right strategies to use AI to your advantage.
Many are still using outdated AI strategies from two years ago, likened to cutting down a tree with kitchen knives.
Two Major Issues with AI for Developers
The Wrong Way to Use AI…
…can be broken down into two parts:
- Using the Wrong Interface
When ChatGPT first launched, the typical way to work with AI was to visit the website and chat with GPT-3.5 in a browser. The process was straightforward: copy code from the IDE, paste it into ChatGPT with a basic prompt like “add comments,” get the revised code, check for errors, and paste it back into the IDE. Many developers, especially beginners and students, are still using this same method. However, the AI landscape has changed significantly over the last two years, and many have not adjusted their approach to fully leverage AI’s potential.
- Unrealistic Expectations of AI
Another common pitfall is how developers use AI. They ask the LLM to generate code, test it, and go back and forth to fix any issues. Often, they fall into an endless loop of AI hallucinations when trying to get the LLM to understand what’s wrong. This can be frustrating and unproductive.
Four Tools to Boost Programming Productivity with AI
1. Cursor: AI-First IDE
- Best For: Everyone
Cursor is an AI-first IDE built on VScode but enhanced with AI features. It allows developers to integrate a chatbot API and use AI as an assistant. Some of Cursor’s standout features include:
- Ctrl K: Select multiple lines of code and prompt the chatbot to modify, document, or write new functions.
- Tab: A powerful auto-complete feature for writing code.
- Chat: Discuss the entire codebase with AI, provide context through documentation, images, or URLs.
Cursor integrates seamlessly with VScode, making it easy for existing users to transition. It supports various models, including GPT-4, Claude 3.5 Sonnet, and its built-in free cursor-small model. The combination of Cursor and Sonnet 3.5 has been particularly praised for producing reliable coding results.
This tool is a significant improvement over copy-pasting code between ChatGPT and an IDE.
2. Micro Agent: Code + Test Case
- Best For: Reliable Code Generation
Micro Agent takes a different approach to AI-generated code by focusing on test cases. Instead of generating large chunks of code, it begins by creating test cases based on the prompt, then writes code that passes those tests. This method results in more grounded and reliable output, especially for functions that are tricky but not overly complex.
3. SWE-agent: AI for GitHub Issues
- Best For: GitHub Enthusiasts
Developed by Princeton Language and Intelligence, SWE-agent specializes in resolving real-world GitHub repository issues and submitting pull requests. It’s a powerful tool for managing large repositories, as it reviews codebases, identifies issues, and makes necessary changes.
SWE-agent is open-source and has gained considerable popularity on GitHub.
4. AI Commits: git commit -m
- Best For: Those Who Commit
AI Commits generates meaningful commit messages based on your git diff. This simple tool eliminates the need for vague or repetitive commit messages like “minor changes.” It’s easy to install and uses GPT-3.5 for efficient, AI-generated commit messages.
The Path Forward
To stay productive and achieve goals in the rapidly evolving AI landscape, developers need the right tools. The limitations of AI, such as hallucinations, can’t be eliminated, but using the appropriate tools can help mitigate them. Simple, manual interactions like generating code or comments through ChatGPT can be frustrating. By adopting the right strategies and tools, developers can avoid these pitfalls and confidently enhance their coding practices.
AI is evolving fast, and keeping up with its changes is crucial. The right tools can make all the difference in your programming workflow.