Getting the Most Out of Your AI Programming Partner
As a programmer, I’ve been experimenting with using ChatGPT to turbocharge my coding output for over two years. When ChatGPT helped me identify a troubling bug, I realized there was something worthwhile in artificial intelligence (AI). Many people I talk to think that AI is a magic genie that can manifest an entire program or app out of a single, barely-formed wish. Here’s a much better analogy: AI is a power tool.
Tips for Getting the Most Out of Your AI Partner
-
Give the AI lots of small jobs: The AI doesn’t handle complex sets of instructions well, especially if you expect it to do product design. However, the AI is extremely good at parsing and processing small, well-defined instructions.
-
Think of the bot as someone at the end of a Slack conversation: Rather than the pacing that might come from an email back-and-forth with a colleague, which might have each interaction separated by hours, imagine you’re in a Slack chat where each interaction is much smaller, but separated by seconds.
-
For more complex routines, prompt iteratively: Start with a simple assignment and, when that’s been properly written, add more to it, element by element. I cut and paste the previous prompt, adding and removing bits of the prompt, as I get chunks of code that work for what I’m looking for.
-
Test every little chunk of code the AI returns: Don’t ever assume the code will work. Patch the code into your project and see how it performs.
-
Use the debugger: For a more in-depth test, don’t hesitate to drop into the debugger and walk through the code generated by the AI step-by-step. Watch the variables and exactly what the AI does. Remember, it’s OK to let it write code snippets for you as long as you check every statement and line for proper functioning.
-
You don’t need AI coding assistance built right into your IDE: Many coding tool vendors are pitching the idea of integrated AIs in their tools. Among other things, this approach enables them to upsell you the AI features. However, I prefer using ChatGPT for coding as a separate tool from my development environment. I don’t want an AI to be able to reach into my primary coding environment and change what’s there.
-
Feel free to cannibalize lines of code from generated routines: You don’t always have to use everything the AI produces for you. In the same way that you might go to Stack Overflow to look for code samples, and then pick and choose the lines you want to copy, you can do the same with AI-generated code.
-
Avoid asking the AI to do proprietary coding or use institutional knowledge it doesn’t have: AI LLMs run on training data or what they can find on the web. That means they generally know nothing about your unique application or business logic. So, avoid trying to get the AI to write anything that requires this level of knowledge. That’s your job.
-
Give the AI examples to work on so it understands the context of your code: I gave ChatGPT a snippet of an HTML page and asked it to add a feature to expand a block of text. The AI gave me back HTML, JS, and CSS. I later asked it for an additional CSS selector and then asked it to justify its work, whereupon it explained to me why it did what it did. All of that process worked because the examples I gave the AI helped it understand the context.
- Use the AI for common knowledge coding: The biggest benefit of AI is writing blocks of code that use common knowledge, popular libraries, and regular practices. The AI won’t be able to write your unique business logic. But if you ask the AI to write code for capabilities from libraries and APIs, it will save you lots of time.
Conclusion
In conclusion, AI is not a magic genie that can manifest an entire program or app out of a single, barely-formed wish. Instead, it’s a power tool that can help you write code more efficiently and effectively. By following these tips, you can get the most out of your AI partner and unlock its full potential.
FAQs
Q: Can I use AI to write unique business logic?
A: No, AI should not be used to write unique business logic or the core of what makes your code unique. This could lead to ownership issues.
Q: Can I use AI to write code for internal company use?
A: Yes, AI can be used to write code for internal company use, but be sure to check with your company about the legal issues of code generated.
Q: Can I use AI to write open-source code?
A: Yes, AI can be used to write open-source code, but be sure to follow the guidelines and licenses of the open-source community.
Q: Can I use AI to write code for a specific programming language?
A: Yes, AI can be used to write code for a specific programming language, but be sure to specify the language in your prompt.

