locked
What is MVC and what can it do? RRS feed

  • Question

  • User-631880478 posted

    Hi guys. I don´t know what is MVC and I can do with it. I'm sorry if I misunderstood, but I'm spanish

    Thursday, October 24, 2013 11:27 AM

Answers

  • User2103319870 posted

    HI,

    The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating Web applications. The ASP.NET MVC framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication. The MVC framework is defined in the System.Web.Mvc assembly.

    MVC is a standard design pattern that many developers are familiar with. Some types of Web applications will benefit from the MVC framework. Others will continue to use the traditional ASP.NET application pattern that is based on Web Forms and postbacks. Other types of Web applications will combine the two approaches; neither approach excludes the other.

    The MVC framework includes the following components:

    • Models. Model objects are the parts of the application that implement the logic for the application's data domain. Often, model objects retrieve and store model state in a database. For example, a Product object might retrieve information from a database, operate on it, and then write updated information back to a Products table in a SQL Server database.

      In small applications, the model is often a conceptual separation instead of a physical one. For example, if the application only reads a dataset and sends it to the view, the application does not have a physical model layer and associated classes. In that case, the dataset takes on the role of a model object.

    • Views. Views are the components that display the application's user interface (UI). Typically, this UI is created from the model data. An example would be an edit view of a Products table that displays text boxes, drop-down lists, and check boxes based on the current state of a Product object.

    • Controllers. Controllers are the components that handle user interaction, work with the model, and ultimately select a view to render that displays UI. In an MVC application, the view only displays information; the controller handles and responds to user input and interaction. For example, the controller handles query-string values, and passes these values to the model, which in turn might use these values to query the database.

      Soruce URL : MVC OVerview

      If you are looking for tutorials links here the best links for MVC Tutorials

      The best online Tutorial you will find for MVC none other than this site itself

      If you are looking for E-Learning Tutorial on how to get started with MVC. Please check the below links

      Also you can check out this link for various tutorial links

      If you are looking for hands on  tutorial on how to get started with MVC. Below are two of best hands on sample tutorial available for MVC

      NerdDinner

      Music Store

      Below are some Video Tutorial links which will help you to get started in MVC

      For best books in MVC you can check out the below links


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 24, 2013 11:44 AM
  • User281315223 posted

    Model-View-Controller (or MVC) is an tiered / layered architectural principle / design-pattern for designing an application, much like Web Forms or some of the other types of applications that you may have developed in the past. If you are familar with Web Forms, it may seem a bit foreign to work with at first but I would argue that it provides much more flexability and control within your applications and it also more closely mimics the Web (as opposed to Web Forms which are modeled after a more Desktop-oriented design).

    The major benefits using MVC comes with the seperation of concerns throughout your application. As the name implies your projects consist of three components: the model, the views and the controllers.

    • Model - Handles all of the core logic within your application, such as handling the access of data from your database.
    • View - Handles the display and presentation of everything within your application, such as displaying all of the contact information for a specific user.
    • Controller - Handles all of the business logic within your application - such as recieving the data from the Model, performing any necessary operations and passing it onto the View to be presented to the user.

    You can find quite exhaustive explanations of the MVC pattern and its benefits in the following links :

    The ASP.net site actually features several videos on MVC and several tutorials from "Getting Started" to more advanced topics :

    Related Comparison

    I have used the following detailed comparison that shows some of the benefits of MVC and Web Forms previously, so hopefully it can demonstrate some of the advantages and disadvantages of each.


    Each of these technologies have their own advantages and disadvantages and this can highly depend on which of them you are more familar with (familarity with a specific technology will always allow you to develop applications and projects much quicker).  Both are completely capable of accomplishing the same thing, but use different design patterns to get it done.

    That being said, this is a heavily discussed topic that you can find scattered all over the net, but here are a few of the major advantages of  both of them : 

    Advantages of Web Forms

    • ViewState - A ViewState that allows you to persist objects and values throughout your application.
    • Rapid Application Development - Very little learning curve, user-friendly and easy to get an application up and running quickly.
    • Controls and Toolbox - A huge Toolbox with basically any major Control that you would need for developing applications.
    • Maturity - Web Forms have been around over 10 years so there are alot of communities and resources available and many bugs and issues have been addressed.
    • Code Generation - Web Forms makes it quite a bit easier to not worry about wiring up different events and methods as much of this can be handled automatically.
    • Familarity - Developers coming from a Windows Forms background will find themselves very familar with Web Forms and can easily jump into development.

    Advantages of MVC

    • Seperation of Concerns - The MVC Paradigm of Model-View-Controller allows you to more easily seperate all of your concerns within your application. This can lead to improved scalability within applications.
    • Testing - MVC is designed and built for Testing-Driven Development and allows for applications to be very easily tested to help secure against error and unexpected behavior
    • Integration with Client-Side Tools - The MVC pattern easily allows client-side tools such as jQuery to be seamlessly integrated. This can allow you to create very rich user interfaces for your applications.
    • Statelessness - Although one of the main advantages of Web Forms, this allows you to adhere to a more stateless format consistant with the rest of the web.
    • Control and Flexibility MVC allows developers to have complete control over their applications as the developer doesn't rely on Controls to automatically generate the appropriate HTML, which after switching to MVC can often be seen as "bloated". The developer will write their own HTML instead of having it generated for them.
    • Search Engine Optimization - The use of RESTful URLs within MVC makes it more friendly for being accessed through search engines.

    I was a pure WebForms Developer when I first began my professional career and I loved how easy it was to quickly throw together applications, however after making the switch to MVC I would cringe at the thought of having to go back. Web Forms can be a great platform to learn and develop on, but if you really want to have complete control regarding what is going on within your application than I don't really think Web Forms can compete with MVC.

    Ultimately though, there is no "best" or "right" answer and it is up to you to decide which of the technologies is right for the task at hand.

    If that is too long...

    Basically, if you are familar with one technology over another and your timespan to complete this project is rather small, then you should really consider using what you are most familar with to develop it in (you wouldn't want your client to have a sub-standard grade product because you were learning a technology). MVC has a significant learning curve which is much higher than that of Web Forms and the way that the applications work in general may be significantly different if you are used to a Web Forms or Windows Forms based architecture.

    Both have their advantages and disadvantages, but if you are unsure - go with what you know and are comfortable with.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 24, 2013 11:45 AM

All replies

  • User1262634031 posted

    Model View Controller

    Thursday, October 24, 2013 11:34 AM
  • User-1315512054 posted

    Hello,

    You could read at http://www.howtoasp.net/asp-net-glossary/mvc-model-view-controller/ and also in MVC tutorials.

    Regards

    Thursday, October 24, 2013 11:34 AM
  • User2103319870 posted

    HI,

    The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating Web applications. The ASP.NET MVC framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication. The MVC framework is defined in the System.Web.Mvc assembly.

    MVC is a standard design pattern that many developers are familiar with. Some types of Web applications will benefit from the MVC framework. Others will continue to use the traditional ASP.NET application pattern that is based on Web Forms and postbacks. Other types of Web applications will combine the two approaches; neither approach excludes the other.

    The MVC framework includes the following components:

    • Models. Model objects are the parts of the application that implement the logic for the application's data domain. Often, model objects retrieve and store model state in a database. For example, a Product object might retrieve information from a database, operate on it, and then write updated information back to a Products table in a SQL Server database.

      In small applications, the model is often a conceptual separation instead of a physical one. For example, if the application only reads a dataset and sends it to the view, the application does not have a physical model layer and associated classes. In that case, the dataset takes on the role of a model object.

    • Views. Views are the components that display the application's user interface (UI). Typically, this UI is created from the model data. An example would be an edit view of a Products table that displays text boxes, drop-down lists, and check boxes based on the current state of a Product object.

    • Controllers. Controllers are the components that handle user interaction, work with the model, and ultimately select a view to render that displays UI. In an MVC application, the view only displays information; the controller handles and responds to user input and interaction. For example, the controller handles query-string values, and passes these values to the model, which in turn might use these values to query the database.

      Soruce URL : MVC OVerview

      If you are looking for tutorials links here the best links for MVC Tutorials

      The best online Tutorial you will find for MVC none other than this site itself

      If you are looking for E-Learning Tutorial on how to get started with MVC. Please check the below links

      Also you can check out this link for various tutorial links

      If you are looking for hands on  tutorial on how to get started with MVC. Below are two of best hands on sample tutorial available for MVC

      NerdDinner

      Music Store

      Below are some Video Tutorial links which will help you to get started in MVC

      For best books in MVC you can check out the below links


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 24, 2013 11:44 AM
  • User281315223 posted

    Model-View-Controller (or MVC) is an tiered / layered architectural principle / design-pattern for designing an application, much like Web Forms or some of the other types of applications that you may have developed in the past. If you are familar with Web Forms, it may seem a bit foreign to work with at first but I would argue that it provides much more flexability and control within your applications and it also more closely mimics the Web (as opposed to Web Forms which are modeled after a more Desktop-oriented design).

    The major benefits using MVC comes with the seperation of concerns throughout your application. As the name implies your projects consist of three components: the model, the views and the controllers.

    • Model - Handles all of the core logic within your application, such as handling the access of data from your database.
    • View - Handles the display and presentation of everything within your application, such as displaying all of the contact information for a specific user.
    • Controller - Handles all of the business logic within your application - such as recieving the data from the Model, performing any necessary operations and passing it onto the View to be presented to the user.

    You can find quite exhaustive explanations of the MVC pattern and its benefits in the following links :

    The ASP.net site actually features several videos on MVC and several tutorials from "Getting Started" to more advanced topics :

    Related Comparison

    I have used the following detailed comparison that shows some of the benefits of MVC and Web Forms previously, so hopefully it can demonstrate some of the advantages and disadvantages of each.


    Each of these technologies have their own advantages and disadvantages and this can highly depend on which of them you are more familar with (familarity with a specific technology will always allow you to develop applications and projects much quicker).  Both are completely capable of accomplishing the same thing, but use different design patterns to get it done.

    That being said, this is a heavily discussed topic that you can find scattered all over the net, but here are a few of the major advantages of  both of them : 

    Advantages of Web Forms

    • ViewState - A ViewState that allows you to persist objects and values throughout your application.
    • Rapid Application Development - Very little learning curve, user-friendly and easy to get an application up and running quickly.
    • Controls and Toolbox - A huge Toolbox with basically any major Control that you would need for developing applications.
    • Maturity - Web Forms have been around over 10 years so there are alot of communities and resources available and many bugs and issues have been addressed.
    • Code Generation - Web Forms makes it quite a bit easier to not worry about wiring up different events and methods as much of this can be handled automatically.
    • Familarity - Developers coming from a Windows Forms background will find themselves very familar with Web Forms and can easily jump into development.

    Advantages of MVC

    • Seperation of Concerns - The MVC Paradigm of Model-View-Controller allows you to more easily seperate all of your concerns within your application. This can lead to improved scalability within applications.
    • Testing - MVC is designed and built for Testing-Driven Development and allows for applications to be very easily tested to help secure against error and unexpected behavior
    • Integration with Client-Side Tools - The MVC pattern easily allows client-side tools such as jQuery to be seamlessly integrated. This can allow you to create very rich user interfaces for your applications.
    • Statelessness - Although one of the main advantages of Web Forms, this allows you to adhere to a more stateless format consistant with the rest of the web.
    • Control and Flexibility MVC allows developers to have complete control over their applications as the developer doesn't rely on Controls to automatically generate the appropriate HTML, which after switching to MVC can often be seen as "bloated". The developer will write their own HTML instead of having it generated for them.
    • Search Engine Optimization - The use of RESTful URLs within MVC makes it more friendly for being accessed through search engines.

    I was a pure WebForms Developer when I first began my professional career and I loved how easy it was to quickly throw together applications, however after making the switch to MVC I would cringe at the thought of having to go back. Web Forms can be a great platform to learn and develop on, but if you really want to have complete control regarding what is going on within your application than I don't really think Web Forms can compete with MVC.

    Ultimately though, there is no "best" or "right" answer and it is up to you to decide which of the technologies is right for the task at hand.

    If that is too long...

    Basically, if you are familar with one technology over another and your timespan to complete this project is rather small, then you should really consider using what you are most familar with to develop it in (you wouldn't want your client to have a sub-standard grade product because you were learning a technology). MVC has a significant learning curve which is much higher than that of Web Forms and the way that the applications work in general may be significantly different if you are used to a Web Forms or Windows Forms based architecture.

    Both have their advantages and disadvantages, but if you are unsure - go with what you know and are comfortable with.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 24, 2013 11:45 AM
  • User-631880478 posted

    Thanks everyone :), I'll read all tutorials that you share with me

    Thursday, October 24, 2013 12:47 PM