Last Updated on
One of the most seismic side-effects of LLMs trained on code, is the ability of software to write software. A recursive process, which only becomes more parabolic when we consider the emergent capability of AI that writes AI. Artificial intelligence can decide, not only how to program something, but what it should program next – an outrageously valuable tool for those who know how to wield it. Let’s look at how to use ChatGPT to write code.
Essential AI Tools
Winston AI detector
Originality AI detector
How to use ChatGPT to write code
The goal here is to take an input – a piece of code – and by following simple instructions about what modifications the software developer would like, output useful code with fixes applied. The generated code should not add any new bugs or produce a new error message. The complex code may be simplified and redundancies may be removed.
Create an OpenAI Account
Go to https://chat.openai.com/auth/login in any web browser and sign up for an OpenAI account.
Prime your prompt
Begin (or end) your prompt by letting ChatGPT know you want code as your output. For example, you can say “Acting as a senior software engineer, write the code for a calculator app using Python. Output only code and nothing else.”
Artificial intelligence is, at last, very good at writing bug-free code. In fact, it is inherently good at removing human error. However, an LLM is only as good as its training data, and the algorithms that formed its parameters. It also will be subject to the same biases as the humans who selected the training data. You should still proof-read your generated code, or at the very least have it checked by a totally separate AI.
Does ChatGPT help with coding?
Yes, Chat GPT can improve the speed of your programming by several times without sacrificing the accuracy or neatness of your code. This is particularly true for repetitive tasks that can’t be handled with a simple copy & paste.
How can ChatGPT help me learn Python code?
Python is an extremely pertinent choice to learn for your programming career, as many AI software’s are built with it. You can practice programming within the text box on OpenAI’s ChatGPT website from within your browser. The conversational nature of an AI chat bot allows it to respond to your practice attempts with helpful feedback and corrections in natural human language, the same way a human teacher would.
How good is ChatGPT at refactoring code?
Refactoring code is the process of re-writing existing code without altering its external behaviour i.e. the user experience. There are multiple ways to achieve the same result with any programming language, and refactoring is often done to simplify the code itself which makes it easier and cheaper to maintain. Developers thus far generally agree that ChatGPT is good at refactoring code.