Pages: 1
Topic closed
1. How do I make a button in the scratch source code to make content in a .html file/webpage?
2. How do I make a right-click option in the script editor?
3. How do I make a right-click option in the development mode preview?
4. How do I make a right-click option in the blocks?
5. How do I make a right-click option in a whole script (like jens' project "XML")?
6. How do I change the file type of save/open?
Last edited by likegames (2008-08-24 10:22:57)
Offline
Hmm, likegames, these are all good questions, meaning: There's no quick and easy answer to any of them. My best advice for you would be to familiarize yourself with Smalltalk-80, learn how to use the Squeak IDE, and then browse the Scratch Source Code. That way you'll eventually be able to find out much for yourself (and you'll have learned much more than if I'll just give you some lines of code).
But seriously: It's great that you're interested in programming, and Squeak is (IMHO) a wonderful (albeit to some very exotic and sort of niche) environment. I'd suggest trying out some Squeak tutorials first, and then to try creating some little applications in Smalltalk, before setting out to modify a complex system like Scratch. But, of course, another perfectly legitimate way is to plunge right into the Source Code and start fooling around...
Offline
Okay, that last post of mine might actually come across as discouraging, which is definitely not what I intent. So here are some general tips:
[caution: long and boring post ahead
, you don't have to read this to get started]
Where's the Code?
In Smalltalk-80 the "source" code and the executable is really identical, and almost all of it is maintained in a so called "image" file. When you program in Smalltalk you directly change that image while it is running (much like remixing a running Scratch project). Smalltalk lets you do this with a set of programming tools, the most important one of these is the System Browser. It not only lets you read all of the system's code, but directly change it as well (again, much like the Scratch development environment).
In order to find your way around the Smalltalk system it's best to remember, that Smalltalk doesn't produce "programs" but "objects". Instead of letting "the computer" execute a program Smalltalk lets "objects" send "messages" to each other (notice once again the similarity to Scratch).
How Can I Create Live Objects?
So how do you create a "live object"? Here's where Smalltalk becomes slightly different from Scratch:
In Scratch you create single objects called "sprites". To make a similar object you can duplicate an existing sprite and again directly modify it (by choosing another costume, changing a variable or a script).
In Smalltalk you first create an abstract description of a "typical" object, which is called the object's "class". Afterwards you let the class create concrete objects of its own kind, which are called "instances". A class describes the characteristics of its member-objects in a generalized way: Which attributes its instances may have, and which messages they can understand and respond to.
The System Browser lets you look at / modify all of the classes in your Smalltalk system. The attributes are usually called "instance variables", and the messages are referred to as "methods".
But There's More ... ?
There are some more techniques of abstraction involved in Smalltalk-80 that will help you manage dealing with complex problems, the most apparent one being so called class-hierarchies. The idea behind a class hierarchy is that you both "reduce" a real object to its generalized description, and then "classify" it by choosing an existing class it compares best to, or simply by asking yourself: Which kind of thing is it?
Class hierarchies can be browsed in Smalltalk by opening a - duh - "Class Hierarchy Browser", which displays an indented tree list of the class names you're interested in.
So, this basically covers some of the vocabulary you'll be coming across when experimenting with Squeak and the Scratch Source Code environment. You'll notice, that it's mostly a bunch of general definitions about Object-Oriented-Programming (OOP).
Let's Rock'n Roll!
Now, just go ahead: Open a System Browser. Select a Scratch category (how about Scratch-Objects or Scratch-Blocks) and read some of its methods. Try right-clicking and browsing senders or implementors of messages a lot. And if you want to find out anything about a "live object" you can just alt-click it and "inspect" it. It's fun!
Learning for Life (not really)
The other good news is: You can reuse the stuff you learn from Smalltalk/Squeak in most other OOP environments like java and C++, so becoming familiar with it once will be rewarding in many ways.
The bad new is: These are not new, let alone revolutionary ideas. They go back (at least) to Aristotle and have been around for some centuries and even millenia. In medieval scholastic philosophy the rule was:
Thomas Aquinas wrote:
omnis definitio fit per genus proximum et differentiam specificam
(you define something by naming its category and what is special about it)
So I sometimes wonder what all the fuss about OOP is about
Offline
Nice post, Jens! I had no idea that OOP was such an ancient concept!
Offline
Paddle2See wrote:
Nice post, Jens! I had no idea that OOP was such an ancient concept!
I agree. Brilliant post, Jens!
most. literary. post. ever!
Offline
Topic closed
Pages: 1