At MetaCTO, we use Ai for writing software code every single day. That’s why we have a whole team of 10x developers ;)
However, generative Ai won’t write a whole app for us, and most out-of-the-box autocompletes in IDEs get it wrong more often than they get it right.
The key is picking the right tools and asking the right questions.
The easiest place to start is with ChatGPT on OpenAI. As simple as it is, this remains one of the best tools we have. It’s great at answering questions about code and generating code from short prompts like “write me a function in Python that takes 2 arrays and returns the intersection.”
Next is your IDE. This is an obvious place because it’s where we’re writing code.
Microsoft’s GitHub Copilot and Amazon Q Developer both have plugins for the most common IDEs like JetBrains, VisualStudio, and Xcode. They’re a great start, but we find the UX still a little cumbersome and the autocomplete recommendations are wrong just as often as they’re helpful.
Then there are more purpose-specific software.
We use the Cursor AI code editor. It’s a fork of Visual Studio IDE with direct integration to OpenAI ChatGPT-4. The tightly coupled UX, OpenAI’s latest model, and the IDE project context make it the most effective Ai coding tool we’ve found to date.
We’d also give an honorable mention to qodo, formerly Codium AI, which is doing really cool things with local model tuning and query context based on recent and local files to generate better and quicker code responses. But the UX of their plugins could still use some work.
Asking the Right Questions
As we mentioned before, Ai won’t write your whole application. But if we know the right questions to ask, it will cut out hours of research and development time.
Here are our favorite ways to use Ai and GPT to generate code and work faster.
Refactoring
Ai can rewrite code when we have a new use case or need it in a different format.
Examples:
- Turn this class into functional code
- Rewrite this method to take an array of objects with name properties, in addition to plain strings.
- Abstract this CSV reader into a reusable data processing class.
Writing Documentation
We’ll do this for code we’re writing or as the first step when taking over an old file that someone else wrote.
Examples:
- Write KDoc/MD description and arguments for this function/class.
- Write a markdown file explaining how to run this app locally.
Library Documentation and Best Practices
We love this feature in the Cursor IDE. When generating code or using the Ai chat, we can add documentation for new libraries by importing the docs URL, then ask and learn the “correct” way to implement those framework patterns.
Examples:
- Can I implement infinite scrolling with a Kotlin RecyclerView?
- How can I implement Google Maps in an iOS view with Swift?
- Add a Stripe payment form to this iPhone app donation view.
More Efficient Code
GPT coding is the death of leetcode. There’s virtually no code we can write that Ai can’t write more efficiently. Anytime we’re looking at space-time complexity in our code, we give it a once-over with Ai.
Examples:
- Help us batch and debounce calls to our server API on frequent UI input.
- Can we write this SQL subquery more efficiently?
- Replace this nested loop with a hashmap lookup to eliminate O(n^2) complexity.
Stubbing Out New Files
Using Ai to stub out new files can save a lot of time and keep file structures more consistent across a project.
Examples:
- Write an ETL class in Python.
- Create a new ViewController class with UIKit.
Searching Your Own Codebase
One of the coolest parts of IDE integration is being able to search with the context of our whole codebase and ask questions. This is especially useful when jumping into a large project for the first time.
Examples:
- Where are the routes configured for this app?
- Where should we add a new component file for a custom form?
- Is there already a standard Button component defined in this codebase that we should use?
Conclusion
While Ai can’t write a whole app or project for us, it can definitely make us better developers today.
Ai in software development is moving at a lightning pace. If we want to be among the developers who grow with Ai, we must keep trying new things. Try new IDEs and plugins. Ask new questions. Ask the same questions we asked last month to see how the models are changing.
In the future, Ai might be writing whole applications for us. But today, knowing the right tools and the right questions will make us better developers and truly transform the way we work.