You must Sign In to post a response.
  • Category: ASP.Net MVC

    How model view and controller are linked

    The following is the interview question

    how model view and controller are linked?

    next question:

    why it is called MVC and not VCM or CMV

    Please help
  • #767735
    Model View Controller is commonly used pattern. Here Model represents all the entities. Controllers are nothing but methods which are responsible for performing any action and View represents html files.

    As soon as we hit a url in browser, our global.asax tries to find which controller needs to be called. Then, secondly it's upto my controller that which needs to be called and finally view is called. So, we can say Global.asax is connecting URL with controller, Controller is connecting us with Model and View both.

    It is called MVC beacuse of order of importance. Because Model holds the data so it is very critical and took first position followed by how user interacts it i.e. View and lastly how system handles the input which is nothing but our controller

  • #767739
    Hai Rajan,
    Please find below inline answers for your questions related to MVC:
    Q. How model view and controller are linked?
    A. In MVC, Controller is the one from where the processing starts. So the user will call the controller and the controller contains methods and the method calls the Model to get the data. Once he data is retrieved, view gets populated. This is how MVC model works. The Model and View are not directly attached rather than they are partially connected because whatever the model is , the view is the same replica. So if the model contains the Property EmpId, the View will have the field for EmpId.
    The controller may or may not connected to model, if there is the data needs from the database, controller will call the model and model will get the data from database, else the controller will never calls the Model.
    Q. Why it is called MVC and not VCM or CMV?
    A. I think in MVC, as the model and view are the replica to each other so they are always with each other. These patterns also called as MV* patterns(MVC, MVP, MVVM etc). All these patterns have the Model and View together and rest of the things depends which pattern it is.
    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com

  • #767793
    Hi,

    MVC is one architectural pattern, for fetching data from database using MVC architecture controller will play keyrole and for the supporting methods model will play keyrole to display it in end user for viewing View will play keyrole, this is totally one particular cycle, if you want to know more about MVC Architectural pattern then you have to learn basics first.

    Coming to your second question, I don't think that their is a special reason behind this apart from the above architectural pattern. Why we are called ".NET"? rather than ".ENT", ".TNE"? their is no meaning in that, while launching any product the parent company given one naming convention for that product based on the product, so based on MVC structure they will set this naming convention called as "MVC".

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/


Sign In to post your comments