Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Model view controller, what does each word represent [closed]

I have searched for that answer but it was look like everyone got a different understanding of that:(in comparison to 3 Layer/3 tier)

"

Model - business logic

View - presentation logic

Controller - changing state of model and view (based on use input)

"

Other wrote:

" views = frontend ( presentation logic )

models = backend ( Data Access Layer? )

controllers = glue between frontend and backend ( middle tier? business logic ) "

If i understand right then:

model- Is the business logic layer?

view- Is the presentation tier\layer?

controllers- ?

like image 908
E.Meir Avatar asked Dec 04 '25 14:12

E.Meir


1 Answers

View = Output and Output Logic only

Model = Data anything data related should be coming from a Model

Controller = The thing that connects the View and the Model and can do application logic

Business Logic = Further business logic, normally packaged into classes.

User says give me acme.com/home Controller says, do I know what do do with /home oh yes I have a homeController homeController says hey I'll go get some stuff from the model or call some business logic from the classes then put it somewhere that the view can access it (viewbag) this bit is sometimes called applicationLogic homeController then says ok I've done all that now I'll most likely give you a view View says hello there, and can output anything from the viewbag the controller just prepared for us

Remember the Controller controls everything, the view talks to nothing, here is a simple correct diagram, many diagrams are different and you could say its open to interpretation, but diagrams where the view talk to the model are just not MVC imo.

MVC A simple MVC Diagram

like image 153
Dale Fraser Avatar answered Dec 07 '25 14:12

Dale Fraser



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!