Date:

Boosting Programming Productivity with ChatGPT

Using AI to Turbocharge Your Programming Output

Over the past year, I’ve been experimenting with using ChatGPT to help me write code more efficiently. When ChatGPT helped me find a bug, I realized there was something worthwhile in AI.

Think of AI as a Power Tool

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. However, AI is more like a power tool. Sure, you can use an old-fashioned saw to cut wood, but a table saw goes much faster. Neither tool makes furniture; they simply help you make furniture.

Tips for Getting the Most Out of AI in Programming

  1. 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. But it is extremely good at parsing and processing small, very well-defined sets of instructions.

  2. Treat the AI like a Colleague in a Slack Chat
    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.

  3. Prompt Iteratively for More Complex Routines
    Start with a simple assignment and when that’s been properly written, add more to it, element by element. I simply 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.

  4. Test Every Little Chunk of Code the AI Returns
    Don’t ever assume the code will just work. Patch it into your project and see how it performs.

  5. 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 it does. Remember, it’s okay to let it write code snippets for you as long as you check every single statement and line for proper functioning.

  6. Don’t Need AI Coding Assistance Built Right into Your IDE
    Many coding tool vendors are pitching the idea of integrated AIs right in their tools. Among other things, this enables them to upsell you on the AI features. However, I prefer using ChatGPT for coding as a tool completely separate 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.

  7. 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.

  8. Avoid Asking the AI to Do Proprietary Coding or Use Institutional Knowledge It Doesn’t Have
    AI large language models run off of training data or what they can find on the web. That means they generally don’t know anything about your unique application or business logic. So, avoid trying to get the AI to write anything that requires that level of knowledge. That’s your job.

  9. 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. It 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 worked because the examples I gave it to start helped it understand the context.

  10. Use the AI for Common Knowledge Coding
    I find the biggest benefit from AI code is when I use it to write 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 it to write code for capabilities that come from libraries and APIs, it will save you a ton of time.

Conclusion

In conclusion, AI can be a valuable tool in programming, but it’s essential to use it wisely. By following the tips outlined above, you can get the most out of your AI and boost your productivity. Remember, AI is not a magic genie, but a power tool that can help you make your coding tasks easier and more efficient.

FAQs

Q: What is ChatGPT?
A: ChatGPT is a large language model that can be used for a variety of tasks, including coding, writing, and more.

Q: How do I use ChatGPT for coding?
A: You can use ChatGPT to generate code snippets, rewrite existing code, and even debug code.

Q: Are there any limitations to using AI for coding?
A: Yes, AI is not a replacement for a human programmer. It’s best used for tasks that require common knowledge, popular libraries, and regular practices.

Q: Can I use AI to write unique business logic?
A: No, AI is not capable of writing unique business logic. It’s best used for tasks that require common knowledge, popular libraries, and regular practices.

Q: Can I use AI to rewrite obsolete code?
A: Yes, AI can be used to rewrite obsolete code, making it more efficient and modern.

Q: Can I use AI to write code in less familiar languages?
A: Yes, AI can be used to write code in less familiar languages, making it easier to learn and use new programming languages.

Latest stories

Read More

LEAVE A REPLY

Please enter your comment!
Please enter your name here