Spark view engine

If you’re interested in the new Microsoft MVC framework but you’re a little skeptical about going back to a classic ASP Tag Soup rendering system, you should check out the Spark View Engine.

It has a very interesting way of allowing you to write your view with some simple string replacements and also specialized tags that appear to be actual HTML. The general idea is basically the same but visual appeal is quite a bit better.

Here is an example:

<var names=“new [] {‘alpha’, ‘beta’, ‘gamma’}”/>

<for each=“var name in names”>

  <test if=“name == ‘beta'”>

    <p>beta is my favorite.</p>

    <else/>

    <p>${name} is okay too I suppose.

  </test>

</for>

 In this case your “foreach” loop appears to actually be part of the html. The code inside of the each attribute is compiled as C#.  The system it uses is pretty straightforward and easy to understand which gives me a lot of confidence in it already.

I have been having problems getting NVelocity to work properly so I am going to try to use Spark as the default NBusiness code generation tool. We’ll see how intuitive it is to have this pseudo-html markup inside of code but I suspect this tool will work much better for NBusiness.

Author: justinmchase

I'm a Software Developer from Minnesota.

%d bloggers like this: