MVC - Separation of Concerns

后端 未结 3 877
情歌与酒
情歌与酒 2021-02-04 13:04

I\'m a newbie. I want to ask about the MVC model for separation of concerns. I have read up a few MVC tutorials but I don\'t yet have a full understanding of the roles of each o

3条回答
  •  深忆病人
    2021-02-04 13:41

    At the risk of repeating myself, I'll point you to the answer I gave in this thread. The entire thread is probably worth your time, as are dozens of others on Stack Overflow.

    To break it down simply:

    Controllers - control application flow and makes decisions about data.

    Models - perform business logic.

    Views - produce output.

    For your particular situation, you will want to produce your lists in the View layer. Use templates to create your list structure, and fill them with data fetched from the Model layer.

    I'm not an asp.net programmer, so I can't give you a reliable example, but have a hunt around for other SO threads.

提交回复
热议问题