May 20, 2008

Fear of parsers?

Martin Fowler posts a lot about DSLs these days. In a recent post about ParserFear, he comments on an apparently typical reaction against creating one's own DSLs. That reaction seems to be that parsers are hard to write, and that it's easier to use XML instead because with XML, you get the parser for free. Martin Fowler then continues to explain why in his experience, parsers are not hard to implement, by contrasting a specific XML case with an alternative design using Antlr.

I think he misses the point, though. It's indeed the case that, taken by themselves, parsers are not very hard to write, especially if you stick to simple grammars. However, they could just be a too high investment for too little return.

This reminds me of a different story: A couple of years ago, Erich Gamma answered a few questions about patterns in one of his talks. One question was about which patterns he would not include anymore in the Design Patterns book. Among others, he mentioned the Singleton and the Visitor pattern, and his explanation for not including them was that he deems them too complicated.

Most people react puzzled when they hear this story. Yes, everybody who has tried to implement visitors knows that they are quite complicated, but in contrast, singletons seem extremely simple and straightforward to implement. However, the major point here is that they are too complicated for what they achieve: A singleton only guarantees that you get exactly one instance of a class, not more, not less. You might as well just introduce a global variable with that one instance and don't bother going through the minutiae of implementing the Singleton pattern correctly (which has border cases that you can get wrong after all, depending on what language you have to implement it in).

That's the major point: The effort has to be compared against the benefits you achieve. The same holds for writing parsers for DSLs. A domain-specific syntax simply doesn't buy you that much, but just creates another layer of code that needs to be maintained and can create follow-up problems, for example, when the syntax you designed happens to be too inflexible to be adapted to change requests in future versions of your code.

This is also the main reason why Lispers like s-expression. The rules for s-expressions are extremely simple, but at the same time also very flexible: The first element in a list determines the meaning of an expression, and all other elements are interpreted in terms of that first element. The same in XML: The tag determines the meaning of an expression, and everything that is nested inside it is interpreted in terms of the tag. An advantage of Lisp over XML is that you don't even need separate reading and processing steps of DOMs, since s-expressions are seamlessly embedded in the language itself.

So the main point of "parser fear" is not that parsers are hard, but just too hard for what they buy you.

April 18, 2008

ELS'08: Invited talk

Details of Marco Antoniotti's keynote talk, to be presented at the 1st European Lisp Symposium 2008 in Bordeaux on May 23, 2008, are now available at the symposium website.

Registration is open - watch out for reduced fees before the early registration deadline!

April 09, 2008

ELS'08: Programme published, registration, and more...

We have published the list of accepted papers that will be presented at the 1st European Lisp Symposium (ELS 2008) in Bordeaux/France on May 22-23. We have papers about temporal reasoning, context-oriented programming, visual programming, object-relational mappings, clim presentation types, custom specializers for object-oriented lisp, binary methods programming in CLOS.

Programme of the symposium.

We have also provided information about Bordeaux and about the social events programme accompanying the symposium. There will be a cocktail party, a dinner, and an optional excursion to the atlantic coast.

Information about Bordeaux, including how to reach Bordeaux by plane and by train.

Details about the social programme.

Registration for the symposium and for the optional excursion is open! Please take advantage of the reduced registration fees before the early registration deadline, April 25, 2008. Registering early helps us in planning the details of the symposium better. The early registration fee is 50€ for students and 120€ for regular participants.

The registration page.

You have to take care of accommodation yourself. We have provided a list of recommended hotels. For some of them, accounts for symposium participants are available.

The list of recommended hotels.

Looking forward to seeing you in Bordeaux!

March 18, 2008

ELS'08 News!

Hi everybody,

Here are some news about the upcoming 1st European Lisp Symposium, that will take place in Bordeaux/France on May 22-23, 2008.

First of all, registration is now open to everybody, and you can register for the symposium and the accompanying social event at the symposium website.

There is no programme yet, because the paper submissions are currently still under review. (The programme will be announced in early April.) However, Marco Antoniotti has kindly accepted an invitation to give the keynote for the symposium. More details on his keynote talk will follow soon.

On a related note, the call for work-in-progress papers is still open. We have actually just extended the deadline to April 4, 2008 for submissions for this track. This is a great opportunity to get early feedback for your current projects from other researchers, practitioners and educators.

Finally, we have added two pages to the website about Bordeaux in general and an optional social event that you can additionally book when you register for the symposium: A whole-day visit of the atlantic coast on the Saturday immediately after the symposium, which includes a boat trip, a seafood and white wine tasting session, a lunch, and a trip to the Great Dune of Pyla, the highest sand dune in Europe. Don't forget your swimsuit, if climbing the 107 meters of the dune invites you to dive into the ocean!

More news to follow as they arrive.

March 08, 2008

COP in Journal of Object Technology

There is a new article about Context-oriented Programming in the Journal of Object Technology.

It discusses context-oriented extensions for Common Lisp, Smalltalk and Java, namely ContextL, ContextS and ContextJ. There is a new ContextL example presented in this article that we haven't discussed in any of the previous papers, so it should be an interesting read for ContextL users as well.

As always, please feel free to send feedback and suggestions.

December 19, 2007

Origin of Advice

Apparently, Gary King needs advice a lot. This reminded me that I posted an article about the origin of advice some time ago in the AOSD mailing list. I think it's a good idea to repost it here to make it available to others as well, so here we go. (I have links for almost all the literature references at the bottom of this article.)

The notion behind advice can be traced back to a paper by Oliver Selfridge [Selfridge 1958]. He introduced the notion of demons that record events as they occur, recognize patterns in those events, and can trigger subsequent events according to patterns that they care about.

A first software system that was obviously heavily influenced by that paper was called PILOT and is described in Warren Teitelman's PhD thesis [Teitelman 1966]. The PhD thesis was supervised by Marvin Minsky, but additionally Warren Teitelman mentions Oliver Selfridge as a strong influence in his acknowledgements. Marvin Minsky and Oliver Selfridge worked both at MIT back then. Anyway, that is the work in which the notion of advice, very similar to before and after advice as we know them today, was actually first introduced. Warren Teitelman later added the concept of advice to BBN Lisp, which was then bought/licensed (?) by Xerox PARC and became Interlisp.

Later, the notion of demons was mentioned in a seminal paper by Marvin Minsky [Minsky 1974] that spawned an interest in framework-based knowledge representation systems. Among others, Daniel Bobrow and Terry Winograd developed and described KRL [Bobrow, Winograd 1976], which was based on the ideas in Marvin Minsky's paper. If I understand correctly, before/after demons played an important role in such systems.

A little bit later, Howard Cannon developed Flavors at MIT, the first object-oriented extension for Lisp, strongly influenced by Alan Kay's Smalltalk. Howard Cannon had written a very influential paper [Cannon 1979-2003] that was, unfortunately, never officially published. He explicitly mentions before/after demons, as do other publications about Flavors, for example [Weinreb, Moon 1980].

I have a copy of Howard Cannon's paper availabe, and I have asked him to make it publicly available, but he still hasn't done this (yet). His is a mind-blowing paper that introduces multiple inheritance, method combinations based on macros - i.e. before and after demons and a first precursor to around methods -, and the notion of meta-protocols that obviously later on turned into metaobject protocols.

The experiences with KRL and Flavors had then been integrated at Xerox PARC into LOOPS (Lisp Object-Oriented Programming System), foremostly by Daniel Bobrow and Mark Stefik, implemented in Interlisp. There is a nice overview page about LOOPS and a download page for the papers mentioned there.

Flavors and LOOPS were chosen as the main bases for the Common Lisp Object System (CLOS) as part of the ANSI standardization of Common Lisp. CLOS was developed by representatives of the various existing object-oriented extensions for Lisp. LOOPS / Xerox PARC was represented by Daniel Bobrow and Gregor Kiczales. This was around 1986 - 1988.

CLOS has before/after/around methods. I haven't been able to spot when around methods entered the scene, whether this was already part of LOOPS or whether this was an addition in CLOS. In Flavors, there were only before/after methods, but there was an extra concept called wrappers that effectively allowed one to express the same thing as around methods in CLOS.

One of the most impressive outcomes of the efforts behind LOOPS and CLOS is the book The Art of the Metaobject Protocol [Kiczales, des Rivières, Bobrow 1991], which I think is one of the most important books in the history of computer science (and Alan Kay seems to agree).

Crista Lopes' paper [Lopes 2002] describes the subsequent history how metaobject protocols were turned into what we think of as aspect-oriented programming today. The main motivations, as far as I understand them, were a) to move from a runtime-based approach, which is natural for metaobject protocols, towards a compile-time based approach and b) to make some of the benefits of being able to manipulate the meta-level available to purely base-level code. Advice play an important role in aspect-oriented programming, but instead of advising just single functions, you can advise whole pointcuts, which are essentially sets of functions described in (more or less) declarative ways.

Robert Hirschfeld, myself and others have taken a different turn with Context-oriented Programming, and focus on a more dynamic approach again. We have taken the idea of crosscutting concerns that emerged in the AOSD community, but dropped the idea of pointcuts, and instead concentrated on new and interesting ways to dynamically activate and deactivate layers, which are potentially crosscutting behavioral program variations. Since you can add new layers at any point in time, you can also effectively add new levels of before/after/around methods at runtime as needed, something that can be achieved in plain CLOS only statically through new user-defined method combinations, or requires recompilation in aspect-oriented language extensions like AspectJ. Here are some links for Context-oriented Programming:

I agree that advice are an important concept in programming, but we have still not seen all the possible and interesting variations yet. Although they have a long history already, there is still a future ahead for them.

References


Reflection in Potsdam

Charlotte Herzeel and I had been invited by Robert Hirschfeld to give presentations at the Hasso-Plattner-Institut in Potsdam, Germany about the CLOS Metaobject Protocol and 3-Lisp about two weeks ago. These presentations have been recorded and are now online for your viewing pleasure:

You need RealPlayer to see this.

December 10, 2007

European Lisp Symposium mentioned in Linux Magazin

The 1st European Lisp Symposium is mentioned in Linux Magazin online (in German language).