Skip to content.

Manageability

Sections
Personal tools
You are here: Home » blog » stuff » Reuse Via String Substitution

Reuse Via String Substitution

Frame Oriented Processing (i.e. FOP) is an idea proposed by Paul Bassett back in 1978 to improve reuse in systems. It's documented in a book "Framing Sofware Reuse: Lessons From the Real World".

However, if you look at the technique, you'll find it extremely revolting. The mechanism essentially boils down to a hierarchical system of text templates. The top of the hierarchy delegates to templates at each level of the hierarchy, recursively creating a final document. That final document just happens to be source code.

It looks so revolting because it reminds one of the preprocessor found in C. The image that comes to mind is a hierarchical system of preprocessors!

Now at this point it's just easy to dismiss it as some misguided attempt that's fundamentally flawed. I mean, text substitution in source code, that's just too much freedom and it should be plain illegal.

But, could it be that this level of freedom is what's needed to achieve more reuse? If we examine the taxonomy of program generators, string is just a region in the spectrum of representations. That is Strings, Algebraic Types, Quasi Quotes. Its the least safe, however its the most expressive.

However, this dimension is also analagous to the static vs dynamic typing dimension. In static typing information is explicit in the text that defines the type, with dynamic that information (i.e. typing) is implicit and only known at runtime. So the analogy is that with FOP you defer knowledge of the legal structure of a program until everything is composed and compiled.

Where you enforce correctness can be done up front or it can be deferred. By enforcing in up front, you sacrifice expressibility however you improve correctness. However, the dynamic typing adherents will disagree with this. They suggest that correctness can be checked at runtime. Their arguments have a lot of merit, this should therefore imply that string substitution is also a valid technique.

Deferring correctness at compile time may in fact be perfectly acceptable! If you want to explore this technique further, there's a java based implementation called XVCL.

Created by admin
Last modified 2003-08-04 06:44 PM

visitors
reading
 
 

Powered by Plone

This site conforms to the following standards: