ChatGPT: The developer's new ally

Updated 5 months ago on June 04, 2024

Explore ChatGPT's potential as a powerful development tool in the hands of experienced developers. Learn best practices and use cases for code generation, testing, and knowledge expansion.

There's a lot of talk right now about how ChatGPT and generative AI in general will replace... well. everything. Whether it's technical writers, illustrators, developers, or market research analysts, many see ChatGPT as a threat. As for developers? Well, it's still early days, but for now, ChatGPT and other generative AI is not a threat, but rather a tool. And the more experienced a developer is, the more opportunities there are to use ChatGPT for tasks such as automation and test development to make work easier and more efficient.

ChatGPT is not an immediate threat to developers, and it doesn't take much time working with it to see why. Take a look at how ChatGPT and other generative AI have fared in other industries. Publications that tried to use ChatGPT to generate articles produced readable, albeit mundane, text, but unfortunately often riddled with factual errors. Those who simply used what ChatGPT had created found themselves in the awkward position of having those errors exposed.

We face the same problem when we ask ChatGPT to generate code. No company generates code from ChatGPT and puts it into production unless they expect to stay in business for a very long time. Of course, ChatGPT can provide code, and often, while the code is usable, it usually requires small but important tweaks. Any organization using ChatGPT to generate code should make sure that an experienced developer is constantly monitoring ChatGPT.

But the possibility of introducing bugs and even unnecessary nonsense into the codebase is just one of many issues that developers should consider when using this new tool. Because developers must exercise caution when using it, ChatGPT and other generative AI can be powerful tools in the hands of an experienced developer.

ChatGPT Usage Examples

There are many potential use cases, including, yes, code generation. ChatGPT, if used correctly, can help developers arrive at a solution much faster. Given ChatGPT's reputation, no one should use the code line by line. Nevertheless, ChatGPT can be a foundation to build upon. However, ChatGPT is best suited for generating code for discrete, specific, often repetitive tasks. For example, ChatGPT is usually very good at generating code for simple tasks such as writing a data connector between two applications or generating a set of automated tests.

The more complex or unique the task, the less likely ChatGPT is to produce good code. Treat it just like something you picked up from Stack Overflow or another forum. Test the code thoroughly before you use it. After all, ChatGPT probably took it from some other site and may have modified it slightly. The code may be useful, but you don't know its origin. Be careful.

ChatGPT is also a great source of training and knowledge for developers. There are so many new languages popping up every week, and sometimes every day, that only some people can keep up. Not sure what a higher-order function looks like in Typescript? Ask ChatGPT to explain the concept and give you examples. Let's say you're great at Ruby, but new to Python. Ask ChatGPT to give you examples of class objects in Python or any other concept you are not familiar with.

Generative AI can also be very useful when creating tests for QA, because although testing is automated, the developer most often has to create code to generate tests. If the prompt describes the test well, ChatGPT can provide a good first attempt at creating code. An experienced developer can quickly determine how to iterate this initial code with additional hints that provide more context. Additionally, experienced coders know what the test code should look like and can tell when it is in the right place. After a few minutes of testing and tweaking, the test is ready to go, saving the developer and client time.

Developers generally hate writing documentation, so they outsource some of that work to ChatGPT. Again, there are better ideas for complex code. Still, it does an excellent job of creating documentation for common, routine items, such as expected inputs and outputs for that connector from certain endpoints. Of course, ideally one would want to repeatedly check its operation, but this feature may allow developers to spend more time coding and less time writing documentation.

Finally, ChatGPT can automate some tasks with Auto-GPT, an artificial intelligence "agent" that performs functions automatically. For example, you can use it to generate leads by asking it to send you a weekly one-page list of companies of a certain size with a web page at least three years old, written in WordPress.

Best Practices for Using ChatGPT

In addition to these use cases, we learned best practices for getting the most out of ChatGPT and protecting ourselves from its potential drawbacks:

  1. Be as specific as possible: provide as much context as possible and remember that you can tell it how to spit the information back out. ChatGPT can be verbose, either with a huge wall of text or a small block of code. Specify what you want to get and how you want to get it. For example, here's a sample request I could use: "As a programming assistant, I'm trying to connect to a Postgres database hosted on AWS and using React as my language. Give me a connection string, replacing all connection parameters with curly braces, and I'll ask additional questions if I need more."
  2. Know the boundaries of truth for an acceptable answer: While ChatGPT is a good source of knowledge for developers and even code, it is not always a good tool for inexperienced programmers. If you have no idea what the right answer is, or at least can't recognize when something is wrong, there's no way you'll be able to use ChatGPT effectively. You must be able to separate the wheat from the chaff. Otherwise, your code using ChatGPT, even if it works, will be riddled with errors.
  3. Don't share your own code or identifying information: ChatGPT is constantly learning, so be careful what you enter into your prompts. Researchers can read your input and use it to further train the AI, which means that any code you use as input could show up in someone else's output in some form or another. FromFAQon ChatGPT Opens in a new window :

Who can view my conversations?

As part of our commitment to safe and responsible AI, we review conversations to improve our systems and ensure that content complies with our policies and security requirements.

Will you use my talks to teach?

Yes. Our AI instructors can view your conversations to improve our systems.

Using the ChatGPT API should protect against this, as their terms and conditions state that they will not use data from the API in training. Even so, it's best to be cautious.

ChatGPT will only get better over time, and it's impossible to say how it will affect the development profession, although it will change the way we do our work. Experienced developers will begin to learn how to use this powerful tool to create development frameworks, learn new languages, and test their code.

Let's get in touch!

Please feel free to send us a message through the contact form.

Drop us a line at mailrequest@nosota.com / Give us a call over skypenosota.skype