Snap! (programming language): Difference between revisions

Content deleted Content added
No edit summary
No edit summary
 
(242 intermediate revisions by more than 100 users not shown)
Line 1:
{{Short description|Block-based programming language}}
:''"BYOB" redirects here. For other uses, see [[BYOB (disambiguation)]].
{{About|the blocks-based programming language|the 1960s educational language|SNAP (programming language)}}
{{DISPLAYTITLE:Snap''!'' (programming language)}}
{{Infobox programming language
| name = BYOBSnap''!''
| logo = [[File:The BYOB "logo" and mascotSnap!..pngsvg|The BYOB "logo" and mascote200px]]
| logo size = 90PX
| paradigm = [[Object-oriented programming|object-oriented]], [[educational programming language|educational]], [[Event-driven programming|event-driven]]
| year = {{start date and age|2011}}
| designer = [[Brian Harvey (lecturer)|Brian Harvey]] and [https://github.com/jmoenig/ Jens Mönig]
| designer =
| developer = [httphttps://scratchgithub.mit.educom/usersjmoenig/Jens Jens Mönig]
| latest_release_versionlatest release version = 310.17.12
| latest release date = {{Start date and age|2025|5|5}} <ref>{{cite web|url=https://github.com/jmoenig/Snap/releases|title=jmoenig/Snap|website=GitHub|access-date=May 5, 2025}}</ref>
| latest_release_date = May 19, 2011
| typing = [[Type system|dynamic]]
| implementations =
| programming language = Morphic.js<ref name="morphic_js">{{cite web |last1=Mönig |first1=Jens |title=morphic.js |url=https://github.com/jmoenig/morphic.js/blob/master/morphic.txt |website=GitHub |accessdate=7 June 2023}}</ref> (written in [[JavaScript]]); {{#tag:ref|BYOB was written in [[Squeak]].|group=Note}}
| programming_language =
| dialects =
| influenced_byinfluenced by = [[Scratch (programming language)|open-sourceScratch]], early[[Scheme computer(programming language)|Scheme]], learning[[Logo environment(programming Scratchlanguage)|Logo]], [[Smalltalk]], [[APL (programming language) | APL]]
| influenced = [[Scratch (programming language)|Scratch]], BeetleBlocks, NetsBlox, Dragme IDE, [[Turtlestitch]]
| influenced =
| operating system = [[Cross-platform]]
| operating_system =
| license = [[OpenAffero source]]General withPublic [[proprietary softwareLicense|proprietaryAGPL]] components
| website = [http://byob.berkeley.edu/ byob{{URL|snap.berkeley.edu/]}}
| file_extfile ext = .yprxml (Snap''!'')
}}
 
'''Snap''!''''' (formerly Build Your Own Blocks) is a free block-based [[List of educational programming languages|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 (programming language)|Scratch]], Snap''!'' has many advanced features. The Snap''!'' editor, and programs created in it, are [[web application]]s that run in the browser (like [[Scratch (programming language)|Scratch]]) without requiring [[Installation (computer programs)|installation]].{{#tag:ref|BYOB, Snap''!''{{'}}s predecessor, was a modification of Scratch and could export projects as [[Portable Executable|Windows executables]].|group=Note}} It is built on top of ''Morphic.js'',<ref name="morphic_js">{{cite web |last1=Mönig |first1=Jens |title=morphic.js |url=https://github.com/jmoenig/morphic.js/blob/master/morphic.txt |website=GitHub |accessdate=7 June 2023}}</ref> a [[Morphic (software)|Morphic]] GUI, written by Jens Mönig as 'middle layer' between Snap! itself and 'bare' JavaScript.
'''BYOB''' is an [[open-source]] early [[educational programming language|computer language]] learning environment, featuring custom (build your own) blocks, first class procedures (lambda), first class lists (including lists of lists), and first class truly object oriented sprites with prototyping inheritance, which are not part of [[Scratch programming language|Scratch]] it is based upon.<ref>[http://download.cnet.com/BYOB-Build-Your-Own-Blocks/3000-20415_4-75629082.html BYOB] at [[CNET Download]].com and CNET TechTracker</ref>
 
==User interface==
BYOB can be installed and freely redistributed on any [[Microsoft Windows|Windows]], [[Mac OS X]] or [[Linux]] computer. The open-source code is made available under a license that allows modifications for non-commercial uses and can be downloaded from the UC Berkely website <ref>[http://byob.berkeley.edu/ BYOB download page http://byob.berkeley.edu/]</ref>.
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.{{#tag:ref|The way pre-2.0 Scratch version's screen was organized.|group=Note}}
 
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.
BYOB was developed by Jens Mönig<ref>[http://scratch.mit.edu/users/Jens Jens Mönig user contributions page]</ref> <ref>[http://www.chirp.scratchr.org/blog/?m=201105 Mönig's blog post announcing BYOB as bringing protypal inheritance to Scratch]</ref> with documentation provided by Brian Harvey <ref>[http://scratch.mit.edu/users/bharvey Brian Harvey user contributions page]</ref><ref>[http://www.eecs.berkeley.edu/~bh/ Brian Harvey's homepage]</ref> from [[University of California, Berkeley]] and has been used to teach "The Beauty and Joy of Computing" introductory course in CS for non-CS-major students <ref>[http://inst.eecs.berkeley.edu/~cs10/fa11/ The Beauty and Joy of Computing course homepage]</ref>.
 
{| class="wikitable floatright" style="text-align: left"
==See also==
|-
* [[Scratch programming language]]
! colspan="2" style="background: #efefef;" | Category !! Notes !! colspan="2" style="background: #efefef;" | Category !! Notes
|- valign="top"
| bgcolor="#4A6CD4"| &nbsp; || Motion || Moves and turns sprites || bgcolor="#E1A91A" | &nbsp; || Control || If statements, events,<br />loop structures,<br />scenes, OOP,<br />metaprogramming
|- valign="top"
| bgcolor="#8A55D7"| &nbsp; || Looks || Controls visibility, <br />costumes, and output || bgcolor="#2CA5E2"| &nbsp; || Sensing || All sprite hit detection<br />and user input
|- valign="top"
| bgcolor="#BB42C3"| &nbsp; || Sound || Plays audio files and <br />programmable sequenced audio || bgcolor="#5CB712"| &nbsp; || Operators || Mathematical, text, and<br />Boolean operators; lambda
|- valign="top"
| bgcolor="#0E9A6C"| &nbsp; || Pen || Write, draw, or<br />stamp on stage || bgcolor="#C88330"| &nbsp; || Variables || Variables, lists,<br />including lists of lists, lists of blocks, etc
|}
[[File:Snap! Default interface.png|thumb|left|420px|''Three resizable columns, containing five regions, in Snap!'s [[Integrated development environment|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.
==References==
{{clear}}
{{Commons category}}
==Features==
The most important features that Snap''!'' offers, but Scratch does not, include:
* Expressions using anonymous functions, represented by a block inside a gray ring, having one or more empty slot(s)/argument(s) that are filled by a "higher order function" (the one that is calling the anonymous one). (Their computer-science theoretical basis is [[first class function]]s, which in turn have [[lambda calculus]] as their even more abstract and mathematical foundation)
* Lists that are [[First class object|first class]] (including ''lists of lists/arrays'')
* ''First class'' sprites (or in other words, [[prototype-based programming]])
* "Hyperblocks": functions whose natural ___domain is scalars (text or numbers), extended to accept lists as inputs and apply the underlying function to the scalars in the list or a sublist
* Nestable sprites
* Codification of Snap''!'' programs to text languages such as [[Python (programming language)|Python]], JavaScript, [[C (programming language)|C]], etc.
* [[Metaprogramming]], reflection, and macros
 
==Mascot==
{{reflist}}
[[File:Snap! mascot, Alonzo.svg|50px|right]]
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 (programming language)|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)==
== External links ==
Extended sets of blocks can be found in Snap''!'' libraries, such as the [[Stream (computer science)|'streams']] library that enables one to make the complete, infinite [[Corecursion#Fibonacci sequence|Fibonacci sequence]], for example, using the special blocks ('stream', 'show stream', 'tail of stream', and 'map ( ) over stream' block) from the library.
* {{official website|http://byob.berkeley.edu/}}
* [http://download.cnet.com/BYOB-Build-Your-Own-Blocks/3000-20415_4-75629082.html BYOB] at [[CNET Download]].com and CNET TechTracker
 
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.
{{DEFAULTSORT:BYOB (Programming Language)}}
 
== Limitations ==
[[Category:Visual programming languages]]
While the software itself has little restraints, it does have some limitations.
[[Category:Smalltalk programming language family]]
 
These include:
 
* No native cloud variables
* 10 [[megabyte]] file cap for uploading (Snap''!'' Cloud only)
* Users have to manually enable Javascript when loading a project that uses inline bits of JS, due to a hack a few years ago.
 
==History==
The web-based Snap''!'' and older desktop-based BYOB were both developed by Jens Mönig for [[Microsoft Windows|Windows]], [[OS X]] and [[Linux]]<ref>{{cite web|url=http://scratch.mit.edu/users/Jens|title=Scratch - Imagine, Program, Share|website=scratch.mit.edu|access-date=21 May 2017}}</ref> with design ideas and documentation provided by [[Brian Harvey (lecturer)|Brian Harvey]]<ref>{{cite web|url=https://people.eecs.berkeley.edu/~bh/|title=HomePage for Brian Harvey (bh@cs.Berkeley.EDU)|website=people.eecs.berkeley.edu/~bh/|access-date=19 January 2019}}</ref> 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.<ref>{{cite web|url=http://inst.eecs.berkeley.edu/~cs10/fa11/|title=UC Berkeley EECS - CS10 : The Beauty and Joy of Computing - Fall 2011|website=inst.eecs.berkeley.edu|access-date=21 May 2017}}</ref> Jens was a member of the Scratch Team before creating ''Snap!''.<ref>{{cite web |url=https://forum.snap.berkeley.edu/t/relationship-with-the-scratch-team/1277/2 |title=Relationship With the Scratch Team - Politics - Snap! Forums |website=forum.snap.berkeley.edu |url-status=dead |archive-url=https://web.archive.org/web/20200102174250/https://forum.snap.berkeley.edu/t/relationship-with-the-scratch-team/1277/2 |archive-date=2020-01-02}}</ref> BYOB is still available for downloading.
 
==License==
The source code of Snap''!'' is [[Affero General Public License|GNU Affero General Public License]] (AGPL) licensed and is hosted on [[GitHub]].<ref>{{cite web|url=https://github.com/jmoenig/Snap/|title=jmoenig/Snap|website=GitHub|access-date=21 May 2017}}</ref> 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<ref>{{cite web|url=http://snap.berkeley.edu/|title=Snap! (Build Your Own Blocks) 4.0|website=snap.berkeley.edu|access-date=21 May 2017}}</ref> or [[CNET]]'s [[download.com]] and TechTracker download page.<ref>CNET Download.com and CNET TechTracker's [http://download.cnet.com/BYOB-Build-Your-Own-Blocks/3000-20415_4-75629466.html BYOB for Windows] download page</ref><ref>CNET's Download.com and TechTracker [http://download.cnet.com/BYOB-Build-Your-Own-Blocks/3000-20415_4-75629082.html BYOB for Mac] download page</ref>
 
==Platforms==
Snap! runs on the major web-browsers on [[Microsoft Windows|Windows]], [[iOS]], [[MacOS]] and [[Linux]] devices.
 
Supported web-browsers such as
 
* Firefox
* Chrome (and most Chromium based browsers.)
* Opera GX
* Microsoft Edge
* Safari
 
==Implementation==
Snap''!'' is built on top of ''Morphic.js'',<ref name="morphic_js">{{cite web |last1=Mönig |first1=Jens |title=morphic.js |url=https://github.com/jmoenig/morphic.js/blob/master/morphic.txt |website=GitHub |accessdate=7 June 2023}}</ref> a [[Morphic (software)|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 [[Sprite (computer graphics)|sprite]]s 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,<ref>{{cite web|url=http://el.media.mit.edu/logo-foundation/what_is_logo/history.html|title=Logo History|website=el.media.mit.edu|access-date=21 May 2017}}</ref> and reviewed in an online magazine for programmers.<ref>{{cite web|url=http://www.i-programmer.info/news/98-languages/8628-visual-language-snap-version-40-released.html|title=Visual Language Snap! Version 4.0 Released|first = Sue|last=Gee|website=i-programmer.info|access-date=21 May 2017}}</ref> 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''!''.<ref>{{cite web|url=https://obamawhitehouse.archives.gov/the-press-office/2014/12/08/fact-sheet-new-commitments-support-computer-science-education|title=FACT SHEET: New Commitments to Support Computer Science Education|date=8 December 2014|website=obamawhitehouse.archives.gov|access-date=20 January 2019}}</ref> Jens and Brian received the National Technology Leadership Summit (NTLS) 2020 Educational Leadership Award for lifetime achievement based in part on Snap''!''.
 
==Notes==
{{Reflist|group=Note}}
 
==References==
{{Reflist}}
 
==External links==
* {{Official website|snap.berkeley.edu}}
 
{{Video game engines |state=collapsed}}
 
{{DEFAULTSORT:Snap! (Programming Language)}}
[[Category:American children's websites]]
[[Category:Educational programming languages]]
[[Category:Children's websites]]
[[Category:Virtual reality communities]]
[[Category:Free educational software]]
[[Category:2011 software]]
[[Category:Pedagogic integrated development environments]]
[[Category:VideoSmalltalk gameprogramming creationlanguage softwarefamily]]
[[Category:Video game development software]]
[[Category:Software developer communities]]
[[Category:Visual programming languages]]
[[Category:Video game IDE]]