On Smalltalk

thoughts on Smalltalk and programming in general…
  • Home
  • About
  • Good Books
  • My Squeak Image
  • Popular Posts

Fowlers Introduction to Domain Specific Languages Talk

By Ramon Leon - November 6, 2006 under Programming, Smalltalk

Martin Fowler gives a great talk about the style of domain specific languages, and clearly covers all the main points about the advantages and disadvantages of those styles. This guy is always worth watching, he’s very good at summarizing all the sides of an issue in a very unbiased and informative manner. He doesn’t specifically mention Smalltalk, but every time he says Lisp, you can just pretend he said Smalltalk, it all applies.

Here’s the Smalltalk version of his sample code, in a Smalltalk DSL for comparison.

(Mapping for: #SVCL type: ServiceCall)
    extract: 4 to: 18 for: 'customer_name';
    extract: 19 to: 23 for: 'customer_id';
    extract: 24 to: 27 for: 'call_type_code';
    extract: 4 to: 18 for: 'date_of_call_string'.

(Mapping for: #USAGE type: Usage)
    extract: 9 to: 22 for: 'customer_name';
    extract: 4 to: 8 for: 'customer_ID';
    extract: 30 to: 30 for: 'cycle';
    extract: 31 to: 36 for: 'read_date'.

Simple, clean, no XML necessary, just objects and messages!

Tags: Lisp, Smalltalk

Related posts
    at: "Domain Specific Languages - Ruby, a Sign Post on the Road to Smalltalk";
    at: "Smalltalk Solutions 2008";
    at: "Popular Posts";

9 Comments so far

  1. InchingForward on November 6th, 2006

    It’d be interesting to see the example he uses demonstrated in a Smalltalk environment.

  2. Ramon Leon on November 6th, 2006

    Good idea, done!

  3. brett on November 6th, 2006

    Do you have a link to the article?

  4. Ramon Leon on November 6th, 2006

    It’s in the article, but you’re the second to ask, so I’ll make it more obvious.

  5. diprey on November 6th, 2006

    You don’t need to be teasing people. Now, can you do it once again, in XML? Seriously though, isn’t it preaching to the choir?

  6. Ramon Leon on November 6th, 2006

    Actually, no, it’s not, since I’m hoping to draw both .Net and Ruby folk to the site to see how they compare to Smalltalk. This stuff might be old hat to Smalltalkers, but this kind of code is shocking to those from mainstream languages(though this example is too simple to truly benefit from Smalltalk), and I figure interest in Seaside will get me read by many who don’t know anything about Smalltalk.

  7. Anxious Bystander on November 20th, 2006

    There is an interesting specific advantage of Smalltalk over Ruby here. Smalltalk can use cascaded messages (with “;”) to do a natural nesting. Ruby does not have this, so has to use a block. The disadvantage of the block is that you either have to either (a) pass in an (explicit) parameter to act as (the explicit) receiver of the nested messages, or (b) use Ruby’s instance_eval, which has unpleasant side-effects in some cases.

    Does your ST need parenths around the first lines?

  8. Ramon Leon on November 21st, 2006

    Yea, the cascade operator is one of my favorites. Excellent catch, in fact it should required parens. Fixed.

  9. The future of programming « Tekkie on December 17th, 2006

    [...] Some time back I read a post by Ramon Leon on domain-specific languages (DSLs), and how Smalltalk fit into that picture. He linked to an online video of a presentation by Martin Fowler, talking about this. It was very interesting. Ramon continued talking about DSLs in subsequent posts. Each time clarifying it in my mind. Over time I’ve come to realize this is the answer to why I’ve been so interested in these languages. [...]

Posting your comment.


  • Sponsors

  • Tags

    Databases General Linux Lisp Magritte Performance Profiling Programming Ruby Seaside Smalltalk Sql Squeak Updates
  • Categories

    • .Net (5)
    • Databases (9)
    • General (5)
    • Linux (2)
    • Lisp (3)
    • Magritte (2)
    • Programming (62)
    • Ruby (6)
    • Seaside (42)
    • Smalltalk (72)
    • Sql (2)
    • Stuff I Just Like (6)
    • Updates (7)
  • Blogs

    • (gem)Stone Soup
    • Avi Bryant
    • Boris Popov
    • defmacro
    • Giles Bowkett
    • Goran Krampe
    • James Robertson
    • Lukas Renggli
    • Martin Fowler
    • Paul Graham
    • Ralph Johnson
    • Randal Schwartz
    • Vassili Bykov
    • Weekly Squeak
  • Favorite Tools

    • Apache
    • Cygwin
    • FireFox
    • Scriptaculous
    • Seaside
    • Squeak
    • Squeak Dev Image
    • Ubuntu Linux
    • WordPress
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org

Copyright © 2008 On Smalltalk