[Microbit-Python] Flat API

Larry Hastings larry at hastings.org
Tue Sep 22 14:36:43 CEST 2015



On 09/22/2015 12:50 PM, Michael wrote:
> For many children, I expect that this ...
>
>     microbit.pins.p0.write_digital(x)
>
> .. will read as  "microbit pins p0 write digital x", and they'd wonder 
> "Why are the words in the wrong order?",

That's good news indeed!  Anything that inspires curiosity about 
programming in children can't be all bad.  Perhaps they'll ask their 
teacher "why are those words in the wrong order?", and the teacher will 
explain about going from the most general to the most specific, and the 
child will have learned something.


> Good API design for children though is not the same as good API design 
> for everything

Why not?  Children want to live in the world of adults.  And if we're 
going to teach them programming, we should start them off with good habits.

I find children to be pragmatic--if they want to get something done, you 
show them how to do it, they use it and move on with their lives. If you 
say "to check if button a is pressed, use if 
microbit.buttons.a.is_pressed():", they'll say "okay", not "that's too 
much to type, I give up on programming forever, just flunk me already".

You suggest children have difficulty spelling--true enough, but 
contorting the API is not the correct response.  Instead, how about we 
enhance upyed's ability to detect errors early?  It happily generates 
firmware files even when the Python has obvious syntax errors.  I 
suppose it's too much to hope for for upyed to sprout enough 
syntax-coloring smarts to flag misspelled words?


In any case, why did we spend all day yesterday arguing about designing 
a good API, if that's a terrible bad idea and instead we need to design 
a dumbed-down API that minimizes keystrokes?


Rather than speculate about hypothetical 11-year-olds, perhaps we could 
consult with an actual programming-teacher-of-11-year-olds to gain some 
hard data.  Do we need to minimize keystrokes?  Do we need to dumb down 
the API, or is a level or two of nesting okay?


//arry/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/mailman/private/microbit/attachments/20150922/a5ecc091/attachment.html>


More information about the Microbit mailing list