algorithms (22) Design Patterns (20) java (19) linux (14) Snippet (13) service mix (6) soa (4)



Sending messages and Saving, quitting and restarting a Pharo session

  •  Open a workspace. Type in the following text:
                  "BouncingAtomsMorph new openInWorld"

Now action-click. A menu should appear. Select do it (d) .
  • A window containing a large number of bouncing atoms should open inthe top left of the Pharo image.
  • You have just evaluated your first Smalltalk expression! You just sent the message new to the BouncingAtomsMorph class, resulting in a new BouncingAtomsMorph
  • The BouncingAtomsMorph class decided what to do with the new message, that is, it looked up its methods for handling new message and reacted appropriately.
  • Similarly the BouncingAtomsMorph instance looked up its method for
    responding to openInWorld and took appropriate action.

Saving, quitting and restarting a Pharo:
  • Select World . Save as . . . , enter the name “myPharo”, and click on the OKbutton. Now select World . Save and quit .
  • Now if you go to the location where the original image and changesfiles were, you will find two new files called “myPharo.image” and “myPharo.changes” that represent the working state of the Pharo image at the moment before you told Pharo to Save and quit . 
  • If you wish, you can mov these two files anywhere that you like on your disk, but if you do so you may
    (depending on your operating system) need to also move, copy or link to the virtual machine and the sources file

  • When you start Pharo for the first time, the Pharo virtual machine loadsthe image file that you provide. This file contains a snapshot of a largenumber of objects, including a vast amount of pre-existing code and a largenumber of programming tools (all of which are objects). 
  • As you work with Pharo, you will send messages to these objects, you will create new objects,and some of these objects will die and their memory will be reclaimed (i.e.,garbage-collected).
  • When you quit Pharo, you will normally save a snapshot that contains allof your objects. If you save normally, you will overwrite your old image filewith the new snapshot.
  • Alternatively, you may save the image under a newname, as we just did.In addition to the .image file, there is also a .changes file. This file containsa log of all the changes to the source code that you have made using the standard tools.

No comments:

Post a Comment

Search 24 Bytes