I just went through some MVC tutorials after checking this site out for a while. Is it just me, or does MVC View pages bring back HORRIBLE flashbacks of Classic ASP spaghet
I think the problem with the ASP.NET view engine is that there are no restrictions on what you can do, since its just a .NET language embedded in XHTML.
In contrast, take a look at the Django template engine. In the Django framework, the controllers and models are written using the full-blown Python language, but the view template engine defines a restricted language which only provides basic programming constructs (conditional, loops, etc). This restricted language resembles Python but it isn't actually Python, so it cannot invoke arbitrary code like external libraries. It can only access the model data that is passed in to the view.
Any view engine that embeds a general purpose language is going to have the problem where people abuse it and do things they shouldn't in the view. So with those engines you really need to have the due diligence to constrain yourself from doing things other than access the model data.
After programming MVC for a while now, I'm going back to ASP.NET.
MVC is indeed a nice step forward from classic ASP or PHP, but it is a big step back compared to ASP.NET.
Many things that can be programmed with a few steps in ASP.NET need a lot more work in MVC. Making it harder to meet deadlines.
The technology has it's merits, but isn't mature yet.
Maybe in version 3.0 ...
Check out the StringTemplate view engine, it looks nice and clean.
Because the people behind MVC really liked ASP/JSP pages and want to implement it all over again. They appear to hate:
They appear to love:
MVC essentially is a way of forcing a separation of code from presentation. If a developer actually cared enough, this could be easily acheived with normal Asp.Net. It is possible to punk the whole "separation" system anyway, so I don't really see the point.
That being said, there is some merit to it.. but not enough to outweigh the problems. MVC version 3 I'm sure will be awesome.
And before anyone marks me down -1, see how many MVC questions I've answered. I know what i'm talking about.
UPDATE If you are taking your separation seriously, upon looking at it, chaiguy1337 is onto a good thing. String Template looks great because it does not allow any code in your front end! In my opinion, the ASP.net MVC team dropped the ball on MVC.
Finlay Microsoft is correcting his error with ASP-Classic to ASP.NET step. 70% of old asp programmers went to PHP because ASP.NET was to complex.
They tough that everything can be solved with ASP.NET drug and drop menus. And in the end everything is inside form tag! We are building big "web form" not web sites. Just look at the HTML from any ASP.NET site. Absolutely horrible!
ASP.NET MVC is the new HOPE for cleaner more organised HTML code and powerful business logic.
If you don't like the default View engine, you can use another one.
As per Scott Guthrie's blog:
One of the things the team has done with ASP.NET MVC is to make sure you can use any type of "view engine" you want with it. This provides a lot of flexibility to customize the rendering engine however you want.
We are going to be investigating some more declartive view engines in the future - although nothing specifically planned just yet.
Examples of alternative View engines are NHaml discussed here, Spark discussed here and NVelocity discussed here.