[Newbies] Apologies for the structure of this email...

Ron Teitelbaum ron at usmedrec.com
Fri Jun 21 16:21:24 UTC 2013



From: beginners-bounces at lists.squeakfoundation.org
[mailto:beginners-bounces at lists.squeakfoundation.org] On Behalf Of Azka
Sent: Friday, June 21, 2013 8:17 AM
To: beginners at lists.squeakfoundation.org
Subject: [Newbies] Apologies for the structure of this email...


I started this discussion (between the asterisks) at the Squeak development
mailing list yesterday:






Treat me like a beginner. I have two targets:

1. I want to document the source code of Scratch.

2. I want to modify Scratch.


Below the #'s is what I have already been told through this mailing list.


Now, the source code provided for Scratch [1] has two files with code inside
them; a .SOURCES file and a .CHANGES file. I have two simple questions:

What is the purpose of the two files?

If I want to change the code in one of these file and see it how does it
come out, (how) can that be done? 


I have been able to understand the format of the source code provided. I
would like to ask is there is any code which is responsible for creating the
OO world of Scratch. The system categories for Scratch objects hold a lot of
classes in them. Those classes, along with a lot of other new and old
classes have been used to construct Scratch. These classes didn't preexist.
Can a file of code not be used to create new classes and system categories?


Squeak by Example [8] talks about a 'hierarchy browser' which is easy to
find with the files provided with it. Is there a similar kind of thing to
explore Scratch objects? If yes, how to get to it. If no, how do can I trace
the hierarchy of inheritance of objects used to make Scratch.






Scratch uses the Morphic UI on a Squeak image with a virtual machine
underneath. The Squeak version is, I think, 2.8 (as opposed to 4.4 which is
about to come out) and came out in 2005. The important difference is that
the virtual machine has changed. Modern vms are closure complete and have a

To see Squeak 2.8 when it was released. [7]
For some videos on Scratch from a Squeak perspective [3-6].
An introductory book on Squeak. [8]
Source code on the virtual machines. [2].
The Scratch image that will not work on a modern Squeak virtual machine. [1]
But will work on a virtual machine from a Squeakland Etoys release. [10]
As you first expressed interest with how Scratch interfaces with the
hardware you may need to join the VM-Beginners list [9].

[1]  <http://info.scratch.mit.edu/Scratch_Source_Code_Licensed_Code>
[2]  <http://squeakvm.org/index.html> http://squeakvm.org/index.html
[3]  <http://www.youtube.com/watch?v=wqV3nGD9N7U>
[4]  <http://www.youtube.com/watch?v=XwmQ1DoEjsA>
[5]  <http://www.youtube.com/watch?v=uGyfzw_gePo>
[6]  <http://www.youtube.com/watch?v=YmTk9t71jZ4>
[7]  <http://ftp.squeak.org/2.8/> http://ftp.squeak.org/2.8/
[8]  <http://squeakbyexample.org/> http://squeakbyexample.org/
[9]  <http://lists.squeakfoundation.org/pipermail/vm-beginners>
[10]  <http://www.squeakland.org/> http://www.squeakland.org/


Courtesy of Chris Cunnington; when I said I need to understand Scratch (get
about its source code) and how does it interface with the hardware.






In response to this Chris and Ron gave feedback:



Chris's Feedback:

I wouldn't worry about what the changes and sources files do right now. 
You want to know how to open the image and look at the code. These 
videos will help with that. [1] You need to go to Squeakland [2] and get 
yourself an application. You can open the Scratch image from the Scratch 
website with that. Finally, there is a beginners list [3] you can ask 
questions at. This list isn't the best for this kind of question. Once 
you learn some basics of Smalltalk, you should be able to explore the 
source code of Scratch.
[1]  <http://smalltalk.org/videos/video_AbsoluteBeginner_DownloadOpen.html>
[2]  <http://www.squeakland.org/> http://www.squeakland.org
[3]  <http://lists.squeakfoundation.org/mailman/listinfo/beginners>




Ron's Feedback:

The .sources and .changes files are not changed by hand they are files that
act as storage space for the code you write in Smalltalk.  The changes file
tracks all changes that are made to the system.  .sources is a file that
holds the code for the image.  You can think of a sources file as a starting
point and changes adds to it. 


You change code using browsers in Smalltalk itself.  It's not a good idea to
try to change code in the files.


You create new classes using a Smalltalk browser.  While you could use a
file and file in the file it's not a good idea to change code in files.


For scratch you will need to use a development image, or break into the
development environment to access the development tools.  Haven't tried it
but maybe that is where you are having difficulty.  I would start here:


A sealed image can lock out the dev tools, it may even strip out the
development tools completely.  Also a sealed image does not normally require
a changes file since it is not used for the purpose of changing code.





My next response was the below (which I wrote minutes ago):


Thanks for the feedback Ron and Chris, but I have some more questions now.


1. I am sorry I didn't fully understand what did you mean by "act as storage
space for the code you write in Smalltalk". Also please specify whether by
Smalltalk you meant Smalltalk-80 (i.e. Squeak) or did you mean Smalltalk
only. As in is there a custom to refer to Squeak as Smalltalk. Doesn't it
create am


In my case Squeak = Smalltalk.


2. You said the .sources file holds the code for the image file. But a lot
of stuff is absent in the .sources file to make the image file what it is.
For example, below is the general format throughout the files for adding
methods in the class whose name will be written in place of class-name:

!class-name methodsFor: 'protocol-name' stamp: 'some-tag DD/MM/YYYY


  "Body of the method"! !

Before adding methods to a class, in the .sources file only, there are some
lines of code telling us which super class does it inherit from along with
some description. There is no specification (in the .sources file) about the
system category under which that particular class will fall. Yet, when one
opens the image file all the classes are distributed among the system
categories. From an object oriented point of view, I agree that it doesn't
matter, but considering what I can see in the image file, and considering
that I find it very hard at times to locate a class by browsing through the
system browser by its name only and not knowing about it system category, I
need to know if there is any part of the source code responsible for this
classification with respect to system categories.


You shouldn't be using the sources or changes file to make changes but I
suppose it is not a bad way to find code.  It is much easier to use the
browsers like the hierarchy browser to read and explore code.


The category is in the sources and changes file.  Keep in mind that you will
only see the category in a changes file if you make changes to the class.
The sources file should have the category.  


For the class definition you should see something like this:



Superclass subclass: #Class

     instanceVariableNames: ''

     classVariableNames: ''

     poolDictionaries: ''

     category: ''!

!ADPCMCodec commentStamp: '


Methods are written out as extensions to the class definition.  They will
have the protocol on them (the method category) but they will not have the
class category since that is defined on the class not the method.  


Keep in mind that all changes are in the changes file so you may see
multiple versions of the same method in that file.  Only one method is
current so make sure you find the last change when reviewing the file.
Again it's much easier in the Squeak Development Image to review code since
what you see will be the current versions of the methods.


3. Yes http://download.scratch.mit.edu/source-code/ScratchSource1.4.zip
is where I started as well. I used the image file from this link. I couldn't
find a hierarchy browser or anything analogous to it. I am sorry if this
list the not the best place to ask this question, but how can I go about the
inheritance hierarchy by using an image for Scratch.


I have not tried launching this but I saw that there was a way to break into
the development area (in a previous email).  Once you have done that use the
world menu to open the browser.  


Chris, I have joined the other mailing list you suggested and will soon
initiate this discussion over there too. Thanks.






Although I posted my email to the Squeak development list, I am virtually
posting it over here too. I am in need of answers. Thanks.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20130621/6876e60f/attachment-0001.htm

More information about the Beginners mailing list