A Small AI Experiment¶
In this round, the course staff will expose the students to the small-scale use of AI in programming. The aim is to utilise the results of this experiment in a research project.
The students are encouraged to use either ChatGPT or Copilot in the solving of the Country data (JSON) programming task. Although the use of AI tools is optional in this task, it is highly recommended that students apply the tools to familiarise themselves with AI assisted coding or to further hone their skills in AI assisted coding.
The students are provided a questionnaire about the use of AI in the Country data (JSON) task. Please, remember to fill in the questionnaire after you have solved the task. You will obtain five theory by submitting the questionnaire.
ChatGPT and Copilot¶
OpenAI’s ChatGPT is freely available to everybody and is used via a web browser. You can construct a new program by chatting. For example, if you say “How to Write a Hello World program in Java?”, ChatGPT creates the program for you, explains each line of code and gives directions of how to compile and run your code in a command prompt. The program can be further modified by continuing the discussion. For example, to greet the whole universe, you could say to ChatGPT “Say hello to Universe.” to make ChatGPT to change the greeting and to update the name of the program. Alternatively, you can start the chat by entering your program. ChatGPT acts in this case first as a reviewer and notes you of possible errors or other problems in the program. Then, you can modify the program by chatting with ChatGPT, as described above, or you can edit the program and resubmit it to ChatGPT.
There are different versions of Copilot. Microsoft Copilot (former Bing Chat) is a browser version that is fully supported only by the Edge browser. The Chrome browser has a limited free access. The browser version can be mostly used as ChatGPT. However, it seems that the users cannot edit their previous questions. This tool is free to use. Tampere University will provide for the students the commercial browser version of Microsoft Copilot in Spring 2024. The commercial version has better privacy and security than the free version.
The best known Copilot version is GitHub’s Copilot plugin that allows you to utilise AI directly inside your code editor. The plugin supports coding seamlessly, because it can give to you suggestions as you type your code. There is also the chat capability in the plugin. The plugin is currently available for Visual Studio Code (VSCode) and some IDEs, but unfortunately not for NetBeans. Although Tampere University does not belong to the GitHub Campus Program, the students can obtain a free Copilot plugin for two years by applying. Please, note that you must create a GitHub account to be able to apply. A photograph of your Tampere University student card should be a sufficient proof of your academic status as a student. The processing of your application should take only a couple of days.
About the use of AI tools¶
Here are some points to note, when using AI tools in programming:
It is only a tool. Tools have always their limitations.
Cannot replace learning. You still need to be able to write programs without AI tools and it is essential to be able to review and understand the code a tool suggests.
Can aid learning. An AI tool can be an excellent helper in learning new languages, libraries and frameworks. By observing the generated code and suggestions, you can learn best practices and pick up new techniques.
Refine. An AI tool may not get it right the first time. However, by iterating with refined inputs, you can guide the tool to produce the code you need.
Be specific. The more specific your comments and function names, the better an AI tool can assist. For example, a function name such as
calculateAverageFromList
is clearer thanprocessData
.Write comments. An AI tools responds to the comments in your code. You can guide its suggestions by providing detailed comments that clarify your coding intentions.
Be on your guard against security flaws. AI may suggest code that has security vulnerabilities or is not compliant with best practices. Always review its suggestions with security in mind.
Remember copyrights. Although the training data of an AI tool is drawn from public repositories, it is always essential to ensure the code you use does not infringe on copyright laws.