Eng:Scratch Source Code

The Scratch Source Code is the version of Scratch before the Scratch Team compiled it. It is usually used for:


 * Understanding how Scratch works


 * Building future versions of Scratch


 * Making Scratch modifications

Scratch 3.0
Unreleased The Scratch 3.0 source code is in GitHub. it is from some different source, but everything is written by JavaScript.
 * scratch-blocks - Blocks
 * scratch-render - WebGL Rendering
 * scratch-vm - Scratch Virtual Machine
 * scratch-gui - GUI
 * scratch-paint - Paint Editor
 * scratch-audio - Audio Engine
 * scratch-l10n - Translations
 * scratch-storage - File Support
 * scratch-parser - SB2 Parser
 * scratch-auth - Authentication

Scratch 2.0
The Scratch 2.0 source code is now officially available on GitHub here. It is written in ActionScript and now provides the necessary tools for users familiar with the language to create mods of Scratch 2.0. From the source code page, users can view the pull requests for Scratch 2.0 as well as analyze the current issues that need debugged.

Prior to the Release
Before the release of the source code on May 13, 2014, the source code could only be viewed on a user's computer in compiled form. Compiling takes a human-friendly or high-level language and converts it directly into binary code. The uses of compiled code are as follows: However, Scratch is and always will be open-source, and every update to the source code can be viewed on GitHub.
 * Faster execution
 * Smaller storage space
 * Unavailability to access the original source code in its original form (some decompiler a work around this)

Scratch 1.4
The Smalltalk code can also be viewed from the compiled image, but is less understandable.

Compiled Smalltalk code is when the original is changed (by the computer; the programmer does not do any of this) to remove the comments, change all the variables to shorter names, and to remove any indentations. For example, this Smalltalk method in the original source code:

|foo bar baz| "Initialize me."

foo := 'a string'. bar := 'another string'. baz := AClass new. baz := openInWorld.

((anInstanceVariable = foo) or: [anInstanceVariable bar]) ifFalse:[ (2 atRandom = 1) ifTrue:[ anInstanceVariable := foo.] ifFalse:[ anInstanceVariable := bar.].]. Might end up looking like the following in the compiled version:

|t1 t2 t3| t1 f := 'a string'. t2 br := 'another string'. t3 bz := AClass new. t3 := openInWorld. ((anInstanceVariable = t1) or: [anInstanceVariable t2]) ifFalse:[ (2 atRandom = 1) ifTrue:[ anInstanceVariable := t1.] ifFalse:[ anInstanceVariable := t2.].].

The way source code (in Smalltalk) is compiled is when the .sources file is deleted.

Licenses
There are two different versions of the source code, available under two different licenses and intended for different purposes. The first, available since Scratch was created, contains a non-branded image file with a generic sprite and no uploading. This is released under the Scratch Source Code License. Another version, added in March 2012, is licensed under the GPLv2 license. It contains all of the media included with the regular Scratch distribution and was created to make it easier to put versions of Scratch on open source repositories, especially for Linux distributions.

All Scratch 3.0 source code, except scratch-blocks are licensed under 3-clause license. scratch-blocks is licensed under Apache License v2.0.