Writing Comments
|
Grab a Piece of Paper! |
In this introduction to comments activity complete the following:
- write comments for the provide code segment.
- run the code in the Java Playground.
- evaluate your comments. Do they match the results when you run the code?
Code Snippet 1: Tickets
Code Snippet 2: Running
Code Segment 3: Students
Code Segment 4: Points
Using AI to Explain Code
- Provide each code segment to AI and ask it to provide you with comments for this segment. Use the following prompt: Provide comments for the following code segment. Make them detailed enough to help another person under the purpose of the code.
- Compare the comments AI wrote with your own. Use the following questions to evaluate whether you need to make adjustments to your comments:
- Did AI provide an overall description or a comment for each line of code? How does this match how you wrote your comments? Which way do you feel is more effective or are there times when one way is better than the other?
- Are your comments similar to AI? If they are not similar, which one best matches what happens when you run the code?
- What is missing from your comments that AI included? Is this important for you to include or not necessary?
- What is missing from AIs comments that you included? Are your comments clearer because of your additions or should they be removed?