Can you explain why Google Closure Templates uses so many pointless intermediate objects?
<p>Ladies, gentlemen.</p>

<p>I was reading <a href="https://developers.google.com/closure/templates/docs/helloworld_java" rel="nofollow">Google's documentation for Closure Templates.</a></p>

<p>There's not that much code in there, but it represents what I'm having trouble understanding (in Java, in particular). I'll go line by line:</p>

<pre><code>// Bundle the Soy files for your project into a SoyFileSet.
SoyFileSet sfs = new SoyFileSet.Builder().add(new File("simple.soy")).build();
</code></pre>

<p>I get this. An object to gather multiple template files. Fine. But why the <code>.Builder()</code>? Why not just <code>new SoyFileSet().add(...).build()</code>?</p>

<pre><code>// Compile the template into a SoyTofu object.
// SoyTofu's newRenderer method returns an object that can render any template in file set.
SoyTofu tofu = sfs.compileToJavaObj();
</code></pre>

<p>Fine. But why do I want this? After I have the files gathered, I was expecting just something like <code>sfs.render(Map&lt;&gt; data)</code>. Why do I need to compile this to a Java object?</p>

<p>And finally...</p>

<pre><code>// Call the template with no data.
System.out.println(tofu.newRenderer("examples.simple.helloWorld").render());
</code></pre>

<p>Great, why do I have to create an intermediate object just so I can call a method od it? Why couldn't the <code>sfs</code> object have a <code>.render()</code> method? Why do I need a <code>Renderer</code> object?</p>

<p>Java is frustrating, why aren't things done in a straightforward way? </p>
