1

I haven't been able to find a definitive answer online, so I'm hoping that someone with experience can help answer this.

Many MVC tutorials I find online end up using the MVC architectural pattern as the architecture for the entire application. But, I have read conflicting statements from those on this site and other sites who say that MVC is just an architecture for the presentation layer of a layered architecture.

At this point I'm leaning towards the idea that it is perfectly valid as a pattern for an entire application, especially because it seems like overkill to have to design 3 separate layers for a small to medium sized application.

Which is it? Is MVC a perfectly good architectural pattern for an entire application, or is it just meant to be used as the presentation layer of a layered architecture?

1

Is MVC a perfectly good architectural pattern for an entire application, or is it just meant to be used as the presentation layer of a layered architecture?

MVC is only concerned with the user-interaction part of an application and it is a perfectly good architectural pattern for an entire application.

The MVC pattern contains 3 parts: The Controller, which is responsible for receiving user actions, the View, which is responsible for showing information to users, and the Model, which contains all the rest of the application.

If your application is not too large (which is typically the case with example programs that showcase the MVC pattern), there is no need to structure the Model further.

For a larger application, the Model part of the MVC pattern can become so large that further structure is needed to fully understand how it works. That is when you should start to apply additional architectural patterns like a layered architecture.

1
  • thanks for you answer! It's exactly what I was looking for. The fact that a layered architecture simply augments the Model into a more organized piece makes a lot of sense Jan 17 at 2:49
2

The MVC patterns contains three things:

  • C - Controller - Which accepts the HTTP request

  • M - Model - Which the controller uses to pass data to the view

  • V - View - HTML that is rendered for the end user

There's nothing in there for business logic, data access, authentication, or many other things.

So the answer is NO it is not a complete pattern, unless you don't need data access, business logic, authentication, or anything else.

It seems like overkill to have to design 3 separate layers for a small to medium sized application

See Why do we need so many classes in design patterns?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.