What are the benefits of using an alternate ASP.NET MVC view engine?

asp.net-mvc, viewengine

Solution

The reason why people are uncomfortable with the `<% %>` syntax isn't that it contains alot of syntactic salt, but that it makes the Views code-centric, which can go against the MVC concept of making Views as dumb as possible. The goal of Spark, for example, is "to allow the html to dominate the flow and the code to fit seamlessly". So the tangible benefit is making it easier to follow the spirit of MVC.

<viewdata products="IEnumerable[[Product]]"/>
<ul if="products.Any()">
  <li each="var p in products">${p.Name}</li>
</ul>
<else>
  <p>No products available</p>
</else>

If the above is just syntactic sugar, then ASP.NET MVC itself is just syntactic sugar on top of ASP.NET Web Forms.

Problem

I have looked at the usual suspects...Spark, NHaml, etc. They all seem to be syntactic sugar for those that are uncomfortable with the <% %> syntax. Are there any other tangible benefits? Syntactic sugar doesn't seem to me to be a sufficient reason to change out the entire view engine. Reasons posted so far: - Easier to transition from a different platform - More natural context switching - Better separation of concerns - Fewer lines of code - Better resistance against cross-site scripting - Better XHTML compliance

Original source

Related problems