Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Discussion 4 - Matthew Dutton
Typically, a Java program begins with a call to the main(...) function. In squeak, all the calls begin with initialize.
When your class supclasses Morph, its automatically added to a list of morphs that can be added from the world menu.
Instead of the command-driven approach that eventually waits on user input, Squeak is completely user driven.
All methods are implemented as a reaction to the user doing something, albeit running a command in the workspace or clicking a button.
Onlike Java, Squeak doesn't have primitives. Everything that you can do to anything can only be done using messages. This makes Squeak a purely object oriented language. Every thing is an object that has certain actions that can be taken on it. These different actions are represented using messages. In Java, these would be called functions or methods.
In Java there is an API for the core libraries and most others that are released. These APIs don't exist in Squeak. Instead you must browse and adapt on the fly. Squeak is different but still follows many of the same design patterns that Java's architecture uses.
Some key differences in syntax are:
In Squeak, statements end in periods, not semicolons likeJava.
When you are calling a method or sending a message, instead of saying:
myObject.theMethodToCall(theArguments); , you would say
myObject theMessageToSend: withArguments.
Almost every thing that you do in Squeak is a message. Only a few basic comparisons are not. Everything else is built on top of these very basic things. This is true object oriented fashion. You start with a few very basic abilities and combine them in many different ways until you get all the functionality that you need.
One of the differences between Java and Squeak is that Java tends towards a minimalistic Object class while Squeak has many things built into the Object class so that every single object has a wide range of functionality. Java's idea is to give the user only wait he needs and let him decide the rest while Squeak says to give the user anything that he could want in the most basic class.
In Squeak there isn't static and instance variables and methods. There are class and instance variables and methods where class is the analog to static.
A great place to start looking into the syntax and manipulation of the Squeak world is through the Muppet tutorila on minnow.cc.gatech.edu. After going through this tutorial, due to Squeak's ease in browsing, you are ready to explore the world of Squeak and begin coding.
Links to this Page