PROWAREtech

articles » archived » asp-net » mvc » about

ASP.NET: About MVC

About Model-View-Controller (.NET Framework).

ASP.NET Model-View-Controller (MVC) is a newer framework from Microsoft for website development. Ease and speed of development are the pros of ASP.NET Web forms. MVC, on the otherhand, was designed to get out of the way of the programmer and let him do his work. MVC works great with jQuery (simplifying JavaScript development while adding features and ease, tagline: "write less, do more") because the developer is back to working directly with HTML versus having a control fill out the HTML. There are no server controls in MVC which requires the programmer to code HTML elements directly instead of using Web Server Controls. The runat="server" tag is for the most part gone in MVC. Also, MVC resolves the issue of web application code replication.

Through the Common Gateway Interface (CGI), the server accesses the Controllers' methods first, before any pages are run/accessed. The controller may return any page that the programmer deams right (or an AJAX snippet if need be). The difference with Web forms is that the page is accessed first much like early web servers serving static text files. So MVC is really serving executable code/methods, not files. MVC allows greater flexibility as to how to respond to the web browser.

ASP.NET MVC has Views which are driven by the Controller(s). The View is the user interface, a page, along with a master page. An entire website can be created using just a Controller and Views but if it will be a data-driven one then it would be good practice to use a Model. And interestingly, an entire website can be created using just Controllers! Controllers are very important and perhaps the acronym should me CMV — Controller-Model-View.

ASP.NET MVC is like the original Active Server Pages (ASP) in that it will chop-up code into snippets of HTML along side snippets of executable code. As mentioned, this means a return to writing HTML instead of having controls do it. Care must be given to keeping as much executable code in the Controller and out of the View.



This site uses cookies. Cookies are simple text files stored on the user's computer. They are used for adding features and security to this site. Read the privacy policy.
CLOSE