Saturday, 24 October 2015

Pharo By Example, Chapter 2

Create a Package by right-clicking on the Package (i.e. the top-left) pane of the Package Browser.

Where traditionally Smalltalk had "Categories" in the left-most pane - a agglomeration of related classes - Pharo has "Packages".  Packages  

A Package is a collection of related classes and extension methods that may be versioned using the Monticello versioning tool. By convention, package names and category names are the same.  The distinction is only a difference once you use the Monticello versioning tool.

Create a new Package's first class by typing over the pro-forma code in the codepane.

The first line is an instruction to the package to create a class that has the same name as the symbol string used as the keyword argument.

The instance variable names use actual strings.

The category argument comes pre-filled from the create package dialogue.

Right-click on the pane and "accept", or alt-s (which originally stood for 'save' rather than accept)


The Pharo screen has a co-ordinate system with 0,0 as the top-left.

The x-co-ord increases rightwards, and the y co-ord increases as you go downwards.


The bottom-right pane of the object Inspector window is a codepane.


In the protocols pane of the System Browser, protocols are called categories in the drop-down action menu.


You can drag and drop methods to new classes, methods to new protocols


No comments:

Post a Comment