Always check and follow your local guidelines about whether this use of generative AI is permitted. If it is permitted, you may need to acknowledge the use of AI
As with most of the activities we discuss, generative AI can be powerful, but it is important to keep in mind that AI outputs are not always correct. Coding has a relatively straightforward way to check: running your code.
AI codes best when asked to perform smaller tasks with clearly defined inputs and outputs. Generating larger code blocks often results in bugs and other issues.
Learning programming, and learning a programming language, are two very different things. Use AI to help you develop a thought process, rather than a particular solution! Programming is about creating efficient and creative solutions to complex problems, and developing the way of thinking is what makes a good programmer!
Begin by outlining your logic (perhaps as pseudocode) before asking AI for specific implementations - this helps you to develop your own programming style and approaches.
While AI is great for generating short scripts and checking your work, it's still important to understand coding principles and language syntax yourself. If you rely entirely on AI and don't understand how the underlying code works, it will be very challenging to debug or piece together programs
Have a clear understanding of the larger program and how each code module fits in. You are generally better at understanding the scope of the larger program than AI is - at least for now.
Ask AI to explain code (either that you see, or that it generates) so that it can help you deepen your understanding.
If you start with AI-generated code, only use it as a starting point and then modify and improve it based on your understanding and needs.
It's essential that you are able to understand and explain any code that you write (with or without AI assistance), as ultimately the responsibility for working (or non-working!) code is yours.
A few ways generative can be used in the programming process are listed on this page
You might find it helpful to ask AI to suggest ways of approaching programming problems, for example:
"Can you suggest a design pattern for implementing a logging system in Java?"
"How can I optimize this function for better performance? [your function]"
"Can you translate the following code from [language] to [another language]? [provide code]"