Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update 10-defensive.md #1085

wants to merge 1 commit into from

Conversation

dhvalden
Copy link

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].

complete change of the lesson to cover exceptions and try except pattern
Copy link

🆗 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.

Copy link

@quirksahern quirksahern left a 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:

  1. an example of the assert syntax be included, then
  2. example of using assert to check input and outputs to variables.
  3. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using Assert as input validation is wrong and needs to be changed
2 participants