This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-12-31 18:53:13

johnadmin
Scratch Team
Registered: 2007-03-13
Posts: 100+

Scratch Source Code

A few people have asked about getting access to the Scratch source code. Here it is:

   http://scratch.mit.edu/pages/source

Important note: The Scratch source code is intended only for technically-advanced users who want to experiment with developing new features. To understand and modify the source code, you need expertise in the programming language Squeak (Smalltalk-80).

If you have any questions, please feel free to post messages here, or contact scratch-developers at media.mit.edu.

  -- John (for the MIT Scratch Team)

Offline

 

#2 2008-01-02 03:16:10

SimpleScratch
Scratcher
Registered: 2007-05-25
Posts: 100+

Re: Scratch Source Code

Thanks you very much indeed :-)

The only problem now is that we'll have to really really get to grips with Squeak and the way it works !

If anyone (don't want to bother the Scratch team with requests like this but feel free to answer :-) ) can give us an idiots guide on how to get going...

I got as far as seeing the source code in Squeak but I got an error and my Squeak is 3.9xxxx - do I need to get a particular old version???.

And then the big one - how do we make our own blocks?  :-)

regards

Simon

Offline

 

#3 2008-01-02 04:19:17

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Scratch Source Code

Hi Simon,

the MIT-Squeak version running under a current Squeak VM (3.9) works fine for me (I did get an error using a 3.10 version). You can also open the dev-image using a copy of the Scratch.exe (which I personally prefer). Which error did you get?

Besides the Squeak vm (or the Scratch.exe) you also need a v2 Squeak sources file. Download that from: http://ftp.squeak.org/2.0/SqueakV2.sources.gz , uncompress it and put it into the same directory as your vm.

BTW, you can unzip the .gz from within Squeak (or Scratch for that matter). Just open Squeak, open a file list, select the .gz file and choose 'decompress to file'. Now you should be all set to go!

Last edited by Jens (2008-01-02 07:18:14)


Jens Mönig

Offline

 

#4 2008-01-02 09:37:29

SimpleScratch
Scratcher
Registered: 2007-05-25
Posts: 100+

Re: Scratch Source Code

Hi Jens - I was hoping you'd pop by  smile

1.  Why do you prefer to use Scratch.exe?

2.  The URL doesn't work for me  sad

regards

Simon

Offline

 

#5 2008-01-02 09:47:02

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Scratch Source Code

Hi Simon,

now the url for the squeakV2.sources should work. You can also get it via the squeak.org site.

I prefer the Scratch.exe (or app if you're using a mac) simply because you already have it and don't need to download it again. Plus, it already has the Scratch-Plugin for the graphic effects in presentation mode in it, so it's sort of 'custom tailored' for Scratch.


Jens Mönig

Offline

 

#6 2008-01-02 10:20:02

SimpleScratch
Scratcher
Registered: 2007-05-25
Posts: 100+

Re: Scratch Source Code

Got it opening now with no errors - thanks  smile

Have you worked out how to add a block yet?

regards

Simon

Offline

 

#7 2008-01-03 09:52:51

evhan55
Scratcher
Registered: 2007-03-07
Posts: 100+

Re: Scratch Source Code

SimpleScratch wrote:

Got it opening now with no errors - thanks  smile
Have you worked out how to add a block yet?

Check out this project:

http://scratch.mit.edu/projects/Jens/75626

Here, Jens teaches the community how to work with the Scratch source code, by adding a new block to the set of blocks available. It's very nicely done and instructive...

Thanks Jens!
- Evelyn


I love Scratch!  big_smile
my creative outlet

Offline

 

#8 2008-01-03 09:57:25

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Scratch Source Code

Hi Simon,

I just uploaded a little intro tutorial on how to use the Scratch Source Code to create your own new command blocks:

http://scratch.mit.edu/projects/Jens/75626

It's actually rather easy (and fun!) if you're familiar with Smalltalk. In my little tutorial I also try to explain how to use some of the Squeak developer's tools (like the System Browser and the Change Sorter).

This should get you going for most simple command blocks. If you're after more profound changes , you'll just have to dig deeper into the image...

Hope this helps...

Oops, I just noticed that Evelyn beat me with this announcement  smile

Last edited by Jens (2008-01-03 10:14:57)


Jens Mönig

Offline

 

#9 2008-01-03 10:25:36

acolite246
Scratcher
Registered: 2007-09-19
Posts: 8

Re: Scratch Source Code

Now that we will be able to edit scratch code and such, will we be able to 'share' our user-created blocks/enhancements? Will the Scratch team hold contests for adding user-submitted blocks? Or will we have to keep the blocks to ourselves?

Also, it would be even cooler if the Scratch team also posted an easy to use block editor so we could make our own blocks, share them, and edit them.

Most advanced Scratch users have no want or time to make their own version of Scratch- they'd probably just use the code to make blocks. (at least I would- forgive me if I am wrong)


-- Not sent from a Blackberry Wireless Handheld--

98% of people who read this signature think it is akin to chain mail. If you're one of the 2% who don't, feel free to copy and paste it into your signature.

Offline

 

#10 2008-01-03 16:10:22

relyt12101
Scratcher
Registered: 2007-05-19
Posts: 500+

Re: Scratch Source Code

I don't think you can upload projects made with your own blocks. Look at the page linked by John from above-

http://scratch.mit.edu/pages/source


http://img392.imageshack.us/img392/2860/pspbanneregg089deiy0.png

Offline

 

#11 2008-01-04 04:02:39

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Scratch Source Code

The file format of the Scratch Source Code version is the same as in the Scratch product. So you can make your own Scratch-variant using the source code and create a perfectly compatible Scratch-project in it. If you want to upload such a project to the website, you'll need to use the real Scratch product, though, because the source code release doesn't have the code for sharing projects online (which IMO is a very sensible decision).

That way you can e.g. write your own Scratch-IDE tools (like I've done an XML file utility), and apply these to your Scratch projects (for example to trace broadcasts or variables, or to automatically generate certain blocks sequences for music), without breaking their compatibility. If you create your own blocks, however, these will - of course - not be supported by the online player, and shown as red blocks labelled 'obsolete' in Scratch. So you should indeed not upload such projects.


Jens Mönig

Offline

 

#12 2008-01-04 10:13:27

SimpleScratch
Scratcher
Registered: 2007-05-25
Posts: 100+

Re: Scratch Source Code

@jens

Thank you (from all of us) for the info  smile

regards

Simon

Offline

 

#13 2008-01-04 11:44:43

johnm
Scratcher
Registered: 2007-03-08
Posts: 100+

Re: Scratch Source Code

Hi, all.

While we want to allow experimentation with the Scratch source code, we want to be careful to have a well-defined "standard" Scratch so that people will be able to easily share Scratch projects on this website and they will work in the Java player and, when downloaded, in the standard version of Scratch. We don't want there to be dozens of incompatible extensions of Scratch, which would make project sharing difficult or impossible.

The terms of the license are intended to prevent confusion between the standard, MIT version of Scratch and experimental versions. It's fine for Scratch hackers to share experimental versions and extension code with each other; that's what a healthy research community does, and it's a great way to explore new ideas. But my hope is that we can all work together to maintain a clear distiction between the research community and the Scratch user community.

  -- John

Offline

 

#14 2008-01-04 12:02:03

johnm
Scratcher
Registered: 2007-03-08
Posts: 100+

Re: Scratch Source Code

Hi, acolite246.

Thanks for sharing your thoughts.

You suggested that it would be great to have a way to define your own new Scratch blocks with some sort of "block editor" so that anyone could create a new block, not only Squeak programmers. I totally agree. Such user-built blocks would be similar to what other programming languages call "functions," "procedures," or "subroutines."

This sort of user-defined blocks would not break compatibility, since the block definitions would be included in the project. Anyone who downloaded the project could open up a user-defined block to see how it worked or to change it. And they would work on the web, too.

I can't promise that user-defined blocks will get added to Scratch. There are many tradeoffs to consider and the UI details are tricky. (We actually had a user-defined blocks feature in the earliest versions of Scratch, but it caused so much confusion that we removed it.) However, user-defined blocks are definitely on our wish-list for some future version of Scratch.

  -- John

Offline

 

#15 2008-01-04 20:35:49

MITscratcher
Scratcher
Registered: 2007-09-16
Posts: 100+

Re: Scratch Source Code

How do I open up the Scratch source code in squeak?


http://scratch.mit.edu/projects/MITscratcher/235497
                    ^ My NEW Snake Game! ^

Offline

 

#16 2008-01-06 14:48:19

Mike16112
Scratcher
Registered: 2007-06-09
Posts: 100+

Re: Scratch Source Code

How do I open it    <think[ How?]


The programmer has a nap. HOLD OUT! PROGRAMMER!

Offline

 

#17 2008-01-06 16:44:08

johnadmin
Scratch Team
Registered: 2007-03-13
Posts: 100+

Re: Scratch Source Code

For those wondering how to open the Scratch source code image in Squeak:

Note: You'll need to know or learn at least a little bit about Squeak and Smalltalk-80 to make any sense out of the Scratch source code. Most Scratch programmers probably won't care to learn Squeak--and that's totally fine! We created Scratch so people could learn to program without becoming professional programmers. But some professional programmers asked about the Scratch source code, so we made it available.

But, to answer the question...

First, download and unpack the Scratch source code--a folder containing Squeak .image and .changes files. Second, download Scratch if you don't already have it. Put a copy of the Scratch application (Scratch.exe or Scratch.app) in your Scratch source code folder. Next, download:

  http://ftp.squeak.org/2.0/SqueakV2.sources.gz

Uncompress SqueakV2.sources and put that, too, in your Scratch source code folder. Finally, drop the file ScratchSourceCode1.2.1.image onto the Scratch application in your Scratch source code folder. The Squeak programming environment will start up and you'll be able to start exploring the Scratch source code.

You might also look at the excellent tutorial Jens created:

  http://scratch.mit.edu/projects/Jens/75626

  -- John

Offline

 

#18 2008-01-06 19:01:11

Mike16112
Scratcher
Registered: 2007-06-09
Posts: 100+

Re: Scratch Source Code

Uhh...Where can I find this "APPLICATION" anyway


The programmer has a nap. HOLD OUT! PROGRAMMER!

Offline

 

#19 2008-01-06 19:58:16

MITscratcher
Scratcher
Registered: 2007-09-16
Posts: 100+

Re: Scratch Source Code

Thank you for your help, I had just figured it out last night. I had already downloaded "Squeak", and I may only be a kid, but I did learn a lot about it. My ambition is to go to MIT when I go up (and to become a programmer). Do you think smalltalk will be a good language for me to start with to learn and work my way up to more advanced programing?


http://scratch.mit.edu/projects/MITscratcher/235497
                    ^ My NEW Snake Game! ^

Offline

 

#20 2008-01-06 22:50:51

johnadmin
Scratch Team
Registered: 2007-03-13
Posts: 100+

Re: Scratch Source Code

Hi, MITscratcher.

Well, I think Scratch is the best language to start with!  smile

But, if you want to know what to learn after Scratch, Smalltalk would certainly teach you a huge amount. Many of the good ideas in Java came out of Smalltalk, and I personally find the Squeak Smalltalk environment fun to explore because it is so immediate (like Scratch).

However, I should point out that Smalltalk is not nearly as popular as Java. Also, the AP computer science exam is in currently in Java. So there are some advantages to learning Java--you could take the AP exam and you'd share a common vocabulary with more people (Smalltalk and Java often uses different names for things.) If you decide to learn Java, you might try the Greenfoot environment (http://www.greenfoot.org/).

But the programming language does not make a big difference--the big ideas in computer science transcend any particular programming language and, anyhow, new languages keep getting invented and old ones fall out of use. I'd suggest that you play a little bit with both Squeak (Smalltalk) and Greenfoot (Java) and see which one catches your fancy. You will learn much more if you find the language fun and interesting. And you simply can't go wrong; no matter what language you decide to learn next, you will be learning useful and important ideas. (And if you grow up to be a programmer you will probably keep learning new programming languages your entire life--and have fun doing it!)

  -- John

Offline

 

#21 2008-01-07 11:37:18

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Scratch Source Code

I agree with John that Scratch is a great first language, and that Java is a good choice for a second language.  I learned many programming languages when I first started programming, some of which have turned out to be of lasting usefulness, others of which have disappeared.  Each taught me somewhat different ways to approach programming, so I encourage new programmers to learn one language very thoroughly and several others at least superficially.  Currently, the most popular teaching language in universities is java, but there is a lot to learn from lisp, smalltalk, and assembly languages.  Most of my real programming is done in C++, but I also have to teach and do a lot with perl. 

Quite frankly, perl should *not* be among the first languages you learn, as it is an ugly language that will teach you to write sloppy, hard-to-maintain code.  You need it if you are going to do bioinformatics, because so much of the existing "glue" between programs is done in perl, but it is not a good language in a lot of ways.

C++ is a good language for writing fairly efficient code (usually about twice as fast as java for the same programming effort), but it is not as cleanly designed as java, as c++ evolved slowly out of C, while java was created from the beginning with c++ as an existing model of what to do and not to do.  I recommend c++ as a language for professional programmers who care about speed (bioinformaticians and game engine builders, for example), but suggest learning it after learning java.

Offline

 

#22 2008-01-09 12:51:39

MartinWollenweber
Scratcher
Registered: 2007-04-10
Posts: 100+

Re: Scratch Source Code

Hi MITscratcher,
I agree with Johns and Kevins advice to young programmer. But while having a look at popular programming languages - like  C++,Java ,C# or Ruby - keep in mind that nearly all object oriented programming languages (=OOP, that group of languages that are the most advanced way to deal with complexity) have borrowed from the oldest and purest OO-Language Smalltalk. All other OOPs mixed the pure concepts of Smalltalk with compromises – some for performance, some for marketing reasons, some for their range of application. Every new OOP borrowed a little bit more from Smalltalk. Smalltalk is now over 30 years old and still to innovative to be mainstream. Most Programmers who know Smalltalk in deep, feel a special “love“  for it, many programmers that only heard of it, have different prejudice about it.
•    Perhaps Squeak Smalltalk projects like Scratch and www.croquetconsortium.org help to give Smalltalk the popularity it should have.
•    Perhaps Smalltalk will have its breakthrough in the future.
•    Perhaps this will be, when the generation of pupil like MITscratcher will be the programmers of the future

So my advice:
•    To get a mainstream-programmer and make a living of it, learn C++, Java or C#
•    To “invent the future“  learn Smalltalk
•    To do both, learn it all  smile

I would vote for making an “upgrade path“  from Scratch to Squeak that doesn’t shock young programmers with the whole features of Squeak at once, but guides them gently from Scratch to Squeak Smalltalk:
•    It should be possible to show Smalltalk Code in a kind of Scratch-Blocks.
•    It should be possible to present the really overwhelming Squeak Object-Image layer by layer.
•    It should be possible to make a simple to understand mixture between Scratch and Squeak, where the Scratch-Sprites can be controlled by Smalltalk code like the robots in http://smallwiki.unibe.ch/botsinc  .
•    It shoud be possible to lift the curtain from Scratch to Squeak step by step

What do you think?

References:
http://scratch.mit.edu/projects/Jens/75626
http://scratch.mit.edu/projects/Jens/22355
http://en.wikipedia.org/wiki/Squeak
http://en.wikipedia.org/wiki/Smalltalk
http://en.wikipedia.org/wiki/Scratch_%28programming_language%29
http://en.wikipedia.org/wiki/Croquet_project
http://en.wikipedia.org/wiki/Alan_Kay

Last edited by MartinWollenweber (2008-01-09 15:00:51)


Martin
...mitmachen beim  DACH-Scratch-Wiki und Scratch-Wiki-Autor werden!

Offline

 

#23 2008-01-15 23:04:56

Sidharth
Scratcher
Registered: 2007-12-14
Posts: 100+

Re: Scratch Source Code

but guys how do i get the code into scratch??

Last edited by Sidharth (2008-01-15 23:06:43)


http://www.danasoft.com/citysign.jpg

Offline

 

#24 2008-01-16 01:38:13

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Scratch Source Code

Sidharth, the source code comes in the form of a Squeak image file, which is actually not just plain "code" but a complete Smalltalk development environment *with* the Scratch source code already integrated.

You definitely need to be familiar with some basic knowledge of the Smalltalk programming language and the Squeak environment to at least make sense of some of this. If you haven't been exposed to Smalltalk or Squeak before I'd strongly recommend that you first read up some tutorials about this programming language. These can be found at http://www.squeak.org


Jens Mönig

Offline

 

#25 2008-04-12 01:58:06

costellorob
Scratcher
Registered: 2008-04-11
Posts: 5

Re: Scratch Source Code

posted this on the feature list but seeing as its being discussed here will add here
(love scratch; i wonder if it might be a better Squeak image to go on the OLPC than e-toys?)

anyway, i think it might be nice if one could see a more syntax orientated description of the code blocks

ie be able to switch views between the blocks -which would remain the main approach - and a more language orientated code view of some sort

i guess thats happening at some level - the meaning of the blocks gets translated into smalltalk - but i would think showing accurate smalltalk is maybe too heavy?

yet i think it might help kids transition in into other langauges if they could see a language orientated translation of the blocks, when they are ready 

i guess you could offer various BASIC (i know smalltalk purists probably hate BASIC), or Java like, or other langauge, translations 

(Jens' Chirp version, with the export script to XML option, sort of suggests the code view is possible)

important that this be editable i think - so the blocks and the language code/view would reflect each other

ie a little like the source / design view of web authoring

Alice offers a hybrid code / language view - maybe thats a thought - but i'd suggest a sort of alternate view / way to edit script

for kids ready to move on, it could add some more 'height'

also, after a while, might be a more succint and efficient way to handle scripts -
the blocks would offer a constant learning environment (and safety net) for the language constructs as well

also, option to resize the script window - why constrain the view if its a "visual programming" approach?

Offline

 

Board footer