0

I have been asked in an interview: Can we implement MVC architecture without having a model? If yes - how?

1
  • 3
    You do know that most (good) interview questions like this aren't so much looking for the 'right' answer as opposed to knowing you can think about and discuss problems intelligently, right? Commented Jan 5, 2012 at 4:36

4 Answers 4

7

It's a bit of a trick question. If they mean, can you use the Microsoft ASP.NET MVC technology without using a model, then the answer is yes.

If they mean, can you implement the MVC pattern without a model, then the answer is no. The M means Model.

Sign up to request clarification or add additional context in comments.

Comments

1

There are other ways to pass data to the view from the controller, like the ViewData, but if that's all you're using it can arguably no longer be called MVC.

Comments

1

Model View Controller architecture without a model? That would be just View Controller wouldn't it? I guess a static website wouldn't need a model

4 Comments

A static website might not need a controller either.
Isn't it just view? Why would one need controller without model?
If you were still using asp.net-mvc (like the tag) you'd still need the controller and the view
What if that website has both dynamic and static content, both types routed through a front controller? In case of a request for dynamic content (search, news, etc.) a model will be needed. In case of a request for static content (tos, privacy policy), only a view is needed.
1

You can use ASP.NET MVC without a model by using ViewBag and the Views model is dynamic. If you really wanted to, you could just have the C in the MVC by returning a Content() result from the Action :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.