# 🤖 Day 24: Investigate code explanation techniques and share your insights

**URL:** <https://club.ministryoftesting.com/t/day-24-investigate-code-explanation-techniques-and-share-your-insights/75364>\
**Category:** 30 Days of Testing\
**Tags:** 30-days-of-testing, ai, 30-days-of-ai-in-testing\
**Created:** [24 March 2024 00:00 UTC](https://club.ministryoftesting.com/t/day-24-investigate-code-explanation-techniques-and-share-your-insights/75364 "2024-03-24T00:00:40Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![billmatthews](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/billmatthews/32/13123_2.png) [@billmatthews](https://club.ministryoftesting.com/u/billmatthews)\
**Post date:** [24 March 2024 00:00 UTC](https://club.ministryoftesting.com/t/day-24-investigate-code-explanation-techniques-and-share-your-insights/75364/1 "2024-03-24T00:00:40Z")

</div>

It’s Day 24, and we are going to experiment with AI’s ability to explain code to people with different levels of experience. OK, so reading code is not everyone’s [cup of tea](https://www.merriam-webster.com/dictionary/cup%20of%20tea), but being able to understand code and the ability to ask questions about the code can be valuable to testers when it comes to reasoning about testing. Various AI-empowered tools exist that can explain code to users, but some critical questions might be:

1. Can it explain code to me?
2. Can it help me test better?

### Task Steps

Let’s break this task into two options depending on what your focus is:

#### Option 1: if you currently write test code you can focus on the following tasks.

- **Choose your Code Explaination Tool:** there are a number of tools that are capable of explaining your code and a number of these are being built into or available as plugins for IDEs and code editors. Select the tool you’d like to try - or pick two and compare them. Review the documentation for the tool to understand how get the the tool explain code.
- **Explain some code:** Select or write some code to explain. If you have time, try picking a number of code segments and have the tool explain the code. For example, you could try explaining some simple code or complex code, or try explaining a short snippet of code vs a longer snippet of code.
  - _Warning: Remember that many AI tools process the data you provide on the cloud and may use this data for training future versions of the model. So ensure that the code you are explaining does not contain proprietary or sensitive data._

- **Review the usefulness of the explanation:** Examine the explanation of the code provided and consider:
  - How understandable the code explanation was.
  - Are you able to tailor the explanation to your level of understanding?
  - How does code explanation benefit your role?

#### Option 2: if you have no interest in writing code, you can focus on the following tasks.

- **Search for some code to explain:** Access this Github Repository: [GitHub - diptangsu/Sorting-Algorithms: Sorting algorithms in multiple languages.](https://github.com/diptangsu/Sorting-Algorithms), which contains a collection of sorting algorithms written in different programming languages. Select a folder such as “Python” or “Java” and then select a file (each file contains a sort algorithm). Copy the displayed code.
- **Ask an LLM to explain the code:** Use a Large Language Model such as Bing, ChatGPT, Gemini or another and construct a prompt that asks the model to explain the code and paste the copied code into the prompt. An example prompt might be:

> Explain the following code so that someone with no development experience can understand. The code is:
> 
> `Copy your selected code here`

- **Review the explanation:** In the above prompt, we used the ‘_Audience Persona_’ when we specified the output should be suitable for someone with no code experience.
  - How understandable was the explanation?
  - If you change the audience persona, does the output change appropriately?

- **Prompt for test ideas:** Construct one or more prompts to ask the LLM to generate test ideas based on the code snippet.
  - Did the model produce suitable tests?

#### **Share Your Insights:**

Regardless of which option you choose, respond to this post by sharing some or all of the following:

- Which option you chose.
- How well was the code explained?
- Did the tool take into account your level of knowledge?
- Could you customise the explanation for your level of knowledge?
- Could you ask for different explanations or query areas that you didn’t understand?
- How beneficial was the code explanation to your testing activity?

### Why Take Part

- **Add another tool to your toolbelt:** As testers, any tool that helps us better understand what we are testing is helpful. By experimenting with code explanation tools, we are extending our toolbelt into areas that may have previously been difficult for us to access.

**🤿 [Dive deeper into these topics and more - Go Pro!](https://www.ministryoftesting.com/membership?utm_campaign=30dotAI&utm_medium=web&utm_source=club)**

---

_[View the full topic](https://club.ministryoftesting.com/t/day-24-investigate-code-explanation-techniques-and-share-your-insights/75364)._
