views:

1211

answers:

4

I was wondering if there was a general consensus on the "best" alternative view engine for asp.net MVC. So far I know of Spark, Brail, NHaml but what about others?

+2  A: 

In software, there are no "best" alternative. It always depends in your background, the company you work for, your preferences, your tastes, etc.

Just pick what work best for you for the current project. If you are not sure, pick the safe way, the MS way :)

Eduardo Molteni
i hear what you're saying Eduardo and yes, the MS way seems like the safe way to go but i read about so many complaints about the MS way (namely regarding tag soup). When I look at Spark for example the markup looks much more elegant. I guess I'll just try Spark :)
codette
+3  A: 

I would suggest that you take each of the above View Engines, write a view, and see which works best for you. You might find that for different applications or even for differnt types of view that the choice of View Engine changes.

If you're returning HTML to your client then an engine like Spark might be appropriate. However, if the conent you're returning is XML or some other markup (JSON for example) then Spark won't be much help. NHaml is also focused on XHTML generation.

Consider how you want to test your views, the skill set of your engineers (both developers and testers), the level of support you're hoping to get from your View Engine writer (if you find bugs, how you want those bug fixes deployed) and whether your customer has any preference.

Basically - try a few, see what you like, use a mixture of them if you find that makes sense.

Oh, and here's a good post that lists 4 alternative engines...

http://codebetter.com/blogs/jeffrey.palermo/archive/2008/01/27/mvccontrib-now-offers-four-4-alternative-view-engines-for-asp-net-mvc.aspx

... it mentions an XSLT engine that might be appropriate if you're looking to generate XML.

Martin Peck
A: 

StringTemplate is a decent alternative.

Here's the ViewEngine (with Source), and some tutorials.

jamisonLikeCode
A: 

When making you're decision also make sure you consider the skill level and experience within the team.

If you have developers new to mvc then they are going to find a lot more book, examples and solutions if they are using the default engine. Doesn't mean its the "best" or most productive but might provide the quickest ramp-up time for new developers.

Todd Whitehead