BB8 - MoveShape example


USE CASE.
Consider a Draw program such as the PowerPoint slide editor. A user can create and place different shapes such as ovals, polygons, lines and other shapes. A Connector is a special line that runs from one shape to another. The line will always connect the two shapes even if the shapes move. This program implements the shape:move: operation.

A a PowerPoint presentation of the example is here.

THIS EXAMPLE HAS LIMITED FUNCTIONALITY
A constraint of this example is that the code shall be so simple that it can be explained in a regular talk. The code is therefore limited to a single connector. Also, Context classes are subclasses of BB1Context, the context base class that provides general runtime mechanisms. In this case, the remap method has been overridden to make the binding mechanism easier to explain (but not as general).

A NOTE ON THE IMPLEMENTATION
There is one Context class with one system operation
     shape: aShape move: aPoint inData: drawing

The code can be read and run in BabyIDE.
The informal code can be read in the HTML-file for the constrained version with a single Connector:

BB8aMoveShape:
reader-friendly version
printer-friendly version

A version without the above restriction illustrates the use of Roles mapped to collection objects

BB8bMoveShape:
reader-friendly version
printer-friendly version

There is a toggle for choosing between the versions at the top of the documents.