2011-10-16

Intertwine: Normalizing Interface Invocations

This post has been superseded by a new post in 2022
See michael.gr - Intertwine


This is a C# project that I did back in 2011. It consists of a (rather informal) white paper which describes the project, and a zip file containing the source code in the form of a Microsoft Visual Studio solution.

Here is the abstract:
A mechanism is proposed for converting (entwining) method call invocations of any interface to a general purpose single-method normal form, and converting back (untwining) from the normal form to interface invocations, so that operations can be performed on the normal form in a way agnostic to the interface being invoked. The normal form is a delegate in C# or a functional interface in Java, realized as object AnyCall( int selector, object[] parameters ). A DotNet implementation is provided in C#, though the discussion also applies to Java.

And here is the table of contents:
  • Abstract (page 1)
  • The Problem (page 1)
    •  Why messages are bad (page 2)
    •  What is missing (page 2)
  • The Solution (page 2)
    • A hand-crafted solution (page 3)
    • Automating with Intertwine (page 6)
  • Appendix 1: A note about Dynamic Proxies (page 6)
  • Appendix 2: An example: Interface multicasts (events) (page 7)
  • Appendix 3: Things to fix (page 8)


Download the white paper: Intertwine v2.1.pdf
Download the source code: Intertwine v2.0.zip