Return to Generative AI User Guides

GenAI in Coding Tutorial


Generative AI coding assistants enhance developer productivity by streamlining the coding process, automating repetitive tasks, and offering debugging and optimization support. They provide real-time code completion suggestions, enabling researchers to focus on experimental design and data analysis. With access to extensive code repositories, these tools encourage the exploration of new coding techniques and innovative solutions in various research fields.

In this guide:

Getting Started

This quick-start guide helps researchers with little programming experience learn coding with an AI assistant’s help, assuming a chosen programming language like Python, JavaScript, or C++. Instead of basic text editors like Notepad, an integrated development environment (IDE) is essential for using an AI assistant. IDEs offer extensive support, including code coloring, library management, and automated documentation.

IDEs should be selected based on what programming languages they support. For example, the Jetbrains IDE DataSpell is a common choice for Python developers, while Visual Code is often preferred for C++ and C# developers. 


Choose your preferred Generative AI coding assistant. In this guide we will focus on GitHub copilot GenAI coding assistant (see here for access details).


Once you have installed your preferred IDE, and gained access to your preferred GenAI coding assistant, you must enable the GenAI coding assistant within your IDE. This depends on your selected IDE and assistant, example instructions of how to do this for GitHub Copilot and the various supported IDEs can be found here.


Launch your IDE and begin a new project. Insert a “Hello World” snippet from here for your preferred programming language (we will assume Python for the rest of this guide). If you type in a comment, e.g.

# Then Print “This is working!”


If you see something like below (in this example, the comment is line 3, then line 4 is the suggested code by the AI assistant), then you will know that your AI assistant is working!

Tips for Prompting


Keep explanations simple and short.


Articulate the logic and steps it needs to follow for achieving your goal.


Experiment with your prompts, and give the AI examples where possible.

Use Cases


Automated Code Generation: Use AI to generate code snippets for data analysis and simulations.


Code from Manuscripts: Generate code by inputting manuscript text into an AI tool.


Data Cleaning: Leverage AI for data cleaning and preparation suggestions.


Code Design: Use AI to suggest code structure based on similar solutions.


Debugging/Optimization: AI suggests code improvements for efficiency and bug fixes.


Documentation/Refactoring: AI assists in creating documentation and suggests code refactoring for clarity and maintainability.


Automated Testing: AI generates test cases and test code to ensure robustness.


Software/API Integration: AI suggests best practices and code for software/API integration.


Scalability: AI identifies bottlenecks and suggests architectural changes for scalability.


Cross-language Translation: AI helps translate code across different programming languages, enhancing team collaboration.

Additional Resources

  • See our resource hub for examples of generative AI used in research and more resources.