ChatGPT as a development tool? Yes, if used judiciously
Despite the concerns of many programmers about ChatGPT and other generative AI making our profession irrelevant, the software industry will always need skilled human developers to solve hard problems. I’m certainly not ignoring ChatGPT’s ability to generate solid code. It definitely can. But, it’s not anywhere near ready to produce code without human supervision. Its developers are working to improve its accuracy, but ChatGPT currently has a hallucination problem, where it creates content -- including code -- that may look good at a cursory glance but isn’t actually correct.
That said, in the hands of an experienced programmer, ChatGPT can be a powerful development tool that significantly reduces the amount of time it takes to develop a solution. Note, "experienced" is not a throwaway adjective here. For code generation, ChatGPT is a tool that novice developers should employ carefully. You need good instincts for discerning what’s well-formed code and what isn’t, and those skills grow with years of development experience.
Think of it this way. Every developer has taken code from Stack Overflow and other development forums, but no sensible technologist commits that code to their own projects without ensuring it works and doesn’t contain superfluous nonsense. In fact, ChatGPT could very likely provide a modified version of code that appears on these very sites!
But the great thing about ChatGPT is that you don’t have to waste time searching through multiple forums to find the code that you want because you can simply ask it to generate exactly what you need. The code should be evaluated by seasoned eyes, of course, but ChatGPT’s code is great for creating a framework on which developers can build.
Now, you can’t just ask ChatGPT to create code for a complex backend payment system. The AI would balk at such a huge request. ChatGPT is best at generating code snippets for discrete, simple, repetitive tasks. The more complex the request, the more likely it is to give you unhelpful answers.
Coding Use Cases for ChatGPT
So, what is it good for? Creating data connectors, for starters. That’s a great use case: a specific request for fairly simple code that we all produce all the time in nearly every project we undertake. It’s also a fine tool for training. Not familiar with how to create higher-order functions in a specific language? Ask ChatGPT to provide an explanation along with two examples. Strong in Python but just getting started with Ruby? You could begin by typing into the prompt, "Explain class inheritance in Ruby and provide a few examples."
A great use case for ChatGPT is creating documentation because while it’s a critical part of the development process, most developers don’t relish doing it. Don’t ask it to document bespoke, complex code, because you’re unlikely to get a good result. But for documenting routine, uncomplicated code, such as a connector’s normal inputs and outputs, ChatGPT is more than up to the task. Proof it, of course, but even if you have to make some corrections here and there, it’s far faster than starting from a blank screen, and you can use that time to do what you enjoy doing most: tackling hard problems and creating solutions.
After using ChatGPT frequently over the last six months, below are some best practices to help get the most out of the solution.
- Know the shape of what you’re trying to get out of ChatGPT:You must be able to identify whether the code ChatGPT generates will work properly for the function you want it to do. It’s not safe to use the code it creates if you lack the experience to evaluate it.
- Write specific prompts that include the context of what you need: The more specific the request, the more likely you are to get what you need, and the more context you provide, the better the chance you’ll receive it in the proper format. For example, you might see, "I’m building an application in Ruby, and I’m a programming assistant. I need to connect my application to a Postgres database that is hosted in AWS. Give me a connection string, substituting connection parameters with curly braces. I’ll ask additional questions if I need more."
- Don’t include sensitive or proprietary information: According to the ChatGPT FAQ, unless you’re using the API to access the AI, they can use anything you put in a prompt for future training, and that means your sensitive information and data could end up as a response to someone who shouldn’t see it. But even if you’re using the API, best practice is that you’re better safe than sorry. Don’t do it.
ChatGPT is a powerful tool in the hands of the right developer. Just make sure you’re using it safely by checking its outputs for accuracy and keeping sensitive information out of your prompts. Used properly, it can vastly speed the creation of simple, routine code and documentation, giving coders more time to spend cracking the hard problems that demand our skills to solve.
Jeremy Jackson is the founder and CEO of Shift Lab, an NYC-based digital product design and agile development agency that provides businesses with endless product vision. Jeremy Jackson has built Shift Lab into the development partner of choice for design agencies and organizations as varied as Google, Meta, Breastcancer.org, Fora Travel, Gray Malin, and more. Jeremy’s team is known for bringing artistry and skill to every development project they work on, and he’s the go-to consultant for complex development projects other firms cannot execute.