1

I'm slowly getting into MVC, but it's still relatively new to me. From what I've discovered by doing a few tutorials, MVC provides an interface for communication between the database and the website and in general allows for better organization of the code.

Are there other significant advantages to using an MVC structure? What would be an example of a time when you wouldn't want to user MVC, even if you are communicating with a database?

Thank you!

DaveRandom
  • 87,921
  • 11
  • 154
  • 174
Alec Sanger
  • 4,442
  • 1
  • 33
  • 53
  • 1
    The database issue is irrelevant. This is a duplicate question. See: http://stackoverflow.com/questions/46031/why-does-the-asp-net-web-forms-model-suck or even better: http://stackoverflow.com/questions/712220/whats-your-choice-for-your-next-asp-net-project-webforms-or-mvc – Brett Jul 30 '10 at 13:10
  • Here's another: http://stackoverflow.com/questions/30067/ – Brett Jul 30 '10 at 13:26
  • Thanks, I looked at relevant threads but didn't see anything that was the same as what I was asking. Guess I should have looked harder :) – Alec Sanger Jul 30 '10 at 13:30
  • When you type your question title, related questions appear directly below it. The first related question was the duplicate. You don't need to look harder, just look. ;) – John Farrell Jul 30 '10 at 15:02

3 Answers3

5

Technically speaking, MVC has nothing to do with whether or not an application uses a database. MVC is about separating concerns so that the things that represent business concerns and logic [the models] are separated from how the UI is displayed [the views]. It doesn't matter whether or not your models are stored in a database, on the filesystem, in memory, or not even persisted at all.

As for when would you NOT want to use MVC, that's harder to say. MVC is about separating concerns to simplify the construction and management of a software system. If you don't need those benefits, or if you get greater benefits through a different pattern (for instance, if you have a team that's highly skilled in a non-MVC based framework), then don't use it. It's certainly possible to build good software without using the MVC pattern, the pattern just helps.

Seth Petry-Johnson
  • 11,845
  • 7
  • 49
  • 69
  • Exactly what I was looking for. Thanks for breaking it down for me. Each of the tutorials I've done involved connecting to a database - I guess that's why I assumed it was required. – Alec Sanger Jul 30 '10 at 13:32
2

The pro/con list in this blog may help you understand when MVC makes the most sense to use.

http://www.ytechie.com/2008/10/aspnet-mvc-pros-and-cons.html

James Black
  • 41,583
  • 10
  • 86
  • 166
1

You can take a look at this video: Choosing the right programming model.

Since you indicated you're a beginner with MVC I suggest you take a look at these informative tutorials.

Kris van der Mast
  • 16,343
  • 8
  • 39
  • 61