Snap! (programming language)

Last updated
Snap! [Note 1]
Snap!.svg
Snap! Logo
Paradigm object-oriented, educational, event-driven
Designed by Brian Harvey and Jens Mönig
Developer Jens Mönig
First appeared2011;13 years ago (2011)
Stable release
9.0.10 / November 1, 2023;5 months ago (2023-11-01) [1]
Typing discipline dynamic
Implementation languageMorphic.js [2] (written in JavaScript); [Note 2]
OS Cross-platform
License AGPL
Filename extensions .xml (Snap!)
Website snap.berkeley.edu
Influenced by
Scratch, Scheme, Logo, Smalltalk
Influenced
BeetleBlocks, NetsBlox, Dragme IDE, Turtlestitch

Snap! (formerly Build Your Own Blocks) is a free block-based educational graphical programming language and online community. Snap allows students to explore, create, and remix interactive animations, games, stories, and more, while learning about mathematical and computational ideas. While inspired by Scratch, Snap! has many advanced features. The Snap! editor, and programs created in it, are web applications that run in the browser (like Scratch 3) without requiring installation. [Note 3] It is built on top of Morphic.js, [2] a Morphic GUI, written by Jens Mönig as 'middle layer' between Snap! itself and 'bare' JavaScript.

Contents

User interface

In Snap!, the screen is organized in three resizable columns containing five regions: the block group selector (top of left column), the blocks palette (left column), the main area (middle column), and the stage area (top of right column) with the sprite selector (also called the sprite corral) showing sprite thumbnails below it. [Note 4]

In the interactively resizable stage area are shown the graphical results of the scripts running in the script area and/or interactively double-clicked individual blocks in any palette. Individual blocks can be dragged from the palette onto the scripts area to be associated with the selected sprite.

CategoryNotesCategoryNotes
 MotionMoves and turns sprites ControlIf statements, events,
loop structures,
scenes, OOP,
metaprogramming
 LooksControls visibility,
costumes, and output
 SensingAll sprite hit detection
and user input
 SoundPlays audio files and
programmable sequenced audio
 OperatorsMathematical, text, and
Boolean operators; lambda
 PenWrite, draw, or
stamp on stage
 VariablesVariables, lists,
including lists of lists, lists

of blocks, etc

Three resizable columns, containing five regions, in Snap!'s IDE at startup Snap! Default interface.png
Three resizable columns, containing five regions, in Snap!'s IDE at startup

Snap!'s blocks are divided into eight groups: Motion, Looks, Sound, Pen, Control, Sensing, Operators, and Variables. The layout of these groups in the block group selector is shown in the table below.

The central area can show scripts, costumes/backdrops, or sounds associated with the selected sprite. What that area shows depends on the selected tab.

Features

The most important features that Snap! offers, but Scratch does not, include:

Mascot

Alonzo, the mascot of Snap!, bears the name of Alonzo Church, the inventor of a model of computation in which a universal function, represented by lambda, can create any function behavior by calling it on itself in various combinations. The mascot is a modified version of Gobo from Scratch, with permission of the Scratch team. Because Alonzo Church's work is called lambda calculus, the mascot's hair is shaped as the Greek letter lambda.

Special-purpose blocks (libraries)

Extended sets of blocks can be found in Snap! libraries, such as the 'streams' library that enables one to make the complete, infinite Fibonacci sequence, for example, using the special blocks ('stream', 'show stream', 'tail of stream', and 'map ( ) over stream' block) from the library.

Many other libraries are available, such as the 'list utilities' library, the 'words, sentences' library, the 'iterations' library, the 'animation' library, the 'frequency distribution' library, the 'audio computation' library, the 'bar charts' library, the 'world map' library, the 'colors and crayons' library, the 'strings and multi-line input' library, the 'parallelization' library, etc. for other special purposes.

Limitations

While the software itself has little restraints, it does have some limitations.

These include as follows:

History

The web-based Snap! and older desktop-based BYOB were both developed by Jens Mönig for Windows, OS X and Linux [3] with design ideas and documentation provided by Brian Harvey [4] from University of California, Berkeley and have been used to teach "The Beauty and Joy of Computing" introductory course in computer science (CS) for non-CS-major students. [5] Jens was a member of the Scratch Team before creating Snap!. [6] BYOB is still available for downloading.

License

The source code of Snap! is GNU Affero General Public License (AGPL) licensed and is hosted on GitHub. [7] The earlier, desktop-based 3.x version's code is available under a license that allows modification for only non-commercial uses and can be downloaded from the UC Berkeley website [8] or CNET's download.com and TechTracker download page. [9] [10]

Platforms

Snap! runs on the major web-browsers on Windows, iOS, MacOS and Linux devices.

Supported web-browsers such as

Implementation

Snap! is built on top of Morphic.js, [2] a Morphic GUI, which serves as 'middle layer' between Snap! itself and 'bare' JavaScript. It uses an HTML5 Canvas application programming interface (API).

All things visible in Snap! are morphs themselves, i.e. all buttons, sliders, dialog boxes, menus, entry fields, text rendering, blinking cursors etc. are created with morphic.js rather than using HTML DOM elements. Snap! caches the shapes of sprites so the sprite doesn't have to be re-drawn onto a new Canvas element every time the mouse moves over its bounding box. It does not cache blocks, however. Instead it manages the insides of C-shaped blocks through the morphic "holes" mechanism.

All user interaction is triggered by events, which are passed on from the root element "the world" to its submorphs. Dropping a morph causes it to become embedded in a new 'owner' ('parent') morph. In Morphic the preferred way to run an animation is to register it with the World by adding it to the World's animation queue. The World steps each registered animation once per display cycle independently of the Morphic stepping mechanism.

Recognition

Snap! has been recognized by the Logo Foundation, [11] and reviewed in an online magazine for programmers. [12] As of December 2014, 100 New York City (NYC) high schools introduced University of California, Berkeley's “Beauty and Joy of Computing” as a new AP Computer Science Principles course, using Snap!. [13] Jens and Brian received the National Technology Leadership Summit (NTLS) 2020 Educational Leadership Award for lifetime achievement based in part on Snap!.

Notes

  1. The software's version is 9.0.1.
  2. BYOB was written in Squeak.
  3. BYOB, Snap!'s predecessor, was a modification of Scratch and could export projects as Windows executables.
  4. The way pre-2.0 Scratch version's screen was organized.

Related Research Articles

<span class="mw-page-title-main">Squeak</span> Object-oriented programming language

Squeak is an object-oriented, class-based, and reflective programming language. It was derived from Smalltalk-80 by a group that included some of Smalltalk-80's original developers, initially at Apple Computer, then at Walt Disney Imagineering, where it was intended for use in internal Disney projects. The group would later go on to be supported by HP Labs, SAP, and most recently, Y Combinator.

<span class="mw-page-title-main">Visual programming language</span> Programming language written graphically by a user

In computing, a visual programming language, also known as diagrammatic programming, graphical programming or block coding, is a programming language that lets users create programs by manipulating program elements graphically rather than by specifying them textually. A VPL allows programming with visual expressions, spatial arrangements of text and graphic symbols, used either as elements of syntax or secondary notation. For example, many VPLs are based on the idea of "boxes and arrows", where boxes or other screen objects are treated as entities, connected by arrows, lines or arcs which represent relations. VPLs are generally the basis of Low-code development platforms.

Morphic is an interface construction environment which uses graphical objects called "Morphs" for simplified GUI-building which allow for flexibility and dynamism. It was originally created for Self, but later, was ported to other programming languages like Squeak, JavaScript, Python, and Objective-C.

<span class="mw-page-title-main">Greasemonkey</span> Userscript manager extension for Firefox

Greasemonkey is a userscript manager made available as a Mozilla Firefox extension. It enables users to install scripts that make on-the-fly changes to web page content after or before the page is loaded in the browser.

<span class="mw-page-title-main">YUI Library</span>

The Yahoo! User Interface Library (YUI) is a discontinued open-source JavaScript library for building richly interactive web applications using techniques such as Ajax, DHTML, and DOM scripting. YUI includes several cores CSS resources. It is available under a BSD License. Development on YUI began in 2005 and Yahoo! properties such as My Yahoo! and the Yahoo! front page began using YUI in the summer of that year. YUI was released for public use in February 2006. It was actively developed by a core team of Yahoo! engineers.

<span class="mw-page-title-main">Scratch (programming language)</span> Programming language learning environment

Scratch is a high-level, block-based visual programming language and website aimed primarily at children as an educational tool, with a target audience of ages 8 to 16. Users on the site can create projects on the website using a block-like interface. Scratch was conceived and designed through collaborative National Science Foundation grants awarded to Mitchel Resnick and Yasmin Kafai. Scratch is developed by the MIT Media Lab and has been translated into 70+ languages, being used in most parts of the world. Scratch is taught and used in after-school centers, schools, and colleges, as well as other public knowledge institutions. As of 15 February 2023, community statistics on the language's official website show more than 123 million projects shared by over 103 million users, over 804 million total projects ever created, and more than 95 million monthly website visits.

<span class="mw-page-title-main">Brian Harvey (lecturer)</span> American computer scientist

Brian Keith Harvey is a former Lecturer SOE of computer science at University of California, Berkeley. He and his students developed an educational programming language named UCBLogo which is free and open-source software, a dialect of the language Logo, as an interpreter, for learners.

<span class="mw-page-title-main">Node.js</span> JavaScript runtime environment

Node.js is a cross-platform, open-source JavaScript runtime environment that can run on Windows, Linux, Unix, macOS, and more. Node.js runs on the V8 JavaScript engine, and executes JavaScript code outside a web browser.

Cocos2d is an open-source game development framework for creating 2D games and other graphical software for iOS, Android, Windows, macOS, Linux, HarmonyOS, OpenHarmony and web platforms. It is written in C++ and provides bindings for various programming languages, including C++, C#, Lua, and JavaScript. The framework offers a wide range of features, including physics, particle systems, skeletal animations, tile maps, and others.

<span class="mw-page-title-main">Amber Smalltalk</span>

Amber Smalltalk, formerly named Jtalk, is an implementation of the programming language Smalltalk-80, that runs on the JavaScript runtime of a web browser. It is designed to enable client-side development using Smalltalk. The programming environment in Amber is named Helios.

<span class="mw-page-title-main">Three.js</span> JavaScript library for 3D graphics

Three.js is a cross-browser JavaScript library and application programming interface (API) used to create and display animated 3D computer graphics in a web browser using WebGL. The source code is hosted in a repository on GitHub.

<span class="mw-page-title-main">PDF.js</span> PDF viewer in JavaScript included in Mozilla Firefox

PDF.js is a JavaScript library that renders Portable Document Format (PDF) files using the web standards-compliant HTML5 Canvas. The project is led by the Mozilla Corporation after Andreas Gal launched it in 2011.

<span class="mw-page-title-main">Blockly</span> JavaScript library

Blockly is a client-side library for the programming language JavaScript for creating block-based visual programming languages (VPLs) and editors. A project of Google, it is free and open-source software released under the Apache License 2.0. It typically runs in a web browser, and visually resembles the language Scratch.

Velocity is a cross-platform JavaScript library designed to simplify the client-side scripting of website animation. Velocity is free, open-source software licensed under the MIT License. It is the most popular open source web animation engine.

<span class="mw-page-title-main">Vue.js</span> Open-source JavaScript library for building user interfaces

Vue.js is an open-source model–view–viewmodel front end JavaScript library for building user interfaces and single-page applications. It was created by Evan You, and is maintained by him and the rest of the active core team members.

<span class="mw-page-title-main">Phaser (game framework)</span> Cross-platform JavaScript video game framework

Phaser is a 2D game framework used for making HTML5 games for desktop and mobile. It is free software developed by Photon Storm.

Next.js is an open-source web development framework created by the private company Vercel providing React-based web applications with server-side rendering and static website generation.

<span class="mw-page-title-main">Decentraleyes</span> Browser extension

Decentraleyes is a free and open-source browser extension used for local content delivery network (CDN) emulation. Its primary task is to block connections to major CDNs such as Cloudflare and Google and serve popular web libraries locally on the user's machine. Decentraleyes is available for Microsoft Edge, Mozilla Firefox + Firefox ESR, Google Chrome, Pale Moon and Opera web browsers.

<span class="mw-page-title-main">GDevelop</span> Open-source, cross-platform game engine

GDevelop is a 2D and 3D cross-platform, free and open-source game engine, which mainly focuses on creating PC and mobile games, as well as HTML5 games playable in the browser. Created by Florian Rival, a software engineer at Google, GDevelop is mainly aimed at non-programmers and game developers of all skillsets, employing event based visual programming similar to engines like Construct, Stencyl, and Tynker.

<span class="mw-page-title-main">Turtlestitch</span> Embroidery platform

Turtlestitch is a free and open source platform for generating and sharing patterns for embroidery machines. Turtlestitch is derived from educational programming languages such as Logo, Scratch and Snap! using the same jigsaw style programming paradigm which offers simplicity suitable for novices but has powerful features, described as ‘low threshold, high ceiling’ by Seymour Papert. Its microworld is a turtle representing the needle of a programmable embroidery machine. Turtlestitch can be used for creating novel patterns for embroidery, combining the abstract logic of computing and the physical materiality of textiles. Its primary use is educational, as it offers a way of introducing programming to audiences with diverse interests. A growing gallery of open source embroidery designs enables community-based collaboration and shared learning. In 2017, Turtlestitch received the award for the best Open Educational Resource in the German-speaking countries.

References

  1. "jmoenig/Snap". GitHub. Retrieved November 1, 2023.
  2. 1 2 3 Mönig, Jens. "morphic.js". GitHub. Retrieved 7 June 2023.
  3. "Scratch - Imagine, Program, Share". scratch.mit.edu. Retrieved 21 May 2017.
  4. "HomePage for Brian Harvey (bh@cs.Berkeley.EDU)". people.eecs.berkeley.edu/~bh/. Retrieved 19 January 2019.
  5. "UC Berkeley EECS - CS10 : The Beauty and Joy of Computing - Fall 2011". inst.eecs.berkeley.edu. Retrieved 21 May 2017.
  6. "Relationship With the Scratch Team - Politics - Snap! Forums". forum.snap.berkeley.edu. Archived from the original on 2020-01-02.
  7. "jmoenig/Snap". GitHub. Retrieved 21 May 2017.
  8. "Snap! (Build Your Own Blocks) 4.0". snap.berkeley.edu. Retrieved 21 May 2017.
  9. CNET Download.com and CNET TechTracker's BYOB for Windows download page
  10. CNET's Download.com and TechTracker BYOB for Mac download page
  11. "Logo History". el.media.mit.edu. Retrieved 21 May 2017.
  12. Editor. "Visual Language Snap! Version 4.0 Released". i-programmer.info. Retrieved 21 May 2017.{{cite web}}: |last= has generic name (help)
  13. "FACT SHEET: New Commitments to Support Computer Science Education". obamawhitehouse.archives.gov. 8 December 2014. Retrieved 20 January 2019.