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

Teacher Tool: Add Block Exist Criteria from Intro CS Curriculum #5644

Merged
merged 15 commits into from
May 6, 2024

Conversation

thsparks
Copy link
Contributor

@thsparks thsparks commented May 3, 2024

This adds several catalog criteria (and validator plans) based on the Intro CS Curriculum (see #5642 for details). Specifically, I've focused this change on the criteria that can be implemented using only block-exists checks with no additional functionality added.

Criteria included:

  1. Responds to at least [count] different events
  2. Responds to input
  3. Produces output
  4. Uses LED coordinates at least [count] times
  5. Sends radio messages
  6. Receives radio messages

I've also removed two criteria:

  1. Outputs to LED display (since we have "Produces output" now)
  2. Read a GPIO pin (since we have "Responds to input" now)

There are a few things that'd be good to follow-up on with this change, notably:

  1. Input check could benefit from a blocks-in-category-exist kind of check since everything in the input category is valid (though there are quite a few outside of it too, which we'd still need to account for).
  2. Input, Event Response, and Receives Radio Messages could all benefit from a non-empty validator.

All in all, while this was just about manageable for micro:bit (and there's a minimal expectation of changes, since a lot of this is limited by hardware), this is not going to be a scalable or maintainable approach for larger/more complex targets like Arcade. We may need to consider some level of runtime validation for that in the long-term...though that comes with its own set of challenges, since certain things may only happen if certain conditions are met.

Depends on microsoft/pxt#10004
Partially addresses #5642

thsparks added a commit to microsoft/pxt that referenced this pull request May 6, 2024
…10004)

This adds a validator plan to check for the number 0 block, which is useful if we want to ensure 0 was passed in as a parameter (used by microsoft/pxt-microbit#5644 to check for setting lives to 0 specifically, which produces output when non-zero values do not)
"id": "2CA4A5DA-4690-4514-97F5-2FE145AB3A59",
"use": "uses_led_coordinates",
"template": "Uses LED coordinates at least ${count} times",
"description": "Uses blocks that reference LED coordinates at least the specified number of times.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a description for this criteria? It seems that the description for this is very similar to the template.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to default to including descriptions, even if they feel a bit redundant. In this case, I think it's helpful to specify that we're looking specifically for blocks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, makes sense. I find that "reference" is a bit of a confusing word to use here, would changing it with "access" or "check" still make sense for this description?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm "access" and "check" don't quite convey the correct meaning, in my mind. Perhaps "Uses blocks that accept LED coordinate inputs at least the specified number of times"?

docs/teachertool/validator-plans.json Show resolved Hide resolved
]
},
{
".desc": "Runs code in response to any event (TODO : Non-Empty Check)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wanted to ask a clarifying question for the difference between this validator and the uses_input validator. Is this validator looking at all of the open-mouthed "on-x-..." blocks and the uses_input validator looking at those blocks AND all the blocks that access something from the micro:bit board?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More or less. uses_input is any kind of input (buttons, sound, etc...) and includes things like the "compass heading" and "sound level" blocks which aren't events.

This one is looking at any "event" (i.e. most of the open-mouthed) blocks, even ones which are not necessarily "inputs" (specifically, "music on [melody note played]").

{
"validator": "blocksExist",
"blockCounts": [
{
"blockId": "device_get_digital_pin",
"blockId": "radio_set_group",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm forgetting, did we set up the infrastructure to put validator plans in with the checks? That might be something interesting to think about going forward if not, but I'm just thinking out loud and it might not be worth the effort. This validator and the inputs and events validators made me think about this where we could split out some of the shared checks into a different validator, then list that validator as one of the checks. So in this case, you could put the radio_set_group check in a separate validator and then use that validator in the sends_radio_message and receives_radio_message to cut down on duplicates.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, something like that might be helpful, but we don't support it yet, and it'd be nontrivial to implement. There'd be some potentially-complicated design implications to deal with and I didn't want to get into that mess in this change.

Copy link
Contributor

@srietkerk srietkerk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@thsparks thsparks merged commit aab1fab into master May 6, 2024
6 checks passed
@thsparks thsparks deleted the thsparks/teachertool/update_catalog branch May 6, 2024 19:07
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.

2 participants