ASP.NET MVC reminds me of old Classic ASP spaghetti code

后端 未结 14 758
借酒劲吻你
借酒劲吻你 2020-12-24 07:50

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

相关标签:
14条回答
  • 2020-12-24 08:45

    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.

    0 讨论(0)
  • 2020-12-24 08:46

    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 ...

    0 讨论(0)
  • 2020-12-24 08:46

    Check out the StringTemplate view engine, it looks nice and clean.

    0 讨论(0)
  • 2020-12-24 08:46

    Because the people behind MVC really liked ASP/JSP pages and want to implement it all over again. They appear to hate:

    • ViewState
    • Existing ASP.Net Controls
    • Clean Html
    • Existing User Controls
    • Postbacks

    They appear to love:

    • Re-inventing the wheel
    • REST-ful urls

    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.

    0 讨论(0)
  • 2020-12-24 08:47

    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.

    0 讨论(0)
  • 2020-12-24 08:48

    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.

    0 讨论(0)
提交回复
热议问题