Hacker News new | past | comments | ask | show | jobs | submit login
Scratch in the Browser (squeak.js.org)
80 points by andsoitis 3 months ago | hide | past | favorite | 17 comments

Also see Snap!, a fork of scratch3 (the js-only version, not the squeakvm-in-the-browser versrion from TFA). https://snap.berkeley.edu/

Snap! is made by folks previously involved in Berkeley Logo, and has a lot of "missing pieces" that make organizing programs easier: lambdas, cc, and binding functions to definitions (aka build-your-own-blocks).

It actually isn't a fork of Scratch3 but was started way back in Scratch1.4 as a JS implementation using Morphic which was inspired by Squeak. It is really good software and IMO is better than Scratch since it provides the tools to scale up from the toy programs Scratch is optimized for.

The nostalgia is overwhelming. This (Scratch 1.4) is where I learned how to write and read computer programs. In a way, this environment is my home.

Unfortunately, keyboard input doesn't seem to work. Try making a

    [Forever if <Key Space Pressed> 
      [Say "hello"]]
script and it doesn't seem to react to space key presses. (Chrome browser on Linux)

The exciting thing here is that this runs on Squeak in JavaScript. Squeak is a modern Smalltalk, and now it can obviously be run on top of JavaScript. That's dynamic languages all the way down!

JavaScript is usually implemented in a statically-typed language like C++, so not all the way down.

Can this browser virtual machine be used with Pharo images as well? I enjoy it, but my time programming in Pharo took a hit in the past months, because my workplace tightened the restrictions on software allowed on workstations, so I don't have it installed at my work machine anymore. Currently only Python, R, PowerShell, spreadsheets and the browser JavaScript are available, leaving me the weekends to play with everything else.

Isn't scratch always in the browser? I'm confused.

No, when Scratch first came out it was a stand-alone Squeak Smalltalk image that you ran locally. There was a Java-based online viewer, but no editor.

Then it moved to a Flash version. If I remember right, this was at least somewhat motivated by vendors dropping Java support in the browser. Of course, at almost the same time the Flash version came out, vendors started dropping support for that.

The current one is written in JavaScript, I believe. Edit: it's still running Squeak, but using a JavaScript Squeak interpreter. See the top-level site for the given link.

To be clear, the current version of Scratch (version 3) is written in Javascript and other web technologies.

TFA isn't the current version of Scratch. It's Scratch 1.4—which was written in Smalltalk—running in a browser via Squeak.

If you've used modern Scratch, it's interesting to see what has changed (and what hasn't).

Ah, thanks. I must've missed a version or two somewhere along the way.

Scratch 2.0 did use flash. The version this site uses was based on smalltalk.

There was a Squeak web browser plugin early on so you could run Etoys or Scratch that way. Unfortunately they found out that schools had a very short list of browser plugins they allowed on their computers. Flash was included, Squeak was not. They failed to change that after years of trying.

This motivated the MIT guys to port Scratch to Flash (very bad timing) and the ex Squeak guys to focus on Javascript (Lively Kernel and other projects).

This is a very early version of scratch that was written in smalltalk. The current version is written in JS (desktop app is electron based)

For those keen on exploring visual programming with children, I recommend visiting the following websites:

  - MakeCode for micro:bit [1]
  - MakeCode Arcade[2]

  [1] https://makecode.microbit.org
  [2] https://arcade.makecode.com

May I ask why you prefer MakeCode over (modern) Scratch?

As someone who's dabbled in both MakeCode and Scratch, I think there are a few solid reasons to lean towards MakeCode, especially in an educational context:

- Hardware Integration: MakeCode shines with its support for various microcontrollers like the BBC micro:bit and Adafruit Circuit Playground. It’s a game-changer for classes focusing on electronics or physical computing.

- Ease of Transition to Text Coding: Unlike Scratch, MakeCode lets you flip between block-based and JavaScript code. It’s a neat feature for students transitioning to text-based languages.

- Curriculum Tailoring: MakeCode often comes with tailored projects and curricula, especially useful when you have specific learning goals around hardware.

- Practical Applications: The ability to create physical devices or interactive projects with MakeCode can be really engaging for students, showing them the real-world impact of their coding.

- Community and Resources: Depending on where you are and what you need, the MakeCode community and resources might just align better with your teaching needs.

That said, it really boils down to what you're trying to achieve. Scratch is still king for introducing the very basics of programming and fostering creativity, especially for younger or less experienced coders.

MakeCode falls short in many aspects compared to Scratch, lacking features like broadcasting and real-time block execution support. MicroBlocks (https://microblocks.fun) might be a better alternative as it offers the same ease of use as Scratch but for hardware. MicroBlocks was created by John Maloney, who was also the primary implementer of the original Scratch.

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