Saturday, February 3, 2007

Stratified design

This is an idea from the book "Structure and Interpretation of Computer Programs" by Hal Abelson, Jerry Sussman and Julie Sussman (an excellent computer science text used in introductory courses at MIT - a must read book).
They come with the idea of Stratified design (programming in a sequence of levels, one level based on another), giving the example of The picture language.


"We have obtained a glimpse of another crucial idea about languages and program design. This is the approach of stratified design, the notion that a complex system should be structured as a sequence of levels that are described using a sequence of languages. Each level is constructed by combining parts that are regarded as primitive at that level, and the parts constructed at each level are used as primitives at the next level. The language used at each level of a stratified design has primitives, means of combination, and means of abstraction appropriate to that level of detail. ... Stratified design helps make programs robust, that is, it makes it likely that small changes in a specification will require correspondingly small changes in the program."

There is also a paper by the authors of the book on this topic: "Lisp: A Language for Stratified Design" by Abelson and Sussman.

This idea is put to work in some of the newer trends in programming, like Language Oriented Programming (Sergey Dmitriev), Intentional Programming (Charles Simonyi), Language workbenches (Martin Fowler), Little Languages (Matthias Felleisen), Grammarware (Ralf Lammel), etc.

2 comments:

Unknown said...

Interesting, but more languages (one language/level) used in the same project is not, generally, recommended. There are languages that perform well at various levels, using the same syntax at any level, but with different meaning. Do they give examples, of language combinations lets say for a 4 level project?

Adrian DOZSA said...

The SICP book of Abelson and Sussman is an introductory book for programming, so offcourse you wouldn't find so complex examples you are asking for. But if you are interested in this approach you should take a look at: Language Oriented Programming (Sergey Dmitriev, Language workbenches (Martin Fowler), Little Languages (Matthias Felleisen), Grammarware (Ralf Lammel) or even Domain Specific Languages. The general idea is to abstract complexity by building levels of abstraction upon the language itself, until you have all the necessary abstraction (language constructs) which map directly into the domain of the application. This approach is more naturally done in open languages, languages that you can extend (you can create new language constructs).