The real beauty of Groovy's builder paradigm is the way in which it maps the naturally nested block structure of the language to the construction process.
The process of defining parent-child relationships between objects through nested code blocks is well-established through other markup languages, such as XML and HTML.
The transition from writing XML or HTML to the GroovyMarkup
equivalent is an easy one. To make use of a builder, we don't need to have an intimate understanding of the Groovy MOP or of how the builder is implemented. We just need to know how to write the builder code so that it conforms to the correct language semantics. The code structure of the builder pattern relies on just a few Groovy language features: