MVC based system modeling and architecture

ROG 21 Reputation points
2022-05-09T15:21:30.46+00:00

hey,
I'm working on a modeling project for my software engineering class.
the system I'm trying to design is an e-commerce app that is based on MVC pattern.

now, does the fact I'm using MVC mean that every request goes from View to Controller to Model and back
like in the sequence diagram below(bear in mind the 'Administrator' class belongs to the Controller and the the 'Product' is a model class), or should I skip the 'UI' column?

200305-updating-product-details.png

also, this is my class diagram bellow, I tried to separate it to Model (in yellow), View, Controller (in blue)
I'm just not sure how everything should be connected, is the idea of an API class for the Controller correct? or should those functions be embedded in the relevant classes?

200383-class-diagramdrawio.png

really any comments, suggestion etc. are welcome!
thanks

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,396 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 60,361 Reputation points
    2022-05-09T16:34:25.79+00:00

    in the original MVC pattern from smalltalk, when the action modified the model via a message, and the model directly sent messages to the view. the messages were typically small datagrams.

    the MVC model with web pages is slightly different. an MVC action is invoked by a browser get/post or Ajax request. the request data to bound to action model. the action processes the action model, and then creates the view model. the view model is passed to the view engine to build the response, which returns the response data (often html) to the browser.

    often the same model class is used for the action model and the view model. but do not confuse the action/view models with the database/business models. most tutorials will use the same model for simplicity of the example, and implement simple CRUD operations.

    0 comments No comments

  2. Yijing Sun-MSFT 7,071 Reputation points
    2022-05-10T06:18:34.49+00:00

    Hi @ROG ,
    Let's learn the MVC Architecture. MVC stands for Model, View, and Controller. MVC separates an application into three components - Model, View, and Controller.
    Model objects store data retrieved from the database. View in MVC is a user interface. View display model data to the user and also enables them to modify them. The controller handles the user request. Typically, the user uses the view and raises an HTTP request, which will be handled by the controller. The controller processes the request and returns the appropriate view as a response. So, if you want to do some action functions , you could write into the controller.

    Best regards,
    Yijing Sun


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.


  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more