MVC or Rest or Both

22,567

Solution 1

MVC is about how the inner side of your app works.

REST is about how your app "talks" with other apps.

You can combine them.

A lot of modern frameworks actually are MVC based and make implementing REST web services easy: Ruby on Rails, Java Spring Framework with SpringMVC , Django, Backbone.js

Solution 2

One of the best Java frameworks I've seen for building MVC webapps with the ability to support REST is SpringMVC. This blog post outlines the REST capabilities in SpringMVC since version 3.0. I've developed REST services using SpringMVC and Jersey, and they are fairly comparable.

Solution 3

They are patterns / solutions to solve different problems.

REST sanitises & simplifies addressing access to features of a web application, for users, client software, etc.

MVC provides a means to organise your application code, making it easier to maintain.

Share:
22,567
thecountofzero
Author by

thecountofzero

Updated on September 29, 2020

Comments

  • thecountofzero
    thecountofzero over 3 years

    I in the process of designing the server side of a web-based user interface that will be very JavaScript intensive.

    I originally thought of going with an MVC solution, but now I am thinking I want to use a REST-based solution such as Jersey or Restlets.

    Is this often an one or the other type decision or can they be a combined solution?

    Thanks, Mike

  • hisdrewness
    hisdrewness over 13 years
    MVC is a design pattern for creating a separation of concerns and avoiding tightly coupled data, business, and presentation logic. REST is about interacting with stateless resources. Spring is not itself an MVC framework. The Java cousin of RoR is Grails using Groovy.
  • Equivalents
    Equivalents over 13 years
    As you point in your later answer "One of the best Java frameworks I've seen for building MVC webapps with the ability to support REST is SpringMVC"
  • thecountofzero
    thecountofzero over 13 years
    As I read the responses so far I realize that I probably should have been at bit more specific. I do understand the difference between MVC and REST. I think my question is related to the framework I am using. I am using FrontMan. It's lightweight Java MVC framework that uses a front controller. All request are dispatched from the front controller to the appropriate class to handle the request. myserver.com/myapp/doSomething myapp/* is mapped to go to the front controller I am wondering how a REST request would be processed. I don't think they should go through the front controller
  • Equivalents
    Equivalents over 13 years
    Yes they should. A REST request in a plain HTTP request to a resource like myserver.com/myapp/resource.
  • bh5k
    bh5k about 11 years
    Here is a video that walks you through building one from scratch and is more up to date that the blog post since Spring is on 3.2 now: pluralsight.com/training/Courses/TableOfContents/…