-
-
Notifications
You must be signed in to change notification settings - Fork 781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update 10-defensive.md #1085
base: main
Are you sure you want to change the base?
Update 10-defensive.md #1085
Conversation
complete change of the lesson to cover exceptions and try except pattern
🆗 Pre-flight checks passed 😃This pull request has been checked and contains no modified workflow files, spoofing, or invalid commits. It should be safe to Approve and Run the workflows that need maintainer approval. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a member of the SWC LPGC (now incorporating the CAC) I broadly support the recommended changes to this episode.
The focus is largely on focusing on introducing the concept that things can go wrong, and we need to check for those errors. At this stage I think that is sufficient. We can still maintain some content on TDD but that isn't the focus of this lesson.
For input validation assertions aren't appropriate, and can cause issues later on.
For these instances try ... except is the better option.
It would still be could to include assert, I recommend the following:
- an example of the assert syntax be included, then
- example of using assert to check input and outputs to variables.
- Then add a comment that this kind of thing is done as part of the Test Driven Development approach, link out to further information on TDD
I don't think that there needs to be a discussion on TDD in this episode as it is beyond what learners need to know at this point in time.
The first part can be read as using assert for input validation, which we have all agreed is not right, but could also be interpreted as testing, if we assume the input comes from other parts of our code. However, this is not sufficiently clear, and I agree to change this part to raising errors, since The main problem is that we're throwing away the baby with the bathwater, as this becomes an episode on input validation only, removing the rest. I'd say we could keep a part on assert, and on the benefits of adding little testing devices to our code, which was the main point of this episode. In summary, I would
|
complete change of the lesson to cover exceptions and try except pattern. Closes #1084
If this pull request addresses an open issue on the repository, please add 'Closes #NN' below, where NN is the issue number.
Please briefly summarise the changes made in the pull request, and the reason(s) for making these changes.
Changes completely the lesson to cover input validation using exception and try except patterns. It addresses #1084 adn #979
If any relevant discussions have taken place elsewhere, please provide links to these.
#979 #622, #773 and #874,
For more guidance on how to contribute changes to a Carpentries project, please review the Contributing Guide and Code of Conduct.
Please keep in mind that lesson Maintainers are volunteers and it may be some time before they can respond to your contribution. Although not all contributions can be incorporated into the lesson materials, we appreciate your time and effort to improve the curriculum. If you have any questions about the lesson maintenance process or would like to volunteer your time as a contribution reviewer, please contact The Carpentries Team at [email protected].