Scratch 1.4 Source Code
| This article has been created and is maintained by the Scratch Team. As such, it should be treated as an official informational page. It may be linked to by several different places on the main site.
Please only make minor changes to the content of this page.
As of March 2012, there are two different versions of the Scratch 1.4 source code available. One is made available under the GNU General Public License V 2.0, and the other is available under the Scratch Source Code License.
- 1 Scratch Source Code Licensed Code
- 2 GPLv2 Licensed Scratch Code
- 3 Which License / Version of the Source Code Should I Use?
- 4 Scratch Trademark Policy
- 5 Product vs. Research
- 6 Scratch and Squeak
- 7 Documentation and Questions
Scratch Source Code Licensed Code
All source code downloadable from this page is licensed under the Scratch Source Code License The Scratch source code license allows derivative works based on the Scratch source code to be distributed for non-commercial uses, subject to the following restrictions:
- The word "Scratch" cannot be used to refer to derivative works (except in the phrase "Based on Scratch from the MIT Media Laboratory")
- The Scratch logo and the official (copyrighted) Scratch cat cannot be used in derivative works
- The ability to upload projects to any MIT Scratch website (currently, http://scratch.mit.edu) must not be implemented
- Copies or derivative works must retain the Scratch copyright notice and license
- The source code for derivative works must be made available.
This is just a summary; the full license is in the file "license.txt" included in the source code download package, and also available here. The purpose of these restrictions is to avoid confusion in the Scratch user community between the official version of Scratch (supported by the Lifelong Kindergarten group) and experimental variations. The Scratch Team are happy to share the source code, but the Scratch brand and the user community must also be protected.
ScratchSource1.4.zip - released under the Scratch Source Code License (4.8 megabytes)
This source code release is based on the source code of the official release of Scratch 1.4 with a few changes: the Scratch logo was replaced the default sprite is a generic cat, not the official (copyrighted) Scratch cat the project sharing code was removed. The download consists of a Squeak image and changes file. To view the source code, just drop the .image file onto a Squeak virtual machine (e.g. Scratch.exe or Scratch.app, which come bundled with Scratch). If you are new to Squeak, see the "Scratch and Squeak" section on the main source code page.
ScratchPlugin is a Squeak plugin (a shared library that extends the Squeak VM) written in C that supports image filters, presentation mode, the help button, and several other features. Scratch will not crash without ScratchPlugin, but these features will not work. UnicodePlugin is a Squeak plugin that support Unicode text rendering. The ScratchPlugin and UnicodePlugin source code (for Windows, Mac OS X, and Linux) is here: ScratchPluginSrc1.4.zip The Linux code has not yet been fully tested by the Scratch team. It's mostly complete, but it may need a few minor adjustments.
Scratch UI "Skin" The Scratch User Interface uses a number of graphical elements. These are stored in a Dictionary in the ScratchSkin class variable of ScratchFrameMorph. The readSkinFrom: class method can be used to read in the graphical elements from a folder. Here's the skin folder: ScratchSkin1.4.zip
Older Versions of Scratch
(Released under the Scratch Source Code License)
Scratch 1.3 Source:
ScratchSource1.3.1.zip (3.6 megabytes)
Scratch 1.2 Source:
ScratchSource1.2.1.zip (3.1 megabytes)
GPLv2 Licensed Scratch Code
The Scratch 1.4 source code linked below is made available under the GNU General Public License 2.0. When you redistribute and/or modify this Scratch 1.4 code, you must abide by the terms of the GPL 2.0 license and the Scratch Trademark Policy.
When making derivative works (i.e. modifying the source code), you should be aware of the following requirements:
- The Scratch Trademark Policy says that you may not use the word "Scratch" to refer to substantially modified derivative works (except in the phrase "Based on Scratch from the MIT Media Laboratory") and may not use the Scratch logo, the Scratch cat, or the Gobo character (Scratch trademarks); see the TRADEMARK_POLICY text file in the source tarball or the Scratch Trademark Policy description. Minor modifications like re-packaging can be done under the Scratch name. But substantial changes, like adding new or changing existing features, means you have to remove the marks. If you are ever unsure, you can always helpatscratch [dot] mit [dot] edu (ask us).
- The Scratch website community guidelines prohibit you from using modified versions of Scratch to upload projects to any MIT Scratch website. As a result, if you make substantial changes to the Scratch source code, you cannot use it to upload to the Scratch website. "Substantially unmodified" versions of Scratch, as defined by the Scratch Trademark Policy, may be used to upload projects to the Scratch website.
- The GPL says that you must acknowledge that you've modified the original code with an appropriate addition to modified source files, and you must preserve the original copyright notices. Because Scratch is interactive, we currently do that in the Help -> About dialog.
The purpose of these restrictions is to avoid confusion in the Scratch user community between the official version of Scratch (supported by the Lifelong Kindergarten group at the MIT Media Laboratory) and modified versions of the Scratch source with different features. We are happy to share our source code, but we want to protect the Scratch brand and our user community.
Which License / Version of the Source Code Should I Use?
If you want to make substantial modifications to the Scratch source code (to add new features that don't exist in the official version of Scratch ), you may want to start with the source code released under the Scratch Source Code License. This source code does not include the Scratch trademarks (the name Scratch, the logo, the Scratch Cat and Gobo), and has the ability to upload to the Scratch website disabled by default.
If you want to package an official version of Scratch, or add it to an open source repository, you should use the source code released under the Gnu General Public License v 2.0. This version includes the Scratch trademarks, and the ability to upload projects to the [scratch.mit.edu Scratch website]. Of course, you are welcome to make substantial modifications to this source code as well - but if you do, you must remove the Scratch trademarks and disable the ability to upload projects to the Scratch website. See our Scratch Trademark Policy for more info.
Scratch Trademark Policy
The Scratch trademarks, including the Scratch name, logo, the Scratch Cat and Gobo graphics (the "Marks"), are property of MIT, and the use of the Marks is governed by this policy.
You may use the Marks to refer to Scratch in Substantially Unmodified form.
"Substantially Unmodified" means the source code provided by MIT, possibly with minor modifications including but not limited to: bug fixes (including security), changing the locations of files for better integration with the host operating system, adding documentation, and changes to the dynamic linking of libraries.
A version is not "Substantially Unmodified" if it incorporates features not present in a release of Scratch by MIT. If you do make a substantial modification, to avoid confusion with versions of Scratch produced by MIT you must remove all Marks from your version of the software and refrain from using any of the Marks to refer to your version.
Product vs. Research
Scratch is two things at once: an educational software product and a research project.
The Scratch product is designed to serve the needs of a specific target audience: youth and others who wish to learn and use programming for creative expression. Like any software product, Scratch will evolve over time, with a strong focus on stability and serving the needs of its core audience.
As a research project, Scratch explores ways to use visual programming and user interface design to make programming easier for non-experts. There are dozens of possible directions for future Scratch research, such as modifying the software to run on mobile devices, adding new data types and data structures to the programming language, and applying Scratch scripting ideas to other application domains. Research projects are different from products: they evolve quickly, explore new territory, and may never become as polished, stable, or well-documented as a product. Research projects move faster and farther when they are not held back by product concerns.
Since the Scratch team cannot possibly explore all of the potential research directions suggested by Scratch, we are making the Scratch source code available so that others can also explore and experiment. But please note that our trademark policy includes certain restrictions intended to avoid confusion between the Scratch product and research projects built on the Scratch source code. If members of the Scratch user community stumble on a research project based on the Scratch code, they should be able to tell at a glance that it is not the Scratch product.
Scratch and Squeak
Scratch is written in Squeak, an open-source implementation of the Smalltalk-80 language. The Scratch source code is best explored using the browser and other tools inside the Squeak programming environment.
To get started, first copy the Scratch application ("Scratch.exe" or "Scratch.app") from your normal Scratch folder into the Scratch source code folder. (The Scratch application is actually just a Squeak virtual machine, so any recent Squeak virtual machine should also work.) Also, put copy of the Squeak source code file in that folder if needed (this file is included in the zip file starting with the 1.4 source release). Finally, drop the file "ScratchSourceCode1.4.image" onto the Scratch application. The Squeak programming environment will start up, allowing you to view and modify the Scratch source code.
Scratch is built on a modified Squeak 2.8 image. That version of Squeak is documented in two books: "Squeak: Object-Oriented Design with Multimedia Applications" by Mark Guzdial and "Squeak: Open Personal Computing and Multimedia" edited by Mark Guzdial and Kim Rose. To learn more about Squeak, including how to use the Squeak environment to explore the source code, see [www.squeak.org].
Since Scratch simply uses a stock Squeak virtual machine, we are not distributing the Squeak virtual machine source code. Both the source code and pre-compiled binaries for the Squeak virtual machine are available at www.squeakvm.org.
The non-Scratch portion of the Squeak image file is distributed under the Squeak License. Which parts of the image file are Squeak and which are Scratch? The rule is that classes that appear in the original Squeak 2.8 image are covered by the Squeak license while all code in the remaining classes is covered by the license under which the Scratch package was released. The Scratch classes are easy to find in practice: nearly all of them appear in the class categories starting with "Scratch-".
Documentation and Questions
Source code documentation is embedded in the code as class and method comments. In addition, here is a short text file describing the Scratch project file format. Since the Scratch source code is not intended for public consumption, you should not expect the level of comments or API documentation that you get with a system such as Java, where the whole point is to help developers build on its class library. Frankly, if we waited to release the Scratch code until it was all thoroughly and beautifully commented it would never get released.
If you have questions about the source code, try posting to the Advanced Topics forum. The best way to get answers questions about Squeak and Smalltalk-80 is to ask on the "Squeak-dev" mailing list; see the "Squeak Mailing Lists" link at [www.squeak.org].