First Class Procedures for Scratch

Lambda-GoboScratch is a fantastic first programming language. And afterwards kids go on to study C and Java, right? Think again.

Is Scratch’s brilliance really all about programming? Can the Scratch experience be reduced to events, threads, conditionals, loops and variables? What about expressing ideas, imagining activities and reflecting results? What about researching, discussing and remixing? Participating? I love Scratch, because it makes such abstract concepts come to life. To me, Scratch’s biggest gift is that it lets kids create. And share. Produce. Plus, Scratch is intrinsically fun and gratifying. But it’s not easy. Let me repeat that slowly: Scratch. is. *not*. easy. Ever tried to impress someone with an interactive presentation? Ever had to invent your own user interface framework? These things are hard. Resources have to be organized, goals must be evaluated, steps need to be carefully layed out. The Latin word is programmare. Programming. Programming helps organizing hard stuff.

Or does it? How often did silly syntax get in your way, did enigmatic grammar force detours on you? I also love Scratch because it liberates programming from this sort of bigheadedness. Scratch lets kids focus on the hard stuff without imposing silly rituals. More programming languages should be like this.

Why not stay with Scratch?

Until now Scratch had a hard ceiling. You could do amazing projects with Scratch, but you would bump into that ceiling soon enough. It doesn’t have to be this way. Last summer two Berkeley CS instructors (Brian Harvey and Dan Garcia) asked me for a version of my experimental BYOB software which they could use in a new undergraduate pilot course named “The Beauty and Joy of Computing”. As that course unfolded, Brian Harvey (easily one of the world’s best programming teachers), involved me in a discussion about first class procedures. Together we began experimenting with enhancing BYOB little by little, and by late fall we suddenly realized that we were inventing a new graphical programming language. Only we weren’t. It’s still Scratch. We just added less than a dozen new blocks, re-wired some things under Scratch’s hood and tweaked the GUI a little. What’s more, we didn’t even invent these new blocks ourselves, we took them from the Scheme dialect of the LISP programming language.

But see for yourself what it lets Scratch do now:

byob.berkeley.edu


BYOB 2.99 is an alpha test version for the new BYOB 3, which is scheduled for release this August.

Highlights:

  • new Reference Manual with lots of examples and tutorials by Brian
  • Tools library of higher-order-functions (also by Brian)
  • lambda, including full closures (anonymous custom blocks)
  • anonymous dynamic lists
  • lists of lists
  • global and local procedures
  • SICP style OOP
  • state-persistent projects, Smalltalk-style image based programming

plus all the goodies of previous versions:

  • custom blocks “build your own blocks” (from v.1)
  • sprite aggregation “nested sprites” (from v.2)
  • inspect the underlying primitive code in the Elements visualisation
  • share projects as windows .exe
  • open or import any Scratch project/sprite

Enjoy!

-Jens Mönig

9 Responses to “First Class Procedures for Scratch”

  1. Adrian Says:

    Wow, wow, wow! This is fantastic. I fully agree that the way you’ve introduced the more advanced concepts should not overwhelm beginners.

    On a side note, is there any intention to increase the maximum resolution of the stage for BYOB 3? It would open up quite a few possibilities.

    Cheers

  2. Jens Mönig Says:

    Hi Adrian,

    thanks! We’re currently focusing on the “programming” features, so increasing the stage’s resolution is not on our short term radar. However, there are /lots/ of great ideas in stock for the long term :-)

  3. John Stout Says:

    Fantastic stuff! I have just described first class values, functional programming, infinite lists, lazy evaluation, … to my second year students, but without any real practical work for them to do (it’s a very small section of our A-level program): very theoretical, and I’m sure they didn’t get half of the power or beauty of the approach.

    I can see the lesson I’d do now using BYOB 3: a completely different one that I’m sure would get them thinking, and leave them unimpressed with other languages that don’t have this.

    John Stout

  4. henley Says:

    Wow! BYOB (2.99) has offered me lots of things.

    • Saving me from a 0 homework grade in a Tech project

    • Taking care of my boredom

    • Wait for Scratch 2.0

    • Give me ideas for new blocks in my Scratch modification, Peck.

    and a few other things that I am to lazy to remember :P

    All in all, BYOB 3 (or 2.99 for now) has done great for me, and obviously other people. I think that the first class list definitely helped.

    One way that I think it could be improved, is to do what Panther (http://pantherprogramming.weebly.com/) does in its CYOB (Code Your Own Blocks) And choose your own block color, although you could still choose the block colors from actual categories, or still be able to put it into a category. But it should also be able to save different colors, so that you could theoretically create your own new categories. Or allow people to CYOC (Create Your Own Category :D ) And maybe with permission, you could make your own block in CYOB or BYOB!

    Although it would be a huge change do to the above, those are features that I think would be good (weather possible or not) for BYOB 4.

    -henley

  5. Joren Lauwers Says:

    Woah, never thought I’d be having so much difficulties trying to accomplish something in - basically - Scratch.

    I wanted to make something like the PHP/Javascript/others switch- or select-case structure. I once made an image mockup here: http://scratch.mit.edu/forums/viewtopic.php?pid=280934#p280934 .

    Now it seems very difficult.

    It technically works already; this is the block def:
    http://img815.imageshack.us/img815/2471/caseblockdef.gif
    and this is what it looks like in a script:
    http://img821.imageshack.us/img821/5939/caseinscript.gif

    But it’s far from straightforward and it doesn’t look like the mockup at all - it’s ugly xD Any idea on how to improve ;)

    Also, theres an extremely annoying bug, every time I drag the block around, add some parameter, whatever, it becomes about 5 pixels wider.

    Joren

  6. Jens Mönig Says:

    Hi Joren,

    you must be using an outdated version, please get a more recent image (you can download it separately from:

    http://byob.berkeley.edu

    The annoying bug you’re having with the variadic C-shaped slots should be fixed in a more current version. If not, please holler :-)

    Also, be sure do download the current version of the tools sprite (our library of standard blocks). There you’ll find a pretty cool example of a select case mechanism inspired by fellow Scratcher nXIII.

  7. George Herson Says:

    Great work!

    Are there plans on freeing BYOB to read/write to files and networks?

  8. Jens Mönig Says:

    Hi George,

    not for BYOB 3 (which we’re just about to release). You can still download and play with a “Lists and Files” version based on Scratch 1.2 that lets you write flat lists (with numbers) to files. I believe that something like that (writing lists to files and reading files into lists) would be a very interesting thing to explore for possible future versions of BYOB, too. There’s just too much else that needed to be done first ;-) .

  9. Henri Picciotto Says:

    Thank you! I had moved my school (Urban School of SF) from Boxer to Scratch because Scratch is so appealing, but the lack of inputs was huge low-ceiling problem. BYOB is a great solution. Bravo for keeping the door open to beginners.

    –Henri

Leave a Reply