Suggested blocks plugin

235 views
Skip to first unread message

Jason Schanker

unread,
Jun 10, 2024, 11:21:34 AM6/10/24
to Blockly
Hi everyone,

This fall (and maybe also during the summer), I'll be trying to give my students some real-world experience by having them develop a Blockly plugin. Specifically, I'm thinking that they could create one that would suggest blocks based on a user-entered description. For the training data, the developer would provide some examples of problem descriptions and the block types that would be used. As I want them to get experience developing something that people will actually want to use, I am very much interested in hearing your feedback! The feature request is available here: https://github.com/google/blockly-samples/issues/2386 .

Thanks!

Best,
Jason

Aaron Dodson

unread,
Jun 10, 2024, 6:48:42 PM6/10/24
to Blockly
This sounds exciting! Given the reference to training data it sounds like you're planning for this to be AI/ML-backed?

Jason Schanker

unread,
Jun 11, 2024, 12:22:50 AM6/11/24
to Blockly
Exactly, my thoughts are we'd want to use an interface to give the developer the flexibility of which AI/ML algorithm to use. We could also bundle it with some simple out-of-the-box classes implementing the interface such as a naive Bayes classifier.

Aaron Dodson

unread,
Jun 11, 2024, 6:32:15 PM6/11/24
to Blockly
That sounds great! If you'd like, please do let us know once it's available so we can add it to our plugin showcase.

ewpa...@gmail.com

unread,
Jun 11, 2024, 6:33:45 PM6/11/24
to Blockly
I recall that Lyn Turbak at Wellesley College had a student work on this a few years ago, at least for App Inventor. It might be worth reaching out to him to see if it could be generalized to other Blockly environments.

Cheers,
Evan

Jason Schanker

unread,
Jun 12, 2024, 2:33:30 AM6/12/24
to Blockly
Definitely, that would be awesome, Aaron, thanks!

Sure, thanks Evan, I'll send Lyn Turbak an e-mail.

Maribeth Moffatt

unread,
Jun 21, 2024, 4:23:41 PM6/21/24
to Blockly
This definitely sounds like an interesting use case! The team has discussed having this kind of plugin as an official first-party plugin and it's not something we'd want to adopt in blockly-samples. But it sounds like a great project for your class, and if you own it as a third-party plugin in your own repo we can still add it to our plugin showcase once it's released.

Jason Schanker

unread,
Jun 28, 2024, 3:07:48 AM6/28/24
to Blockly
Hi Maribeth,

Will do! I'll discuss it with my students to determine who will maintain the repository under their account and update everyone on their progress here.

Any suggestions for a different name for this plugin? (I just noticed there was already a first-party plugin for suggested blocks at https://github.com/google/blockly-samples/tree/master/plugins/suggested-blocks, but the suggestions are based on the most used/most recently used blocks.)

Also, while I'm planning to have the students start with suggested blocks based on problem descriptions, time permitting, it may also be good to have suggestions that also incorporate which blocks are already in the workspace. This was something I had been thinking about as well and seems to be the approach of Lyn's former student based on the paper I was directed to: https://repository.wellesley.edu/object/ir839.

Thanks!

Best,
Jason 

Jason Schanker

unread,
Aug 12, 2025, 7:25:30 PMAug 12
to Blockly
Hi Maribeth,

To finally provide an update on this, my students have created an initial prototype of this plugin where there is a new AI Suggested category that gets populated with potentially relevant blocks based on a developer/user-supplied description. Developers would be able to add their own training data and either use an out-of-the-box simple Naive Bayes Classifier algorithm or provide their own algorithm conforming to a simple interface. They built the plugin on top of the first-party Suggested Blocks plugin ( https://github.com/google/blockly-samples/tree/master/plugins/suggested-blocks). There's still more to do such as providing better documentation, testing, more advanced AI algorithms, and improving the user interface for entering descriptions (currently just a text input/button fixed in the top corner). 

However, would someone from the Blockly team be able to do a code review on this alpha version? I know it's going to be a third-party plugin upon the completion of the initial version we release on npm, but it would be great if the students could get additional feedback on both their code and on the interface/functionality of this. It's available here: https://github.com/jschanker/suggested-blocks-blockly/pull/13 .

Thanks!

Best,
Jason

Ben Henning

unread,
Aug 14, 2025, 7:33:56 PMAug 14
to blo...@googlegroups.com
Hey Jason,

I find this quite cool!

I'm willing to give this a review pass early next week if that timeline works for you. If it helps, here's how I would approach reviewing the code:
  • I'd consider the plugin's implementation approach as a whole against our usual best practices for writing plugins. I know that this is based on suggested-blocks, but I'll probably also consider it from a generic plugin perspective in case there are areas that could be done better even considering the original plugin.
  • I'd evaluate the code like I would any other engineer on our team, that is: ensuring good and clear testing practices, clearly written code, well thought out code documentation and API contracts, and sensible and maintainable project structures. I've already taken a quick glance through the PR and didn't spot anything very concerning, but I'm sure I will have a lot more thoughts when I spend some time thinking about it.
  • I probably will not do a follow-up review unless specifically asked (and I actually am happy to). My general strategy for reviews is to provide a comprehensive up-front analysis so that any follow-up changes are usually directly addressing the comments rather than large changes being requested midway through a review.
If this sounds good to you, then I'll make sure to set aside some time next week to perform the review.

Separately, if there's anything more specific that you'd like feedback on then I'll be happy to consider that as well.

Best regards,
Ben

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/blockly/e099b9e9-3e71-470f-8dd5-0651aeec8e66n%40googlegroups.com.

Jason Schanker

unread,
Aug 15, 2025, 5:05:43 AMAug 15
to blo...@googlegroups.com

Thank you, Ben, that sounds perfect!

Something we could definitely use some feedback on is how we handle the creation of the UI where the user can enter the description. Currently, we allow the developer to provide a workspace in which case they'd be responsible for creating this. Alternatively, if a container is provided, the init function would create a workspace which it injects inside it and a text input and button fixed at the top right corner of the viewport, which is probably not ideal.

Some possible alternatives would be to do something more like the workspace search plugin which overlays a text input (without a button) onto the workspace (although this uses an internal method getInjectionDiv https://github.com/google/blockly-samples/blob/2756a47a3c885a7621d7874ed535313bfbcdb494/plugins/workspace-search/src/workspace_search.ts#L144 from the WorkspaceSVG class)? Or should we go more of the code generator route and require the developer to provide their own UI for entering the description? Or perhaps use some other approach?

Thanks again!


Reply all
Reply to author
Forward
0 new messages