From Test-Scratch-Wiki

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

Scratch 3.0

Clock.png This article or section contains information about a feature from a future version of Scratch that is unreleased and is subject to change. Some Scratch Blocks may not display correctly on this page.

The Scratch 3.0 source code is in GitHub. it is from some different source, but everything is written by JavaScript.

Scratch 2.0

The Scratch 2.0 source code is now officially available on GitHub here.[1] 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:

  • Faster execution
  • Smaller storage space
  • Unavailability to access the original source code in its original form (some decompiler a work around this)

However, Scratch is and always will be open-source, and every update to the source code can be viewed on GitHub.

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:

aSmalltalkInitializationMethod

|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:

aSmalltalkInitializationMethod

|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

"License" redirects here. For the license Scratch projects are published under, see Scratch Project License.

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

See Also

External Links

References

Cookies help us deliver our services. By using our services, you agree to our use of cookies.