Skip to content

Commit

Permalink
Merge pull request #86 from fhdsl/quiz_ch6
Browse files Browse the repository at this point in the history
adding a first draft of a ch 6 quiz
  • Loading branch information
ehumph authored Jul 13, 2023
2 parents 371d611 + 5d8db3d commit 3d4a4f9
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
21 changes: 21 additions & 0 deletions 06-understanding_other_ppl_code.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,27 @@ ottrpal::include_slide("https://docs.google.com/presentation/d/1MCNeSO4aOm1iESWD

(And if you do ever run across an expression like this in your code, you can check out our chapter on [refactoring code](https://hutchdatascience.org/AI_for_software/refactoring-code.html#refactoring-code) using AI to fix it!)

## Limitations

Although chatbots can be extremely helpful for better understanding someone else's code, if there is a lack of annotation or documentation, it will be difficult to discern more about the context of the development.

Cases where developers may not have provided context information include:

1) Not stating their purpose for writing this code.
2) Not describing what they planned to do next.
3) Not describing (or being aware of) possible parts of the code that need updating or maybe have security or privacy issues.
4) Not describing how they made certain decisions in the development process.

Although we can't truly understand some of this information, it is however possible to get some assistance from chatbots with prompts such as:

1) What do you think the purpose of this code is?
2) What might be possible next steps to further develop this code?
3) What are possible issues with this code, particularly for security or privacy?
4) Why was the code possibly written with this structure? What other options are possible?

Chatbot tools are also limited in terms of how up-to-date their training data is to know about current possible issues with code.



## Hands-On Exercise

Expand Down
48 changes: 48 additions & 0 deletions quizzes/quiz_ch6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

{quiz, id: quiz_ethics, attempts: 10}

## Template quiz

Choose the best answer.

{choose-answers: 4}
? Which of the following is NOT an advantage of using AI language models to understand code written by someone else?

C) Automatically fix bugs and errors in the code that don't need any review.
C) Automatically generate comprehensive unit tests for the code that don't need any review.
m) Analyze the code's structure, complexity, and potential defects.
m) Understand comments and documentation written by other developers.
o) Summarize large codebases.
o) Better understand potential inefficiencies in the code.

{choose-answers: 4}
? What are some prompts that would NOT be helpful for you to better understand someone else's code?

C) Why did the developer not write this in a different language?
C) Why did the developer choose this data as an example?
m) Can you tell me more about this package?
m) Can you explain what each step does in detail?
o) What does this code do?
o) Can you tell me more about this data?

{choose-answers: 4}
? When asking about someone else's code, what should you do?

C) Ask about how the AI chatbot came up with its answer
C) Ask the AI chatbot what it thinks might be possible issues with the code.
m) Assume that the chatbot knows all the possible issues with the code.
m) Assume that the chatbot is always correct about the code.
o) Assume that the chatbot is correct about what language the code is written in.
o) Assume that the chatbot knows who wrote the code and if you have permission to use it.

{choose-answers: 4}
? Which of the following are NOT helpful questions to ask about someone else's code?

C) What did the developer plan to further develop?
C) Why did the developer not annotate this section of code?
m) What does this regex indicate?
m) What does this function do?
o) What version of this package was likely used for this code?
o) What does this variable or object mean?

{/quiz}

0 comments on commit 3d4a4f9

Please sign in to comment.