This last weekend saw two Smalltalk-related events: the second Smalltalk UK meeting, and a Camp Smalltalk, both held at JP Morgan’s offices in London.
On the Saturday, Bryce Kampjes gave an in-depth guided tour of his Exupery compiler (see also SqueakSource), and Francisco Garau gave an overview of the now ten-year-old, massively complex JP Morgan Smalltalk project, Kapital (which Cincom are very pleased by).
Friday’s meeting saw two presentations. The first, by John Aspinall, author of ReStore (warning: extremely obnoxious use of blink tag), an object-relational mapping for Smalltalk, covered the basics of the ReStore system. The second, by Andy Bower of Object Arts (who build Dolphin Smalltalk), introduced his Smalltalk trading platform, Alchemetrics, and demonstrated its use for developing and testing automated trading strategies.
Both talks were fascinating, particularly Andy’s presentation of the details of developing and using an automated trading system for working with Real Money in Real Markets (scary!), but there was one interesting technical point from John’s talk I wanted to draw particular attention to here.
One very clever part of ReStore’s design is the way it converts ordinary Smalltalk code into efficient SQL queries. An object somewhere between a null object and an interpreter (in the form of a partial-evaluator) acts as a proxy for the complete collection being selected from. Most messages sent to this proxy are handled by its
doesNotUnderstand handler. Each such message causes it to build another stage of the SQL query it represents. Once the query block has finished executing on the proxy object, the proxy is asked to convert itself into a finished SQL query ready for execution. (This is extremely similar to the approach taken to collection iteration in Higher-Order Messaging.)
allPersons := aReStore instancesOf: Person. "Retrieve all instances of Person with the surname Smith" allPersons select: [ :each | each surname = 'Smith'].
will be transformed into
SELECT * FROM PERSON WHERE SURNAME = 'Smith'