-1

In Visual Studio, ASP.NET MVC project template is designed for MVC pattern, but what about ASP.NET Web API project template?
I know that we can create API from MVC project, also we can build MVC app from Web API project.

But what if I use Web API project and return only data, not Views? What is the design pattern behind it? It does not consider to be a MVC anymore, becouse it doesn't have View. Is it just a N-Tier architecture?

3
  • Hopefully, you haven't fully drunk the design patterns Kool-Aid yet. All of the interesting software development is novel, by definition. Commented Jan 15, 2021 at 17:49
  • @RobertHarvey Sorry, I don't know what do you mean. Is it a kind of sarcasm?
    – veryfreaky
    Commented Jan 15, 2021 at 18:19
  • New developers have a tendency to ascribe design patterns to everything. The point of design patterns is to recognize well-known problems that are already solved, not to solve new problems. In other words, not everything is a design pattern. Commented Jan 15, 2021 at 18:37

1 Answer 1

0

It is still MVC because your client app still needs to consume the data in some kind of format.

A view can be considered a particular rendering of the data: CSV, JSON, HTML, etc, not necessarily just a human readable view.

2
  • Should it be consider as MVC, even if model does not updates the view? I found this diagram media.geeksforgeeks.org/wp-content/uploads/… and many other diagrams describing MVC look the same. But if client app is a web app or mobile app and it send request to API, which return some result, isn't it a client-server architecture instead of MVC? Or maybe I did not understand you correctly, but if the controller returns a JSON, CSV or any DTO, is it a View? Client-Server with MVC on server side, where the View is JSON?
    – veryfreaky
    Commented Jan 15, 2021 at 17:49
  • It is a client server architecture, bit that doesn't negate the MVC architecture on the server. With client server, you are looking at two independent systems. For example, you could have multiple clients connecting to the same server, each with its own architecture.
    – 0b1
    Commented Jan 15, 2021 at 18:33

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