logoalt Hacker News

Λ Snap – An inviting programming language for kids and adults for CS study

71 pointsby dr_kiszonkatoday at 5:36 PM45 commentsview on HN

Comments

aspizutoday at 7:49 PM

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.

show 1 reply
sinuhe69today at 6:07 PM

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.

Dwedittoday at 7:39 PM

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

show 2 replies
andrewlatoday at 6:17 PM

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.

show 3 replies
stymaartoday at 5:50 PM

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.

show 1 reply
jc4ptoday at 6:13 PM

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

anguishetoday at 6:08 PM

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!

smlacytoday at 6:14 PM

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

k2xltoday at 7:23 PM

Question (serious) - Why teach kids programming anymore?

show 6 replies
chrisjjtoday at 7:25 PM

> inviting

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

Android Chrome.

show 1 reply
DonHopkinstoday at 6:57 PM

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. [...]