Some thoughts on if block and wording

69 views
Skip to first unread message

glase...@gmail.com

unread,
Jul 15, 2021, 2:33:36 AM7/15/21
to Blockly
So I noticed a few things about wording and if blocks as I was demoing it.

People really liked the word if then.    You can see scratch using that concept here in there if block.  I think it makes it more intuitive for new coders.   I decided to adopt that and use pasted tense for blocks related to a sensor value return a boolean. 

What I like about it is that the code becomes more readable.

--------
if is bluetooth receiving a message?
do
--------

turns into

-------
if bluetooth received a message?
then
-------

From the people I have been working with it's best if it reads like a simple sentence.  

Just some thoughts.  I have attached some screenshots for those who are interested.

Any feedback or experience anyone has on the subject of wording blocks is appreciated.   Not saying that I have the answers or best practices.

Thank you

Noah
scratch-if.png
before.png
after.png
blockly-if.png

Jason Schanker

unread,
Jul 15, 2021, 3:36:06 PM7/15/21
to Blockly
Hi Noah,

Related to what you're investigating, you may find the paper, "An Empirical Investigation into Programming Language Syntax" by Andreas Stefik and Susanna Seibert to be an interesting read.  This paper considers which word choices are the most intuitive to novices and which ones afford them the highest accuracy rates when they type code.  There is also an evidence-based programming language that has been created based on this research in  Quorum.  Regarding your observation, the paper addresses it:

> We were surprised by this result, as many academics describe conditionals as “if then” statements. However, the TAM [Token Accuracy Map] shows only up to 67% accuracy in the best case, with 8% in the then after the first else for experiment 4 (see Figure 5)."

Of course, this is for a text-based language so it may not be completely surprising that allowing users to accomplish the same task with the omission of a word would afford higher accuracy rates.  Another interesting result:

> Note that what are perhaps the three most common words for looping in computer science, for, while, and foreach, were rated as the three most unintuitive choices by non-programmers.   

Best,
Jason

Beka Westberg

unread,
Jul 17, 2021, 11:25:26 AM7/17/21
to Blockly
Huh this is really interesting! Thank you for sharing your experiment Noah and thank you for sharing that study Jason. I'm definitely going to give it a look :D

But I'm wondering, how do yall think this would effect while loops? I don't think electroblocks has them, so it's not a problem there, but I imagine the present tense "while bluetooth is recieving message" might make more sense than the past tense version.

But then again, Jason mentioned that "while" is pretty unintuitive, so maybe the keyword itself is the problem in that case haha.

Are there any other blocks you think would be more intuitive with different wording?

Best,
Beka

Jason Schanker

unread,
Jul 17, 2021, 12:35:19 PM7/17/21
to Blockly
Regarding loops, here are the top/bottom rated results for loops ("rated 0 (0% intuitive) to 10 (100% intuitive)") from the paper:

Loops
Non-programmer 
Top choices: repeat (6.88, 2.94), again (6.43, 3.05), loop (6.30, 3.20) 
Bottom choices: foreach (2.99, 2.97), while (2.37, 2.70), for (2.13, 2.83) 
Programmer 
Top choices: loop (7.88, 2.28), repeat (7.49, 2.70), cycle (6.65, 2.45) 
Bottom choices: duplicate (4.67, 2.82), foreach (4.35,3.02), echo (4.13, 2.87)  

Quorum uses repeat, repeat while, and repeat until (https://quorumlanguage.com/tutorials/language/repeat.html) so it still uses while but it's prefixed with a repeat.  Anecdotally, I think having an until can be useful since for many problems, students will often think in terms of when to stop instead of when to continue.

Regarding the accuracy results from this paper though, they are for text-based languages so they may not generalize to block-based ones.  For block-based languages, I'd imagine that it's possible that "if then" would get a comparable or even higher accuracy result than "if" alone since it wouldn't be necessary to type the "then."

Best,
Jason

Noah

unread,
Jul 17, 2021, 8:47:23 PM7/17/21
to blo...@googlegroups.com
@Jason thank you for sharing that paper.  I bought it and it's really cool.  I need to study it a bit more and get through all the academic language in it.  Blockly takes care of a lot of the syntax trouble that early learners confront in my experience.   I think language syntax is the big barrier to learning how to code by far.  My survey size was really small so I am not sure what it means.   What I found super interesting in the parts that I did read is that less is more when it comes to text-based languages.  Words like end and then make it harder to get something to compile.  Also, that language seems neat as well.

@Beka I think I want to survey how count with block.  See if repeat with makes more sense.  One cool hack that I did base on student feedback with the count with a block was changing the by to by adding or by subtracting.   I love the simple repeat block but the problem is that you can't do all the advanced stuff with it like alternating led patterns.

Thank you for your feedback

Noah



Screen Shot 2021-07-17 at 5.43.48 PM.pngScreen Shot 2021-07-17 at 5.43.37 PM.png



--
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 on the web visit https://groups.google.com/d/msgid/blockly/96a7edc5-456f-4631-afd5-48c49ba13083n%40googlegroups.com.

Beka Westberg

unread,
Jul 18, 2021, 12:21:52 PM7/18/21
to blo...@googlegroups.com
> Jason: Quorum uses repeat, repeat while, and repeat until...
Ahh that makes a lot of sense! You can use the first word to signal what's happening (looping) and the second one to signal how the condition is handled. And having both a while and until loop means you don't have to deal with tricky negation as much (hopefully haha).

> Noah: Words like end and then make it harder to get something to compile.
Huh, interesting. I wonder if that's still true when you give participants an IDE that autocompletes things? Block languages make it impossible to create syntax errors, but I think that modern IDEs make it pretty difficult as well.

> Noah: One cool hack that I did based on student feedback with the count with a block was changing the by to by adding or by subtracting.   I love the simple repeat block but the problem is that you can't do all the advanced stuff with it like alternating led patterns.
Ooo that's a sweet idea! Negative numbers are really tricky and I think that makes it a lot easier to understand.

> Noah: I think I want to survey how count with block.  See if repeat with makes more sense.
If you decide to survey it definitely share how it goes! I'd be interested to hear which one people find more intuitive, because I think this one could definitely go either way :D

--Beka

You received this message because you are subscribed to a topic in the Google Groups "Blockly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/blockly/KAJ-Yg9qb3Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/CALmzms7e49XAne%2BwJdP7UJvC3QmQCp-_0Gh5e8gDndHEUvhSUA%40mail.gmail.com.

Noah

unread,
Jul 19, 2021, 11:43:25 AM7/19/21
to blo...@googlegroups.com
There is one other thing I forgot to mention is that I had a student that wanted to draw his comment vs writing it out.  I think that might be a cool feature or plugin one day to adopt.  It's hard to draw on the computer though.

On Sat, Jul 17, 2021 at 5:47 PM Noah <glase...@gmail.com> wrote:

Noah

unread,
Jul 19, 2021, 11:43:25 AM7/19/21
to blo...@googlegroups.com
Here is an example of what one of the students drew.  The picture would be the comment.  

Screen_Shot_2021-05-25_at_5.59.07_PM.png

Beka Westberg

unread,
Jul 26, 2021, 12:34:34 PM7/26/21
to blo...@googlegroups.com
Yesss picture comments would be the bomb! I've definitely wanted picture comments when working with text-based code. Especially when I was doing something tricky with coordinate systems. Adding visual comments would be a rad plugin :D

--Beka

Reply all
Reply to author
Forward
0 new messages