Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Λ Snap – An inviting programming language for kids and adults for CS study (snap.berkeley.edu)
147 points by dr_kiszonka 17 hours ago | hide | past | favorite | 84 comments
 help



Scratch is how I first learned programming. I was building increasingly ambitious projects in it, and at some point the editor itself became the main thing I was fighting. Once a project got to around 10,000 blocks, it could get painfully laggy, and I ended up spending a lot of time engineering around Scratch's limits.

That is what eventually led me to build goboscript: https://github.com/aspizu/goboscript

I'm one of the programmers who owe their career to Scratch, this year, I joined https://ente.com as a software engineer. Scratch taught me how to code, and perhaps a bit of real-world engineering indirectly.


same here! I got into Scratch at the age of 7 and without it (and the Scratch community), I wouldn’t have any career (or even a plan for one). I also worked as an intern on the Scratch team at the Scratch Foundation.

I also know that one of the important developers for the Asahi Linux drivers also started on Scratch. I think there’s a lot of real software engineers who started on Scratch (and the Scratch community, which is often overlooked)


This is what happened with me and BASIC. I had to upgrade to C when my programs became limited by complexity, speed, and difficulties robustly integrating audio.

I also learned programming with Scratch first, at around age 11, but i soon left it for Python

Snap is designed to be more expressive and powerful than Scratch. But I find debugging them is very painful. Changing the name of a variable or block for example, could create “holes” in the calling sites but the system can or cannot report an error and fails silently. Snap is IMO more flaky and the team seems more eager to add features than polish the existing ones or make the system mor robust and stable.

> Changing the name of a variable or block for example, could create “holes” in the calling sites

WTF. Isn't the whole point of visual programming that you are NOT bound by the limitations of text as a medium? A block refers to a specific variable. It shouldn't matter what it's called, it shouldn't matter if what it's called changes, it should still refer to the same variable even after renames.


That one is a bit more defensible for variables, when you rename variables, it gives you "rename" or "rename all". "rename" renames the variable, leaving uses of it the same, "rename all" also renames where you used it. Deleting a variable leaves the blocks that references it in place but they'll throw an error if called (IIRC this is useful if you wanted to switch from a global to local variable or vice versa).

Now, custom blocks have a different issue, where deleting one just severs any code that was using it (so if you had some custom blocks in a program: [on start] -> a -> b -> c, deleting the definition for b will mean c no longer gets called). There's now a block to delete custom blocks, so you can make self-destructing code.


They've fixed surprisingly many of the quirks, but my biggest gripe with Snap is that they don't like to add documentation with new features. A lot of the older content has a nice "help..." context menu option with a description of what it does (which is often out of date itself, e.g. the "split" and "join" by blocks feature isn't shown on those blocks), and newer blocks have the context menu option... but nothing pops up.

The documentation problem is entirely my fault. I managed to stay up to date through version 8.0, but then so many things happened so quickly that I got swamped. Then I got depressed and gave up.

Also I made the mistake of writing the manual in MS Word. At the time, I couldn't find a standard way to insert pictures into a TeX document, or I would have used that. (Now, of course, there is a standard way.) There is an effort underway to convert the manual into a web-based format in a git repo that anyone can contribute to, but that effort is 90% done and you know what that means! :)


Six months ago I was teaching a beginning-programming course to six kids, using Snap!, so I was reading the forums. And there was a group effort to add documentation to many of the blocks that were lacking it. I haven't been back in a few months, so I don't know how that effort is progressing, but there were definitely some undocumented blocks that were getting documentation completed as I watched, and eventually added to the Git repo to land in the next release.

So it's getting better.

The other thing to remember is that the core Snap! development team is just two guys, Brian Harvey and Jens Mönig. When they're focused on things like trying to figure out how to get macros into Snap!, so that Snap! can truly be a Lisp (right now it's only most of a Lisp), they tend to leave the documentation effort to the community. If they had a larger team I might fault them for that, but with just two guys, I can't really blame them for focusing their efforts on things the community is less able to do, and leaving things the community can do up to the community.


I have to clarify that the Snap! implementation is 99% the work of Jens Mönig. It was 100% Jens for the first two major releases, back when it was called BYOB ("build your own blocks") and was an extension of the Scratch source code. Then we wanted to use it in a CS course for non-majors at Berkeley so I got in touch with Jens and started complaining about missing features! The result was an intense collaboration in which the coding was still 100% Jens but I contributed ideas about user interface and features. I think my biggest contribution was teaching Jens about lambda!

Our team has officially grown to six people, adding Bernat Romagosa, Jadga Hügle, Michael Ball, and Joan i Pelegay. And several Snap! users have made major contributions, especially to libraries that extend the reach of the language. But the interpreter itself is still all Jens.


Glad to know the team is growing, it makes me slightly less worried about the project's bus factor.

Any name that you can't type is going to be a problem.

> Any name that you can't type is going to be a problem.

Fortunately the name is Snap! so typing it isn't much of a problem. (With the !, which was stripped from the submission title and when most people write about it.)


The logo has a lambda in front, and I assume that's where the "Λ" came from in the title of the post. But I don't see it in any of the text on their site.

Correct, it's not part of the name, which is just "Snap!".

That's more of a problem in text-based coding. One of the things I genuinely like about Snap (well, in my case NetsBlox, which is a fork of it) is the ability to have spaces and weird characters in a variable name.

Edit: Oh, you meant the lambda in the post title? It's not really part of the name, but you can at least type it into Snap itself.


There's no need to type the word "lambda" into Snap!. As befits a visual language, we have a visual representation of lambda; it's the gray ring that you sometimes see surrounding an expression or a script. It's a discoverable notation; when you click on an expression you see its value, and when the expression is inside a ring the value you see is the expression itself. We inherited from Scratch the idea of using different shapes of input slots to represent the data type that's expected, round for numbers and rectangular for text. (They have since changed their minds about that, I'm not sure why. They do still use hexagons for Boolean slots.) We have an "expression" data type, and instead of a polygonal shape, we represent expression input slots by preloading them with an empty gray ring. (If you drag something with a gray ring around it into the slot, your ring is absorbed into the one that's already there.) This lets us write higher order functions that are usable by kids who haven't yet wrapped their minds around anonymous functions. It took us three tries to get the notation exactly right, but I'm super proud of it.

I don't love graphical programming environments like this and Scratch and I can't quite put my finger on why I find them so unattractive.

A big part of it is that you can, to some degree, learn programming from this. But you absolutely cannot learn software engineering from this.


I would love to see the opposite emerge, a programming environment focused on teaching architecture, security, separation of concerns, etc. All while letting LLMs deal with the fussy programming bits.

The script is already flipping, with kids making software using AI but they can only fumble forward inch by inch while burning tokens. It would be great to introduce programming in the way it functions in the workplace - we want to make a Mario clone, start with the goal, hammer out the elements to a certain fidelity then let the AI cook.


This would be so exciting. The implementation language would be less of a concern, but it worth wondering about... Would you use Rust, Racket, Lisp, Clojure, etc? I had a lot of fun teaching adults to program using DrRacket and didn't focus on the language as much as the concepts you mentioned above. They ended up being easily able to move to Javascript, Swift, and others at the end of the course.

If you appreciate when keyboard interaction gets added to a GUI, then you might think of a graphical language as the opposite, as it essentially removes keyboard interaction from what is normally a text-based system.

Not based on an official Blockly implementation. But you can add keyboard navigation to Blockly(-like) scripting reasonably easily:

https://www.youtube.com/watch?v=ITWSL5lTLig

The video above shows keyboard, but the main motivation for the key-based navigation was actually gamepad.


Snap does have a limited keyboard mode (shift click), but it's not really as good as "real" IDE.

LEGO created NXT-G for programming their Mindstorm NXT. It has since, in my opinion, been the best graphical programming I've seen to date.

It did have a slight learning curve, but 5th graders were competing just fine against high schoolers haha.


You also can't learn to be a great novelist from the alphabet song, but it has its place!

I have the same gripe and I think it’s just simply that when you are used to being able to just write code, everything else feels like it’s in the way.

Visual coding is a pain to change and move around quickly. It’s just clutter ultimately - if you know how to actually code.


I learned to program from block programming, starting out when I was 12. I'm now a full-time developer and funded startup founder. You absolutely can learn complex concepts from simple primitives, and there is a large underground community pushing the limits of languages like Scratch. See for example Linux running on RISC-V running on Scratch:

https://turbowarp.org/1201938491


In my experience, there’s no better way to learn more complex programming techniques or tools than running into a brick wall with the simple tools you’re familiar with, spending a ton of time on an unreasonably irritating solution, only to realize that you’re running into a classic [n] problem and some clever person figured out a simple logical trick to address it. I mean, it can be enraging but that knowledge tends to stick.

Though I doubt that happens much anymore.


This supports making your own higher order functions. You absolutely can learn software engineering from this. What you can't do is get syntax errors, which makes teaching a classroom of kids by yourself intractable.

I skimmed the manual. It's more powerful than I thought. You can do metaprogramming directly in the language, which will deconstruct blocks into lists. It's basically Scheme as blocks,

from someone who can remember how they even got into programming:

it's because this is BS and just a toy, it's got no connection to the real world.

from the angle of someone trying to make some toy to teach programming, maybe in their head it's like: oh this is so simple and easy it should work perfectly for teaching

but from my experience, most of my learning came from "whats this?" "how do i make a thing like this?"

this doesn't provide a way to accomplish that or to promote curiosity

I think same applies to basic CS courses teaching bits and bytes, it's not really useful to know what bits and bytes are if you don't understand what they're even used for or why you should know what they are

however, this is just my subjective point of view, maybe it differs for others.


Fair that your path worked differently for you.

But "no connection to the real world" is hard to sustain once you look at what people actually build with Snap!/Scratch. The ecosystem is full of bridges to physical stuff:

Cameras, microphones, audio, pen plotters, 3D (BeetleBlocks). Snap! 12.1 (video from a few days ago) adds body-language recognition, Bauhaus-style shape compositions, first-class Processes, translation updates:

https://www.youtube.com/watch?v=ID7wYxzHUAc

Arduino / micro:bit / boards (Snap4Arduino, MicroBlocks, many hardware libraries):

https://www.youtube.com/watch?v=Ltzlzk_zkys&list=PL5OeDsbY1E...

Robots (Finch, Hummingbird, Lego NXT, drones):

https://www.youtube.com/watch?v=6_0EqIbTlkk

Sewing machines (TurtleStitch -- embroidery from blocks; one of my favorites):

https://www.youtube.com/watch?v=K6ra5ThxkrE

Web APIs and IoT:

https://www.youtube.com/watch?v=l_P7MoBG250

ML/AI and digital fabrication (Ken Kahn's eCraft2Learn):

https://project.ecraft2learn.eu/

The "what's this? how do I make a thing like this?" curiosity you describe is exactly how a lot of people get pulled in -- making something move, blink, sing, or stitch on a machine they can see, rather than learning abstract syntax first. Blocks are the on-ramp; the project is the motivation.

Different audience than yours, maybe. But "just a toy walled off from reality" undersells what this community has been doing for decades.

Snap! also teaches real computer science at college level while staying accessible to kids -- not a stripped-down kiddie language. Brian Harvey: "Snap! is Scheme disguised as Scratch" (though he notes the original intent was closer to Logo disguised as Scratch):

https://forum.snap.berkeley.edu/t/hygienic-macros/3258/6

Re alanbernstein's point about keyboard vs GUI: Snap! is not keyboard-hostile. It has a keyboard editor for scripts -- build and edit whole scripts without the mouse, block search from the keyboard, infix arithmetic expressions typed left-to-right. Manual chapter:

https://docs.snap.berkeley.edu/user-interface-elements/#sec-...

Demo (typing formulas from the keyboard):

https://www.youtube.com/watch?v=ahHAl3p3gEU

Full IDE accessibility (screen readers etc.) is still a work in progress; Jens and Brian document what's there now:

https://github.com/jmoenig/Snap/issues/1498


I guess I just can't relate to it, because I was fascinated with the computing itself, not just getting from A to B as quickly as possible

so it wasn't the project that was the motivation, it was figuring out how to do it for real, and getting closer to expertise in programming

for example the TurtleStitch, I don't know how to say this exactly, but to me it doesn't strike as something that'd interest people who want to get into programming, but is more like a way to showcase how to do machined embroidery in an accessible way

I might be totally wrong, but my problem seems to be that a lot of this is just about showing off the capabilities of Snap, but it's not really something I would've engaged with for example?

like almost as if the ecosystem simply serves to show off Snap and thus misses the mark?

like Snap doesn't really provide a way to understand how stuff is actually done except for maybe simple logic. So I don't see how it'd be very useful for e.g. learning CS when it's not really something you'd see in the real world, i.e. you're learning a learning platform and some basic concepts

I guess my point is like, if it's not really something that's used in the real world, unlike say JS or Python, why use it instead of getting up to speed in a real language?

again, it could be that I simply don't get it, or that I'm not the target audience, but I feel like there's a reason why these haven't really taken off, and IMO there's no reason why they would need to, because they serve a very specific niche


> like almost as if the ecosystem simply serves to show off Snap and thus misses the mark?

No, I think you're the one missing the mark. And even if it shows off Snap! while teaching computer science, and students have something tangible, soft, and colorful to show off from the learning process, in what way is that missing the mark? What do you even believe the mark it misses is?

In no way are any of those modules I mentioned merely intended to simply show off Snap's capabilities. They have much more legitimate pedagogical purposes, and if you'd simply watch some of the Snap!Con presentations and videos I linked you to, you'd see and hear their developers and teachers and students show and explain what those purposes and results are.

I attended Snap!Con in Barcelona, played around with TurtleStitch myself, and still have and cherish the cool textile artifacts (and also cool friends) I made.

And the TurtleStitch presentation included live streaming video of students of diverse genders and cultures and ages enthusiastically showing off and talking about the beautiful physical objects they designed, programmed, made, presented to their parents and the conference, and are rightfully proud of, and discuss what they learned from the experience.

Trigger Warning: If diversity enrages you but Nazi salutes don't, then that's your own bigoted psychiatric problem.

Snap!Con 2021 - TurtleStitch: The Power of Diversity

https://www.youtube.com/watch?v=B-EGVQR9Aa4

> Over the last few years, the TS community has grown not only in size but also in diversity, integrating people from different cultures, ages and genders. We believe this has to do with the specific attraction that textiles generate. Every culture has a specific textile tradition which reaches directly into the daily lives of everyone, evocating both personal as well as collective memories, generating an affective field. The coding aspect allows rethinking this tradition from a contemporary point of view, creating a space that is open and not yet fully defined, inviting people to open experimental exploration.

> How this space is then explored, how the technical and the textile are combined, how machine and hand-craft are related and what kind of products -- tangible products of ones own learning and creativity -- are generated is deeply influenced by local conditions and personal preferences, providing the space of diverse articulation and, through the peer exchange on the platform, collaborative inspiration.

> In this talk, I will provide a short look back at the environment from which TurtleStitch emerged and give an overview of the current state. Voices from the TurtleStitch environment will provide their own perspectives on and use of TurtleStitch.

> Check out TurtleStitch at https://turtlestitch.org

In a nutshell or TL;DR for someone unwilling to put in the time and effort to learn or even consider evidence, and who talks about promoting curiosity but is incurious yourself, and who performatively refuses to recognize an obvious Nazi salute and feels compelled to repeatedly defend and praise Elon Musk after he does it twice in a row on international television: it's all about Constructionist Education, not promoting or showing off a product, or selling computer controlled embroidery machines, Arduinos, and robots, or even a cynical huckster perennially promising full self driving cars and trips to Mars.

https://en.wikipedia.org/wiki/Constructionism_(learning_theo...

> Constructionist learning is a theory of learning centred on mental models. Constructionism advocates student-centered, discovery learning where students use what they already know to acquire more knowledge.[1] Students learn through participation in project-based learning where they make connections between different ideas and areas of knowledge facilitated by the teacher through coaching rather than using lectures or step-by-step guidance.[1] Further, constructionism holds that learning can happen most effectively when people are active in making tangible objects in the real world. In this sense, constructionism is connected with experiential learning and builds on Jean Piaget's epistemological theory of constructivism.[2]

> Seymour Papert defined constructionism in a proposal to the National Science Foundation titled Constructionism: A New Opportunity for Elementary Science Education as follows:

Papert> The word constructionism is a mnemonic for two aspects of the theory of science education underlying this project. From constructivist theories of psychology we take a view of learning as a reconstruction rather than as a transmission of knowledge. Then we extend the idea of manipulative materials to the idea that learning is most effective when part of an activity the learner experiences as constructing a meaningful product.[3]

And that's not bullshit, just a toy, or disconnected from the real world, as you so wrongly claim. You're the one who's making unsupportable statements that are provably disconnected from the real world, my friend. And yours are knowingly false whoppers intended to offend sincere educators and defend trolling fascists, not polite white lies to spare people's feelings.


Where the heck did the sudden vitriol come from? I went through the HN comments of the person you're replying to and found nothing like the kind of thing you're replying to in the first several pages. If he said something months ago that you're bringing up, you might want to link to it, because at it stands it feels like you just suddenly started ranting about politics in the middle of a conversation about teaching kids to code. Which is... kind of offputting, you know?

Could we please try to follow the guidelines and not have flamewars and partisan dispute? Especially ones that seem to spring up out of nowhere, reviving conversations that are months old? I'm here to learn about cool new projects; if I want to read about politics or personal drama I have pretty much the entire rest of the Internet to do so.


Set showdead=true and you can see his fanatical arguments in defense of Musk's Nazi salutes, and attacks on other people who disagreed with him, which rightly got his multiple comments flagged dead.

His evidence-free Nazi-salute-defending arguments were in such bad faith, ignoring and refusing to address other people's valid counter arguments, the exact same way he is now ignoring and refusing to engage with mine, and sealioning questions whose very premises so wrong they don't deserve the answers I gave him anyway, that his old dead boot licking comments don't deserved to be linked or repeated, since they're a distraction from the useful things I actually linked to. The only thing his comments prove is that he's not arguing in good faith, and can only dispense drive-by evidence-free attacks.

You can easily find them yourself if you really don't believe me, but it's a waste of your time, because his comments have no value. Have you looked at any of those valuable links I did post yet, or did you just get stuck in the worthless rabbithole of his posting history?

I believe your time would be much better spent reading the links I already provided than his Musk cheerleading and oligarch water carrying and Nazi salute whitewashing. But if you really care about his arguments, why don't you ask him now to explain what he said about Musk, privately? Or doesn't he publish under his own name with his own email address so you can ask him, like I do?

I'm more than happy to answer your personal email about my own arguments and projects, and continue this discussion in private: don@donhopkins.com

His own ungrounded vitriolic words attacking Jens Mönig's and Brian Harvey's and Seymour Papert's life work like "it's because this is BS and just a toy, it's got no connection to the real world" and "like almost as if the ecosystem simply serves to show off Snap and thus misses the mark" are dismissive, insulting, and provably wrong.

So I posted several links and evidence refuting him and defending my friends. Yet then he repeated the same pattern as his full throated defense of Musk's Nazi salutes, by ignoring all the evidence, and reiterating his unsubstantiated false accusations, without providing any objective evidence or coherent arguments or even any citations himself.

If you'd like to learn about cool free open source educational projects, please look at the many links I already posted, and what I posted to the Logo discussion. At least spend as much time on those interesting relevent links as you already have wasted reading his uninteresing irrelevent posting history, please.

He didn't post any links or evidence or even coherent arguments to support his mistaken and aggressive accusations, while I refuted "this is BS" by linking to and quoting the Wikipedia page about Seymour Papert's Constructionist Education philosophy, "just a toy" by naming and linking to many Snap! projects and demos, and "no connection to the real world" by citing several physical real world connections like TurtleStitch.

Yet he dismissed and ignored all of that, and questioned the motives of sincere professional educators and developers of free open source software as merely and illegitimately promoting Snap!, because he isn't arguing in good faith, just attacking, and he didn't bother looking at any of the links, so he still doesn't know what he's talking about.

If reading his oligarch-syncophantic posting history (which I was trying to save you from by identifying where he's actually coming from) isn't interesting enough for you, and you still thirst to learn about cool projects, then please look at the links I already posted, read my other recent posts about Logo, and check out some of the other educational projects I've been developing over several decades, which were deeply inspired by Seymour Papert's Constructionism, that I've written a lot about.

But if like him you're so offput and triggered by the very mention of diversity, constructionist education, free speech for anyone but Musk, and criticism of an unloving parent so terrible and unaccepting that he publically and vitriolically disparages, abuses, and disowns his own trans daughter in front of millions of people that you have to leap to his defense, then there's nothing I can do for you, sir.

But I certainly hope you're not like that, so here are some links in good faith:

Logo Adventure for C64 Terrapin Logo:

https://donhopkins.medium.com/logo-adventure-for-c64-terrapi...

Micropolis: Constructionist Educational Open Source SimCity:

https://donhopkins.medium.com/har-2009-lightning-talk-transc...

This is Micropolis (open source SimCity) in WebAssembly:

https://micropolisweb.com/

This is The Sims 1 character animation system (which I original wrote in C++ 30 years ago) rewritten in TypeScript and WebGL:

https://vitamoo.space/

Micropolis and other open source code, documentation, and designs for new educational software:

https://github.com/SimHacker/MicropolisCore/

MOOLLM Constructionism skill:

https://github.com/SimHacker/moollm/blob/main/skills/constru...

MOOLLM Adventure skill:

https://github.com/SimHacker/moollm/tree/main/skills/adventu...

Adventure Compiler:

https://github.com/SimHacker/moollm/blob/main/skills/adventu...

Gary Drescher's Schema Mechanism skill from "Made Up Minds" (based on his PhD thesis and book about how children learn, with his advisor Marvin Minsky at the MIT AI Lab):

https://github.com/SimHacker/moollm/blob/main/skills/schema-...

MOOLLM Play Learn Lift skill:

https://github.com/SimHacker/moollm/tree/main/skills/play-le...


Don't worry, I didn't spend much time digging through comment history. Thanks for the links; I'm about to have to leave my computer and do something else for several hours, so I can't look at them right now. But since you replied to one of my comments it'll be easy to find them again via the "threads" link, so I'll look at them later when I'm back at the computer. (And I did look at the first one; Logo Adventure is exactly the kind of thing I love to come across, so thanks for that!)

I am generally not a huge fan of block-based coding, but I worked with the Snap folks while I was at UC Berkeley, and they make a very compelling case for both block-based coding and their functions-first approach.

While there, I helped develop this middle school curriculum for Snap: https://bjc.berkeley.edu/bjc-r/course/sparks.html

It was really interesting to attempt a functions-first approach that was still fun - I ended up re-making similar projects for a functions-first Python course as well.


I feel like HN shouldn't auto-capitalize "λ" in this instance. An anonymous function is a λ, not a Λ.

The website seems to put significant weight on the fact that it allows you to create your own block. I'd just like to point out that Scratch allows you to do that as well

A note to those commenters who complain that visual programming doesn't help you learn software engineering:

Right, you aren't our target audience. We're after the people who aren't going to major in computer science in college, but who're curious what all the fuss is about. They've taken high school algebra, so they know what a variable is and what a function is. (They don't have to know about functions as data, but we hope to teach them that.) These days, they probably used Scratch in elementary school, so we don't have to teach them the syntax of blocks, or what a sprite is, etc.

Nobody's going to come straight out of our class into a software engineering job. They'll have plenty of opportunity to learn that later, supposing that (as happens gratifyingly often) they change their minds about what to study in college because of our course.

They're not (or at least not yet) hackers, in the sense of people whose instinct on meeting a machine is to take it apart.

Oh, P.S., there is one sense in which block languages are better for software engineering: you can have arbitrarily long names of things (including spaces between words), because you only ever need to type the name once, so you can give your procedures self-documenting names such as "convert upper case to lower case letters" instead of ugly "convUcLc".


There's a limit to how long the name can be, even in Snap! — not an enforced limit as far as I know, but a practical one. You don't want the block you're dragging around to be thousands of pixels wide, it's very inconvenient. So people are naturally going to rename "convert all the upper case letters in the input text ___ into lower case letters" (where ___ represents the input slot) into "convert ___ to lower case" at some point, because they get tired of that one block being so much wider than every other block around it. (Edit to add: especially if they're snapping it into the input of a `map` block, which itself is the list input of "keep items (predicate) from (list)" block. That would get unwieldly really fast).

But you know some wag is going to paste the Pevear and Volokhonsky translation of War and Peace into a block name, just to see if he can. :-) So perhaps there does need to be an artificial limit, at 4096 characters or so, on block names.


Thank you for your work on Snap! and for finding the time to respond to our comments.

For those wondering the difference with scratch, it's on the about page:

> About Snap!

> Snap! (formerly BYOB) is a visual, drag-and-drop programming language. It is an extended reimplementation of Scratch (a project of the Lifelong Kindergarten Group at the MIT Media Lab) that allows you to Build Your Own Blocks. It also features first class[1] lists, first class procedures, and first class continuations[2]. These added capabilities make it suitable for a serious introduction to computer science for high school or college students.


Scratch already allows you to create custom Blocks and features lists. This seems like a perfect example of reinventing the wheel (and fragmenting development communities).

Snap implemented these features and others long before Scratch had. To my memory it might have been a decade earlier.

Actually there is a large historical overlap between the two communities -- warm, collaborative, always giving credit where due. Different goals, lots of feedback both ways.

Jens Mönig was on the Scratch Team (invited by Mitch Resnick). BYOB was presented at Scratch@MIT 2010 explicitly to merge ideas back into Scratch, not to fork the community:

https://scratched.gse.harvard.edu/resources/announcing-byob2...

Berkeley has kept showing up at Scratch conferences (Amsterdam 2015, Bordeaux 2017), and the Scratch forums hosted BYOB/Snap! discussion for years:

https://scratch.mit.edu/discuss/topic/4455/

So "NIH syndrome," "reinventing the wheel," and "fragmenting the community" is pretty much the opposite of how these two actually interact.

Documented cross-pollination:

BYOB => Scratch: custom blocks (Scratch 2.0 took command blocks only, not reporters/lambda). That was an explicit goal:

https://en.scratch-wiki.info/wiki/Snap!

Scratch => Snap!: browser rewrite timing influenced by Scratch 2.0 plans; Morphic via John Maloney; CC-licensed costumes/sounds used under license.

Shared people: Jens (Scratch Team => Snap! lead), John Maloney (Scratch/Morphic; GP session with Jens at Scratch2015AMS), Bernat Romagosa (Snap!, MicroBlocks, Snap4Arduino -- Bordeaux, Snap!Cons).


When I looked at Scratch six months ago, its lists were deliberately handicapped in function. They could only contain text or numbers; they could not contain other lists. Nor could they be passed as parameters to functions (!!), which really made me say "Nope, this is not what I'm going to use to teach programming to kids". I looked at Logo, and was drawing up lesson plans when I noticed Brian Harvey (the primary designer of Berkeley Logo which I was planning to use) had a lot of activity on this other repo. What in the world is https://github.com/jmoenig/Snap/ and why is Brian Harvey contributing to it so much? (Looks it up). Oh. OH.

And so I taught my class using Snap!, because it has:

- Lists that are proper first-class types, and can contain anything, including other lists, and also blocks

- Blocks (functions) that are also proper first-class types, and can take anything as parameters, including lists and blocks.

- Blocks that can create and return other blocks, thereby enabling functional programming

- All the standard list-handling primitives you would expect, like `filter` and `map`

All of which was missing from Scratch when I looked at it six months ago.

Scratch is a toy language, with a deliberate ceiling that you can't get past because of the language's design. Snap! is a real programming language with no ceiling, with the visual appearance of a toy. It takes longer to do anything in Snap! than in a professional language like Lisp or C# or Go or ... well, all of them, because dragging blocks together is a lot slower than typing. But you can do anything you need to in Snap!. There is no artificial limit that blocks you from going farther, the way Scratch has.

P.S. Saying that Scratch is artificially limited is not meant as a dig against the language. It's a deliberate design choice, and it's a fine choice if your intent is to teach people the very basics and then graduate them to another language. It's a choice I disagree with, because I prefer the way Snap! has implemented the same pedagogical choice (you can create tutorials with a limited set of blocks, to avoid presenting complete beginners with an overwhelming array of choices). But it's a defensible choice in many cases (many kids taking a programming class will not have the aptitude — and those who do turn out to have the knack for it can be graduated to Snap! really easily and not have to relearn everything).


Not to mention first class continuations! :)

Thanks!


Oh yeah, forgot about those! (I didn't teach them to beginners for obvious reasons). Those make it a Scheme rather than a Lisp.

And thank you for all your work not just on Snap!, but on Logo before that. You have done a lot for coding education.


I've been spending a lot of time with my nephews working on Scratch and Snap.

They also attend local classes and their teachers switched from Snap to this which is way simpler and stickier with my nephews: https://www.microsoft.com/en-us/makecode


Yeah, my nephew loved scratch but he's endlessly devoted to make code. I got him a little Gameboy thing that can play the games he builds, and he keeps sending me games of his and then mercilessly mocking me for not being good at them :(

A couple years ago I went through Flexbox Froggy with him out of curiosity, and the really interesting thing was that he was able to complete all the levels but only by dictating to me what to write, because his eye hand coordination wasn't yet up to the task of typing. He has a laptop now and he's getting better but his fingers just don't work very quickly and accurately yet. It's such an interesting thing developmentally that the visual coding approach is helpful for.


What device did you get your nephew? When I was looking for one, those listed on the Make Code website were pretty bad and expensive (or unavailable). I would love to find an affordable retro handheld like Miyoo or Anbernic with Make Code support.

I got the Elecfreaks Retro Arcade for Education, I'm sure it's not as bulletproof as an actual Gameboy so he uses it with his parents around rather than taking it everywhere with him, but it works!

Roughly how old was your nephew when he started using MakeCode?

I think four for scratch junior with help, and then make code at six? He wasn't able to use either of them independently at first, it's a learning process.

But it's different for every kid! He was a very early reader and he's autistic, one of the markers of his presentation of which is being ahead of some developmental benchmarks and behind on others. If you have the resources, those kids coding clubs are all over these days and they do a great job of making it a fun, social activity for a certain type of dorky kid.


Nice! Can this be used with a LEGO Wedo set? It would be cool to have some alternatives to the deprecated/unsupported official software, some of which no longer works (like the iOS app)

Nice! I did a few chapters of this when I was learning.

I'll have to add it to my list to go and check out any new updates/features they have.

I can NOT wait to get my little one into something like this!


I guess universities suffer from NIH-syndrome just as much as big tech does.

Not true in this case; the original intent for BYOB (Build Your Own Blocks) was as an extension to Scratch. When the Scratch team decided not to merge it, the BYOB folks decided to build it into Snap! instead of abandoning the perfectly-functional code they'd written.

Welcome to the esoteric church of functional programming!

Sure, you could use a Scratch for loop and be done with your cat piano program but have you considered constructing something that theoretically works like a for loop from obscure calculus?

We even have the occult symbol!

Joking aside, if base Scratch does lack a way to express trees as claimed Snap! may in fact be better from the perspective of teaching computer science concepts.


It did as of six months ago when I evaluated Scratch and chose Snap! instead for teaching the beginning-coding class I had signed up to teach. Scratch had lists, but they were only allowed to contain text or numbers, not other lists. To make a tree, you need to be able to nest lists inside other lists. Snap! allows lists to contain any kind of data, including other lists, or even blocks. And it allows blocks to take lists as input, which is another thing lacking from Scratch. Snap! also includes the standard basic list-manipulation functions like `filter` and `map`, which aren't in Scratch at all (naturally, since lists in Scratch can't be passed as input to blocks).

the "code" looks like the comment section from a tumblr post

Snap is a little intimidating compared to Scratch.

It's clearly designed for older students, but at that point some of the advantages of blocks are lost.

Most of these systems suffer from the 'canvas' model, where you have many stacks of blocks scattered around the canvas as they are created, possibly in no particular or logical order. It's difficult to find things or to get a good overview, and really becomes a navigation problem as projects get bigger. I think they would greatly benefit from a more traditional ide/file type structure, or some other way to structure 'stacks'.


In Snap! version 12 they have added the ability to create tutorials, which are projects that load up with a limited set of blocks (you choose what set is available when creating the tutorial). This fixes the intimidation problem: you can even create a set of tutorials that, if the student goes through them in the recommended order, teaches the basics with just four or five blocks available at first, then slowly introduces concepts over time.

TY I was not aware of that, it sounds extremely useful.

> inviting

My first attempt to place a statement (play sound at Hz) failed with a Type Error.

Android Chrome.


It's an odd quirk of Snap that they never cleaned up. Some blocks have a "friendly" error message. Delete a variable and uses of it get "Hmmm... a variable of name 'name' does not exist in this context". That one just regurgitates the JS error when it should say "You need to add and select a sound to play a sound".

Nor does it let me select a sound. The drop-down list is empty.

You have to add one, in the sounds tab you can record one, or in the file menu they have a library of them you can load (they also have libraries of sprites and backgrounds which are pretty useful when we use this with students).

Thanks. I think I misinterpreted inviting.

https://news.ycombinator.com/item?id=38016554

[...] I'm also a huge fan of Snap!, which has all the advantages of Logo (Lisp without parenthesis) and Scratch / eToys / Squeak / App Inventor family of block based visual programming languages, but all the power of Scheme.

If you know Scheme, then it's easy to think about Snap!: it's just Scheme with a visual block syntax, but with some functions renamed to make them easier to learn, plus all the stage and turtle graphics stuff from Scratch, running in a web browser!

I didn't realize until watching in amazement as Jens Mönig used his own creation, that it also has full keyboard support, so you can create and edit programs without using the mouse!

It's much easier to teach Scheme to kids by teaching them Snap!, because the user interface is so much better than a text editor.

I attended Snap!Con2023 in Barcelona recently, and we discussed some interesting possible extensions to Snap:

Grammar defining blocks. Right now you can create your own custom vocabularies of blocks that fit together in particular constrained ways, by writing JavaScript Snap! extensions. Develop a set of blocks for visually defining new grammars and vocabularies of custom parameterizable blocks.

For example, a grammar for representing plants with seeds, roots, stems, leaves, flowers, petals, etc. You can assemble and edit them manually by dragging and dropping from a palette, or write programs that generated and interpret and transform them, and pass them around as data, for example as instructions to the embroidery machine to sew, or logo turtle to draw.

Turtlestitch - Coded Embroidery:

https://www.turtlestitch.org/page/about

Ken Kahn led a discussion about integrating LLMs like ChatGPT with Snap!. He's the developer of eCraft2Learn for teaching kids AI programming. Ken recently made some cool Snap! extensions for integrating LLMs with the speech synthesis and recognition system, and orchestrating conversations between different characters.

Snap!Con2023: Creative uses of Snap! blocks using large language models like GPT:

https://www.youtube.com/watch?v=d2rNGsbzkXI

Enabling children and beginning programmers to build AI programs:

https://ecraft2learn.github.io/ai/

But when it comes to LLMs, code generation, and code understanding, JavaScript has two huge insurmountable advantages over Snap! or any other block based visual programming languages:

1) First of all it's extremely well known, by both humans and LLMs.

2) And second of all, there's typically no efficient and faithful way to textually represent block based programs in a way that ChatGPT (or humans) can easily understand and generate.

Of course you could just dump out the XML or JSON save file, but that wastes your token budget, and doesn't work well, because the LLM doesn't inherently understand the syntax and semantics of save files the way it deeply groks JavaScript.

You need to define some equivalent text based language to serialize and deserialize your visual programs, or define some equivalency to an existing language, so you can translate back and forth without loss.

Like Relax/NG has an XML syntax and also a simple concise human readable syntax, both which can express the same things.

But no matter what equivalent language you come up with to serialize your block programs into, it'll never be as well known as JavaScript (unless it IS JavaScript).

I think Snap! could take advantage of its equivalency with Scheme, and you could just parse Scheme into Snap! blocks, and the other way around. And ChatGPT knows scheme pretty well, though it's not as ubiquitous and standard as JavaScript.

Logo would not be as good as Scheme, since it has ambiguities, because you need to know the number of parameters a function uses in order to parse it, since it's essentially Lisp without parens. [...]


> I think Snap! could take advantage of its equivalency with Scheme, and you could just parse Scheme into Snap! blocks, and the other way around. And ChatGPT knows scheme pretty well, though it's not as ubiquitous and standard as JavaScript.

There's already a right-click menu option called "Lisp code". Take the "turn left 15 degrees" block (the "15" is the default value but of course it's a parameter that can be set to anything), drag it out into the editor, and right-click the block. Choose "Lisp code" and `(left 15)` will be displayed in a results bubble; you can then right-click the results bubble and export it to a file or copy it to the clipboard. If you have two blocks put together then the resulting Lisp code looks like this:

    (
        (left 15) 
        (move 10)
    )
I haven't checked recently to see if they have finished the other half of that feature, the parse-Lisp-into-blocks half. But I know they want it to be in there; I forget what its status was last time I checked.

You can use the split and join blocks to get the code and turn it back into blocks, but it's not well documented like I mentioned earlier. You split a ringified script "by blocks" to get a list version, which you can then use the "[text] of [list]" block (it's the one with length selected by default in the dropdown). That allows you to get the "Lisp" version in code.

Once you have the text version, you put it back into a split block set to split "by blocks", which gets the list version, which can then be put into the input list of a join block to get the code again.

This is technically discoverable from within Snap itself since they provide a library wrapping these steps, but it's not the first place you might look if you don't know it already exists.


Question (serious) - Why teach kids programming anymore?

The same reasons we keep on teaching kids to read, write, do math, sketch, take photos, etc ... because it is fun, empowering and important.

Most of them will never become professional actors, authors, mathematicians, artists, photographers, etc ... and yet they will rely on those skills, on their own or combined, pretty much every single day of their lives.


If you're thinking that LLMs will be doing all the coding, well, in my experience I get far better results from the model when I say "Write me a function that does X. It should take parameters Y and Z, and its validation step should check for conditions A, B, and C" than when I say "Write me a function that does X" without any further guidance. With no guidance, the LLM can run off in weird directions, and if you don't have any programming experience, you might not realize why those directions are bad ideas.

LLMs, at least the current crop, are skill multipliers. If your skill is positive and large, you'll get great results. If your skill is positive and small, you'll get small results. If your skill is negative, the LLM will harm you more than it helps you.


I'm a software engineer turned public middle school science teacher.

At the moment, I would never encourage any of my students to go into software engineering. It seems to me that's rapidly becoming a field where a small competitive handful will be making millions and everyone else will be unemployed.

That said, I have no problem teaching some programming. We're going to be making autonomous greenhouses soon, with windows that open or whatever, and they'll be using Scratch to program their micro:bits.

Anything that empowers you to do stuff is a good thing.


Programming encourages analytical thinking, and also if no-one learns to program it'll become magic, and that'll be a major societal step back.

Why build pine wood derby cars? Why paint pictures? Or take photographs? Why memorize poetry? Why build things with Legos?

Because it makes your brain think through problems, breaking them down to the point you can build a solution from the smallest pieces. AI may be a big part of the future, but we need to maintain our own human creativity and problem solving skills, and learning the tools that are available will help us to build and create useful things throughout our lives.


Why do we teach them to add and multiply we have calculators?

Why do we teach them to read, we have text to voice?

Why do we teach them to broom, we have Roombas?

Why do we teach them to do the dishes, we have dish-washers?

</sarcasm>


Where is the opening <sarcasm> tag?

Because programming is fun



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: