Monday, 19 October 2015

Pharo By Example (PBE), Ch. 1

Pharo consists of 4  files.


<name>.sources   Essentially, libraries of code

pharo.image  A snapshot of the system at the last time it was closed gracefully

pharo.changes A list of all changes applied to Pharo since it was started on your installation

Theoretically, anyway.  The PBE 1.1 One-click installer has a plethora of files in the .zip


Moved Pharo to D:\

When it was in c:\Program Files (x86)\GRL\Coding\,
   a) it lacked permissions to save changes to the image file.
   b) pharo.exe was not recognised by the Start Menu

I have also now right-clicked on Pharo.exe and pinned it to the taskbar


"click" = left-click
"action-click" = right-click
"meta-click" = middle/wheel-click


Lots of the options are shown by left-clicking on the Pharo window background, e.g.
Workspace [open]
Class Browser
Monticello Browser
Tools submenu -
   Message name
   Method finder
   Transcript [open]
   File Browser
   Process Browser
   Recover lost changes
   Change sorter
      Image Browser
      + others
Windows submenu
Debug submenu
System submenu
Plus, Save & Quit


The Transcript is a display-only window
The Workspace allows user input, and also displays output


A protocol is a list of methods that an object will respond to.

If an object has a lot of methods, the methods will be grouped into several protocols, each protocol will contain a list of related methods.  e.g. Class Object has 59 protocols!


You can navigate to a class in the Class browser
      <classname> browse
      in a workspace, and do it
highlight its name and "browse it" alt-b
find it by clicking in the package pane, and alt-f

To find a method - World | Tools | Method Finder

In the top-left pane type a method's name OR an example of what it does
e.g. 'eureka' . 'EUREKA'
will offer the names of methods that do that

You can also find a method in the Method Finder


A Class will now often have a "category" defined, e.g. the OBCommand Class has a category of "OmniBrowser-Commands"

This means that it is part of the OmniBrowser package, in the Commands sub-category

Category and package seem to be interchangable terms.


By convention, tests for methods go in a Class named "<Classname>Test"


If you want to use a literal ' in Smalltalk, escape it with a preceding ' - so type '' in the code (2 ' side by side)


To run a test:  World | Test Runner

In the bottom-right pane, the Class and method of any failing tests is listed.

To bring up the Debugger from a test that's been run in the TestRunner, select the line of text in the bottom-right pane of the TestRunner, (of the form <ClassName> >> #<methodName>

The top-most message in the Debugger pane is the method that had the issue.


No comments:

Post a Comment