What is ASP.NET MVC about ?- is it just about URL's?
MVC frameworks in general?
开发者_JAVA百科 Is it different from MVC in desktop GUI applications? What exactly is it that makes it easier to test than WebForms ? (Can't you test Code Behind in a similar way to MVC controllers)I have the impression that ASP.NET MVC is mostly about clean URL's - with controllers processing user input in the form of URLs.
A barbone web forms application in classic ASP for example is very different from the MVC concept. While ASP.NET Webforms with events and page-state goes more in an MVC direction as one thinks of it in a desktop GUI world.
How about trying Wikipedia?
Quoting: "Model–View–Controller (MVC) is a software architecture, currently considered an architectural pattern used in software engineering. The pattern isolates "domain logic" (the application logic for the user) from the user interface (input and presentation), permitting independent development, testing and maintenance of each (separation of concerns)".
So it helps making an application organized (because it imposes that you separate your business or domain logic [model] from all interface code [view]).
It also makes much easier to apply TDD.
And, speaking of Web MVC .NET frameworks (like ASP.NET MVC, Castle Monorail or OpenRASTA), they also normally allow:
- Seeing web pages as they really are - stateless resources (instead of creating fake state retention, like the ASP.NET WebForms ViewState).
- The existence of client-side programmers in your job that do not know (and probably don't want to know) anything about .NET.
- Elegance (as opposed to spaghetti code, or, well, WebForms).
- Nice URLs!!!
BTW: there are a LOT more benefits, and if you are unable to perceive them, I would recommend that you look beyond the .NET world. You'll notice that almost every other language/environment has at least one MVC framework available:
- Python has Django.
- Ruby has Ruby-On-Rails.
- Java has Spring, Play.
- PHP has CakePHP, Symfony.
- And so forth...
Which clearly shows that MVC is an idea worth repeating, and a proven architectural pattern.
精彩评论