A Programming Language Perspective to Compositional Software Architectures

Amr Sabry
Department of Computer and Information Science
University of Oregon
sabry@cs.uoregon.edu
 

1. Programming Language Research

Programming language research spans many areas, several of which are immediately relevant to the field of compositional software architectures: The remainder of this paper expands on each of the above ideas in some detail.

2. Types

There is a wealth of proposals that use types to verify and hence guarantee properties of systems assembled from reusable components. We briefly describe two such ideas:

3. Compiler Optimizations

Partial evaluation is a source-to-source program transformation technique for specializing programs with respect to parts of their input. It can be used effectively in the domain of compositional software architectures to specialize generic reusable components to their particular use cases. There has been several such experiments for optimizing protocol stacks [1, 7], operating system kernels [8], etc. The basic idea of partial evaluation is rather simple. Consider the following example from the XDR protocol [7]:
bool_t xdr_int (XDR *xdrs, int *ip)
{
  if (sizeof(int) == sizeof(long))
    return xdr_long(xdrs, (long *)ip);
  else 
    return xdr_short(xdrs, (short *)ip);
}
The program encodes an integer for transmission on the network. The encoding naturally depends on the machine integer size. Since the type of machine is typically known early in the process, such code is amenable to partial evaluation. If the size of an integer is short, the residual optimized code would be:
bool_t xdr_int (XDR *xdrs, int *ip)
{
  return xdr_short(xdrs, (short *)ip);
}

4. Structuring Programs

We present two ideas about patterns that appear most relevant.

5. Conclusion

We have covered three ideas from programming language research that are useful in the context of compositional software architectures. At the lowest level, type systems might be able to verify some properties but are generally too weak to verify all properties of interest. Program analysis techniques can help in this latter case by automatically rewriting the code to customize the reusable components to their current use. Finally when automatic techniques fail, programmer intervention is supported in a disciplined way using monads and meta-programming. The examples we have chosen are necessarily small but the ideas scale to the large scale integration of components.

References

[1] Edoardo Biagioni, Robert Harper, Peter Lee, and Brian G. Milnes. Signatures for a Network Protocol Stack: A Systems Application for Standard ML. In the ACM Conference on Lisp and Functional Programming, 55-64. ACM Press, New York, 1994.

[2] John Hughes, Lars Pareto, and Amr Sabry. Proving the Correctness of Reactive Systems Using Sized Types. In the ACM SIGPLAN-SIGACT Symposium on the Principles of Programming Languages. ACM Press, New York, 1996.

[3] Paola Inverardi, Alexander L. Wolf, and Daniel Yankelevich. Checking Assumptions in Component Dynamics at the Architectural Level. In the Proceedings of the International Conference on Coordination Models and Languages, 46-73. Lecture Notes in Computer Science 1282, Springer-Verlag, Berlin, 1997.

[4] Gregor Kiczales, John Lamping, Anurag Mendhekar, Chris Maeda, Cristina Lopes, Jean-Marc Loingtier, and John Irwin. Aspect-Oriented Programming. Xerox Palo Alto Research Center Technical Report, February 97, SPL97-008 P9710042.

[5] John Launchbury and Amr Sabry. Monadic State: Axiomatization and Type Safety. In the ACM SIGPLAN International Conference on Functional Programming, 227-238. ACM Press, New York, 1997.

[6] Eugenio Moggi. Computational Lambda-Calculus and Monads. In the IEEE Symposium on Logic in Computer Science, 14-23. IEEE Computer Society Press, Los Alamitos, 1989.

[7] Gilles Muller, Eugen-Nicolae Volanschi, and Renaud Marlet. Scaling up Partial Evaluation for Optimizing the Sun Commercial RPC Protocol. In the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, ACM Press, New York, 1997.

[8] C. Pu et al.. Optimistic Incremental Specialization: Streamlining a Commercial Operating System. In the ACM Symposium on Operating Systems Principles. ACM Press, New York, 1995.