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

#1 2010-06-08 15:39:48

geoff10730
Scratcher
Registered: 2009-04-15
Posts: 43

Programming Smalltalk

I'm trying to learn more about the smalltalk language that Scratch is built on. Unfortunatly, I have yet to find anything on the internet that can help me. It would be appreciated if you helped me with this. You don't have to write out a whole post explaining the language. A hyperlink would work. This isn't just for me either! Help others also trying to learn smalltalk!


Infinity makes all things equal. (figure that one out)

Offline

 

#2 2010-06-09 17:35:53

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: Programming Smalltalk

I'm just trying to teach myself it right now. I think I understand the concept.


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#3 2010-06-09 19:53:55

mooseofawesomeness
Scratcher
Registered: 2010-06-09
Posts: 500+

Re: Programming Smalltalk

its actually rather simple. just look around on the advanced topics forum, or try to find a squeak tutorial on google. this page was really helpful to me: http://scratch.mit.edu/forums/viewtopic.php?id=31200


I am urhungry's alternate account with a cooler username. Your argument is invalid.

Offline

 

#4 2010-06-10 12:15:07

AmoebaMan
Scratcher
Registered: 2009-01-26
Posts: 500+

Re: Programming Smalltalk

type in google, "complete smalltalk-80 tutorial"

either that, or look for squeak, which is basiaclly a smalltalk-80 mod.


http://i942.photobucket.com/albums/ad269/RyanScathe/AmoebaMan.png

Offline

 

#5 2010-06-11 09:34:51

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Programming Smalltalk

AmoebaMan wrote:

type in google, "complete smalltalk-80 tutorial"

either that, or look for squeak, which is basiaclly a smalltalk-80 mod.

better to look for squeak, as that's the language Scratch is written in.

Offline

 

#6 2010-06-11 09:40:43

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Programming Smalltalk

for a tutorial on Squeak and the Scratch Source Code, you can try
this thread
or try comparing the source code of the different mods to see what code does what,
or (the least recommended) try making a scratch mod by yourself right now.
but to get you started, here's a little summary about Squeak:

- bits of code called 'methods' are what make the whole thing work.
- initialize methods are methods that start up the program
- methods can call each other if they are in the same category with the code 'self' then the method.
- there's instance and class. instance does, class creates (most of the time)
- IF statements are made like this:
aVariable = true ifTrue: [do this]
                       ifFalse: [do that].

i hope that helps a bit

Offline

 

#7 2010-06-12 13:52:06

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Programming Smalltalk

LS97 wrote:

for a tutorial on Squeak and the Scratch Source Code, you can try
this thread
or try comparing the source code of the different mods to see what code does what,
or (the least recommended) try making a scratch mod by yourself right now.
but to get you started, here's a little summary about Squeak:

- bits of code called 'methods' are what make the whole thing work.
- initialize methods are methods that start up the program
- methods can call each other if they are in the same category with the code 'self' then the method.
- there's instance and class. instance does, class creates (most of the time)
- IF statements are made like this:
aVariable = true ifTrue: [do this]
                       ifFalse: [do that].

i hope that helps a bit

- classes make the whole thing work, methods (messages) are part of the classes, which also have instance and class variables, as well as a few global variables such as Display.
- initialize methods are called when A) the instance is created [instance method] or B) the class is initialized [class method]
- code can send messages as long as they have the receiver stored somewhere, i.e. "self" always contains the receiver of the message. The method doesn't have to be in the same category.
- instance affects instances of the class, that is objects with the class as their datatype. Class only affects the class itself, i.e. setting static (class) variables or reporting important constants or other things that are do not vary in instances.
- an if statement is simply
condition ifTrue: block ifFalse: block.
It's just a message sent to a boolean. It will throw an error if the receiver is not boolean[/color]

Last edited by nXIII (2010-06-12 13:54:21)


nXIII

Offline

 

#8 2010-07-09 17:26:32

Jwosty
Scratcher
Registered: 2009-12-19
Posts: 500+

Re: Programming Smalltalk

Here is a good book on how to use Smalltalk in a program called 'Pharo': Pharo By Example .
________________
Short summary of the launguage:

Smalltalk is what you call an 'Object Oriented' launguage. This means that it is inspired by the real world. For example, there are classes and instances. Classes are basicly the catagories, like dog. Fido is an individual dog, so is therefore an instance of the class. If you want to make a dog, tell the entire class "Dog new". (It has to know how to do this, though).

Variables: In Scratch, you of course know that there is only one type of variable, but in Smalltalk, there are two, instance and class! Fancy that! It is because there is a variable for all of the instances of the entire class. Think of it as a Wikipedia topic. Anyone can edit it, verses a Scratch forum post. That is like the instance variable; it can only be edited by a specific user. Every user has his/her own post. Same with instances!


Also, be sure to download Pharo before reading the book, which is free and can also be downloaded or bought.

Hope this helps!  smile


http://i39.tinypic.com/18ert5.png Google it.  smile

Offline

 

Board footer