home
post
transform view

Transform View

Mar 3, 2024
2 min
1 chart

The challenge of rendering HTML markup has been present since the inception of the web. This problem is solved by a multiple patterns mostly on the server side. Such patterns as Template View, Two Step View and Transform View are described in the Martin Fowler's book (2002) Patterns of Enterprise Application Architecture. Depending on the complexity of UI and the domain model Martin suggests different patterns. All these patterns work with [MVC] (https://www.buzzchart.info/post/model-view-controller) very well.

What I found peculiar, in the pattern Transform View, that it has very similar principals to all modern component base web frameworks.

This is the quote from a book:

Using Transform View means thinking of this as a transformation where you have the model's data as input and its HTML as output.

In comparison to React, the Transform View concept can be reimagined as using React to transform model data into JSX output.

The React has broader and more abstract definition. It's main concept to have a UI as a composition of small components, that can be reused. This paradigm empowered by JSX creates flexible and system of defining and reusing components.

Transform View pattern is focused on the Domain model rendering. In this case class method, that corresponds to the Domain model entity or attribute knows how to create HTML. Back in the 2002, when the book was written, to solve this problem another "language" was used called XSLT, which stands for Extensible Stylesheet Language Transformations. XSLT is a language, XML based, which allows you to define transformations. XSLT supports elements like if, else, for, choose template, choose stylesheet.

In Transform View pattern you will combine your transformations defined XSLT and render those to the HTML.

I am comparing here XSLT and JSX. XSLT can include another XSLT, which provides nesting capabilities. But defining components together with the JavaScript code in the JSX and reusing components in the JSX, was the reason React has such a widespread adoption. I think that Developer Experience DX, dictates what technology is used in the long run. Despite being an appropriate choice at the time, XSLT was eventually sidelined because of its cumbersome XML syntax and lack of development tooling.

Related Posts
© 2025 buzzchart.info