|This page has links to websites or programs not hosted or created by Scratch or Wikipedia. Remember to stay safe while using the Internet, as we can't guarantee the safety of other websites.|
Smalltalk is an object-oriented programming language that was released in its first version, Smalltalk-80 in 1972. It was developed by the Learning Research Group of Xeroy PARC for educational use. The current version of Smalltalk, released in 1998, is ANSI Smalltalk. Some of the Smalltalk implementations include:
- Squeak is a Smalltalk implementation by Disney and is derived directly from Smalltalk-80, the first copy of Smalltalk ever released. It can be downloaded here. Squeak Smalltalk was used to implement the Scratch Development Environment from version 1.0 up to Scratch 1.4. In Scratch 2.0 they used Flash instead of Squeak Smalltalk, but Scratch 3.0 is planned to be written in HTML5.
- Pharo is a fork of Squeak and the only differences are that they provide more frequent updates, they changed the system menus and windows slightly, and they removed some of the unnecessary code (along with some other minor changes). It can be downloaded here.
There are many other Smalltalk implementations, and a list can be found here.
The System Browser
- Main article: System Browser
It is possible to browse, create and edit methods (blocks) along with defining new objects, giving them variables, and using methods as possible in BYOB.
This is what the Squeak System browser (in Scratch) looks like:
The string in the first pane (Scratch-UI-Panes) is just an non-vital categorizer to make things easier to find. The one in the second pane is the name of the class, the third is another category, and, the last are the methods themselves.
- Main article: Squeak Tutorial#Methods
Methods are Squeak's procedures, similar to the blocks in Scratch. It is easy to define them. In fact, there is, in a way, no 'Scripting Pane' and the methods are called on by each other or when an event happens. It is even possible to program a method to call on itself (like in BYOB), creating recursion.
Classes and Instances
- Main article: Squeak Tutorial#Classes and Instances
- "Class" redirects here. For the page about Student and Teacher accounts, see Student and Teacher Accounts.
Classes and instances are the core concept of OOP (Object Oriented Programming), and what also makes it more like the real world. Take, for example, the abstract idea of the Car class. A red car on Main Street is an instance, or specimen of Car, whereas a blue car on Maple Drive is another yet separate instance of the same class, Car.
There is also the concept of subclasses and superclasses: a subclass is a class that inherits its methods from another class, called its superclass. In simpler terms, the previously mentioned red car on Main Street might be an instance of VWBeetle, which is a subclass of Car. The vehicle on Maple Drive could be an instance of the class ChevyBlazer, but neither the Blazer nor the Beetle are directly instances of Car, although they inherit all the methods of Car.
It is also possible to add class and instance variables to a class, which will be dealt with accordingly. An instance variable is a variable that each instance (of a given class) will get a new copy of, and will be able to set it to whatever it needs to via the methods on the instance side.
A class variable is a variable that the entire class shares and can be accessed through either side. One can also use Global variables which are global to the entire Squeak application.
- Main article: Squeak Tutorial#Morphic classes
The graphics system used in Smalltalk is called Morphic. Morphic creates new morphs, which are objects to be displayed on the screen. They can be given commands, such as
self forward: 10 or
self color: Color red. To create a new Morph, the following code is used:
class new openInWorld
IMAGE file is a source-code "image" on Squeak. The Scratch 1.x series, along with any modifications, use
IMAGE files for the sources. These files contain all the necessary information to draw the GUI, and interpret code.
Opening an IMAGE File
IMAGE file can be opened with any Squeak virtual machine, such as the Scratch application or any modification's application. Simply double click the file on the hard drive. If an application to choose is requested, choose Scratch.
Editing an IMAGE File
- Main article: Shift-Click-R
IMAGE file can be edited by shift-clicking the loop of the "R" in the Scratch Logo and selecting "Turn fill screen off". Clicking on the gray area will bring up the World Menu. Click "open...", then "browser" to open the System Browser, which contains the source code. It can then be edited. Shift-clicking the R again and selecting "save image for end user" will close Scratch and save the changed