Smalltalk UK meetings, 20-21 Oct

(This page is a mirrored copy of an article originally posted on the LShift blog; see the archive index here.)

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.)

For example,

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'

through the magic of Smalltalk’s reflective ability. The ReStore developer’s manual has more examples.

Comments

On 1 November, 2006 at 6:29 pm, Isaac Gouy wrote:

object-relational mapping for Smalltalk
As you might guess there have been many many OR mapping layers for Smalltalks over the last 15 years, so the interesting question would be how ReStore differs from any of the others.

For example, how does it differ from GLORP

On 3 November, 2006 at 12:56 pm, tonyg wrote:

Well, John did mention GLORP once or twice during his presentation. A few differences that occur to me:

  1. ReStore is commercial, with a cut-down free trial version; GLORP is “open-source” so presumably both gratis and libre (although I couldn’t quickly find detail of licensing).

  2. ReStore does not address mapping objects to an existing (legacy) database schema. For that, John recommended investigating GLORP or one other system that escapes my memory.

  3. A cursory inspection suggests GLORP builds queries using fragments of literal SQL; ReStore uses the clever pseudo-partial-evaluation technique mentioned above.

I’m sure there are other important differences, but really I’m no expert, not having seriously used any Smalltalk OR mapping yet!

On 26 February, 2008 at 4:22 pm, Cameron Cure wrote:

I am interested in learning more about a similar currency trading system. I am new to trading and still learning. Does anyone work with such a system? Thanks, Cameron.