Using AI to get better

16 Nov 2023

Introduction

Just like everyone else, I was stunned and surprised when OpenAI launched their first publicly available ChatGPT model. I had previously been introduced to applications of AI that impressed me, like how Siri works, and how it’s possible to use natural language processing models to categorize documents. Still, the way ChatGPT was able to generate its own answers, not just linking to a website like Siri did, was mind-blowing. I was excited about the new technology, but didn’t know how to use it for my own advantage. Until the fall of 2023, when I integrated GitHub CoPilot into my main IDE, and realized how powerful of a tool AI can be.

Personal experience

It was my professors in a software engineering class, who started talking a lot about AI. They encouraged us to try different AI tools, and demonstrated real-life usage in class. At the beginning of the semester, we did a lot of short coding challenges in an online editor, similar to coding challenges you would expect in an interview. For me, it felt like more of a hassle having to switch tabs to ChatGPT, write a prompt, copy back the answer, edit the snippet to work for my code and so on, than just writing the code myself.

But then we started with more complex assignments, and moved back to a conventional desktop IDE, with my freshly installed GitHub CoPilot. And that’s the turning point for my use of AI. CoPilot integrated seamlessly with my standard workflow, and I could evaluate CoPilot’s suggestions at the same time as I was writing my own code. This made the process of using AI way more streamlined. In the following subsections, I will write about my AI experiences in specific situations in a software engineering class at te University of Hawaii, ICS 314. (“WOD” is “workout of the day”, a timed coding challenge).

  1. Experience WODs
    It was in the “Experience Functional Programming” I realized the true power of CoPilot. I was supposed to implement sumOfNumbers() in three different ways. To avoid having to switch back to check on the task every now and then, I copied the task into my JavaScript file, so I could easily check on it.
    // Write four functions that return the sum of the numbers in a given list using a for-loop, a while-loop, recursion, and underscore. Call them sumFor, sumWhile, sumRecursion, and sumTheSimpleWay.
    

    Before I had time to get on with the task at hand, all three functions were displayed on the screen, in a grey shadow-like manner. CoPilot had implemented all the functions using the correct library, and waited patiently for me to press tab before the code was actually inserted. It even included text arrays and calls for me to test that it worked properly.

  2. In-class practice WODs
    For the in-class practice WODs, we have usually covered topics I’ve gotten the time to become familiar with. Hence, I have used these sessions to focus on my own coding skills, and not use AI to help me solve these.
  3. In-class WODs
    The in-class WODs are graded and timed, so it’s important to get them done on time. In situations like this, when the focus is on completing the task on time, rather than learning as much as possible, CoPilot has been excellent for autocompleting my lines of code. An example of lines of code that just take time to write is when you have several imports. CoPilot has autocompleted most of my imports without errors, as soon as I’ve used non-imported files in my code.
  4. Essays
    The essays displayed in my portfolio are written in my IDE. Hence, CoPilot does its best at autocompleting my sentences and paragraphs here as well. This is a tool I’m more skeptical at using, as I’m not too sure that the text it enters won’t be somebody else’s, and I want my reflections to be my own. I do, however, feel like CoPilot adapts to my writing style, and a lot of its proposals look like things I could’ve written myself. With English being my second language, looking at the suggestions gives a lot of inspiration and helps with my vocabulary.
  5. Final Project
    My use of AI, specifically CoPilot, in our final project, has mostly been for generic autocompletion, without any specific prompts or issues. I also used CoPilot to help the brainstorming process around creating an application name, which I’ve written more about in the “Practical applications” section.
  6. Learning a concept/tutorial
    In ICS 314, all lectures are recorded as videos and posted online. This has made me able to watch the videos whenever it suits me, and repeat important parts. This has been all the tutorials I’ve needed for this class, and I have not used AI for this.
  7. Answering a question in class or in Discord
    I have not used AI to answer questions in class or in Discord.
  8. Asking or answering a smart-question
    I have not used AI to ask or answer smart questions.
  9. Coding example
    I have not used AI for coding examples.
  10. Explaining code
    AI, CoPilot Chat, has been a good help for explaining system and project files which are beside our main topics in the class. For example did Chat help me understand how the header.html file in this portfolio template is using Liquid and Jekyll to display the correct page title.
  11. Writing code
    When working with routing in Meteor, I wanted to create a function that checked if no user was signed in, before displaying a page. If a user was logged in, the user should be redirected to another page. I asked CoPilot Chat if it knew a way of doing this, and it returned a set of functions that worked perfectly.
  12. Documenting code
    I have not used AI to document code.
  13. Quality assurance
    I have not used AI for quality assurance.
  14. Other uses in ICS 314 not listed
    All of my usages are listed above.

Impact on learning and understanding

I’ve tried throughout the semester to be considerate when I’m learning new topics, and when I’m doing stuff I already know. When I’m implementing code I know how works, and I know I could’ve written without any problems, I use CoPilot a lot to speed things up. Examples of this could be CoPilot writing the imports for a file, listing up the PropTypes in React or setting up my Bootstrap grid in HTML.

On the other side, when I’m learning new things, I think the use of CoPilot should be limited. If I had CoPilot autocomplete all my lines for me, I would probably not get the same understanding and memorization as when I’m typing out the lines myself. To help me stay creative with my problem-solving skills, I’ve also stopped copying in the task description as a comment, as this made CoPilot suggest a whole file of code without requiring any input from me.

To this day, I only use CoPilot for autocompleting my lines of code after I have started on them. I do not write descriptive comments first, and let CoPilot do the rest. This would probably increase my effectiveness even further, but as I’m still a student, I think it’s important for my learning that I still do some manual coding.

Practical applications

My experiences with AI from software engineering have motivated me try to implement it in different areas as well. Using ChatGPT as a study partner has been a great improvement to my study sessions. I’ve asked ChatGPT to review a term, define a concept, or explain a topic with different wording than my book. ChatGPT has also proved itself as a great brainstorming partner. For my team’s final project in a software engineering class, ChatGPT was kick-starting the brainstorming after I asked it to “come up with ten catchy names for a website that connects college hobby musicians”. “UniSounds”, “CampusChords” and “MelodyMates” are examples of what it proposed. Even though none of them turned into our final name, it was a great help to get the creativity going.

Challenges and opportunities

Even though I’m a fan of accepting CoPilot’s suggestions while I’m writing code, this approach has been limited to only completing lines or sometimes up to three lines. I have not found any quick ways to make CoPilot author larger sections of code. And for me to use AI in coding, it needs to be quick to access. Just a few days ago, I got early access to CoPilot Chat. CoPilot Chat is a generative AI chat-bot, similar to ChatGPT, that lives inside your IDE. With a quick keyboard shortcut, it opens up on the right-hand side of the screen, as an expert coding companion always ready. When CoPilot Chat suggests code, I get the opportunity to insert the code directly into wherever I want to in my project. This tool seems very promising, and I’m excited to see how it will develop my workflow.

Comparative analysis

For learning, it’s a good idea to be considerate of how you use AI. As mentioned, I think the learning outcome will be not as good, if you use AI to write the majority of your code, as you will not remember the concepts as well, as if you’d written it yourself. Just reading the autogenerated code also makes you less likely to discover small, important nuances in the syntax, that could possibly change the way your functions perform, if it would’ve worked at all.

On the other side, I believe college classes are a great place to start using AI in your development. Personally, I get motivated to keep on working with assignments if I keep making progress, and don’t get stuck on small errors. AI has been helping me keep up the pace in my coding, and when things don’t work, it has helped me locate the issue, and maneuver around it. A college class will also provide you with a mature introduction to the use of AI, as it is a skill to master. Having a class and a professor as resources, you can get tips and hints about the use of AI, and learn enough about the new tech stack in the class, to be competent enough to spot the errors AI may introduce in the code. I do also think college classes should spend even more time talking about the use of AI in class, and show more examples of usage.

Future considerations

In the future, I will keep on limiting my use of AI when it comes to writing lines of code when learning a new topic. Then, the more comfortable I get, the more should AI be implemented in the process. Regarding using AI as a study partner, I hope I will use AI even more, to make my study sessions more effective. Diving into the possibilities of CoPilot Chat is something I’m looking forward to, and I think using it to explain template code I don’t understand is a great start.

Conclusion

Bottom line, I believe AI in software engineering is a set of tools that will revolutionize the way we code. We will be able to code faster, and do less repetitive coding. AI will also be a way more accessible helper when you get stuck. At the beginning of my software career, StackOverflow and similar websites have been great for getting help, but in the future AI will replace the need for online forums. The skill of writing good prompts is something that will be important to get the most efficient use, and what will be my main focus in enhancing my use of AI even further.