h.Transform View Pattern

  1. Motivation

      1. A view that processes domain data element by element and transforms it into HTML.

  2. Summary

      1. The basic notion of Transform View is writing a program that looks at domain-oriented data and converts it to HTML.

      2. The program walks the structure of the domain data and, as it recognizes each form of domain data, it writes out the particular piece of HTML for it.

      3. Can also be consumed by Template View.

      4. There are several technologies that provides out of the box support and XSLT Transform is a great example of this.

      5. Handcrafted transformation is used very well in several circumstances like Master Details view.

  1. When to Use

      1. MVC is a very good candidate for this pattern.

  1. Related Technologies

      1. ASP.Net, XSLT Transform

  1. Specific Considerations

    1. Transform View Vs Template View

        1. The key difference between Transform View and Template View is the way in which the view is organized.

        2. A Template View is organized around the output. A Transform View is organized around separate transforms for each kind of input element.

        3. The transform is controlled by something like a simple loop that looks at each input element, finds the appropriate transform for that element, and then calls the transform on it.

        4. A typical Transform View's rules can be arranged in any order without affecting the resulting output.

        5. Template View is used for structural definition of generic view and can also consume transform view.

  1. References