Skip to main content

What Are Transforms?

A transform is a function that defines a canonical translation from one message type to another. Transforms are the glue that enables components to communicate even if they use different message standards.

On the surface, a Flex transform seems similar to a function in C++ or Java. However, not every function is a good transform. Transforms define translations between ontologically significant data types. For a detailed description of ontological significance, see Ontological Significance and Messages.

Transforms should specify translations between messages, not general computation; the output type should contain roughly the same information as the input, just in a different form. The job of a transform is not unlike that of a translator for human languages: In international relations, for example, it is critical for translators to preserve the information that speakers intend to communicate to listeners, even though the language for expressing the information is changed. Failing to preserve the information can have serious effects on diplomatic relations. The same is true of transforms for facilitating communication between software components; the transform should leave the core information intact.

Transforms should also be defined between ontologically significant messages; the meanings of the input and output types should be unambiguous. The danger of ambiguity can also be seen in the international relations analogy: Mistranslation can happen when translators have different understandings of the meaning of a word. But because the language used for international relations is relatively unambiguous, information can be translated from English to French to German and so on without significant degradation of meaning. The same is true in Flex: The power of transforms comes from the ability to automatically generate new transforms by fusing other transforms together, thus avoiding a lot of manual code writing. But fusion is only safe when the transforms interpret messages in the same way.

Once you understand what a transform is for, see the Writing Transforms how-to guide to define one, and the Transforms and Functions reference for the full syntax.