How to get from Java or C++ or your favorite OO IDE to Squeak
Last updated at 3:46 am UTC on 5 October 2004
Most programming environments have these basic parts:
- The code base is a bunch of (or one big) text files that hold a program, class or module each. If you're using existing code (libraries, commonly) that means you have lots of preexisting textfiles (that possibly came with your environment) and your code refers to them.
- A compiler/linker knows how to make individual textfiles into some sort of executable (exe, a.out, java bytecode...) format. Some sort of configuration tool glues all this together, making sure that everything that needs to be compiled does get compiled, and usually that it gets compiled only as often as needed.
- Finally, some sort of front end (IDE, emacs or plain text editor+prompt) allows you to use all the above tools to edit code.
Now we take a number of steps to make sure we have a modern, convenient place to work in:
- (Re)Write the front end (FE) - make it a well designed object oriented application so it'll be flexible and easy to extend.
- Make the FE keep a bunch of code-objects that point into the code base. This makes managing them easier.
- Make code objects that represent a class definition, make code objects that represent a method definition. This way a simple message send can add a method to a class, or change it, or get all the methods for a class. Make the "class" object know who its superclass is.
- Make all of the IDE reference only these code object, so the code base can be eliminated/ignored as far as it's concerned. You may still want it for code archiving/sharing purposes. A project holds all the class objects it consists of.
- Make one big project that has all the class libraries you might want. Make it the default project, and always work in it. This is now the work environment, there are no projects.
- Add some methods to the code object, allowing them to be activated - methods called, classes instantiated, objects sent messages (yes, this is the really tricky part).
- Make the compiler an object in the IDE. You can send it a code object and it returns a compiled-code object. This can be written to a file, or used outright in creating the final program without going through the file system at all.
- Make the compiler class (and related utilities) part of the available class library. Same with all the IDE and code classes we mentioned so far. This means that your code can call the compiler, and it can tell a class to add a method. This means that you can write in this environment tools (a debugger, diff utilities) to extend it.
- Change the code base so it'll keep a history of all changes, so you can always go back if you screw something up.
There must be something I forgot... feel free to add/clarify or send me mail with suggestions. -DanielVainsencher
See also The Squeaky way of Code for more information about the Squeak/Smalltalk IDE and definitions of important terms such as class, method, block, browser, virtual machine, etc.
I would like to add a few comments, as someone who is trying to switch from Java to Squeak:
- This page is a good start. However, my frustration as a Java developer is the lack of good, progressive tutorials or example projects, which take you from a "Hello World" starting position to a simple application, like a Card File.
- How about a concise, brief "Squeak in a Nutshell" approach to Squeak Smalltalk.
- By the way, where are the GUI widgets? A page which discusses, how to build a simple GUI screen in Squeak, as compared to Java, would be great.
- I'm serious about switching from Java to Squeak Smalltalk. Squeak provides real "write once, run anywhere" portability. My only concern is the ability to create a GUI for applications.
- I've also read the pages on the Squeak March 2000 conference. I'm encouraged to see interest in XML, Squeak RMI, Corba, Encryption, Compression and Security. These facilities would make Squeak more than equal to Java.
- In learning Squeak, I also see the possibility of extending the Image file, fileins, or change sets to act like a Java JAR file. Some approach like this is needed, where a distributed application can be authenticated, just like a Java JAR file. When Squeak RMI is implemented, then it becomes possible to create the equivalent of a Java Bean, shipped in a JAR file.
- When I actually know more about Squeak, I would be interested in helping with some of the projects. -John Gardner