Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences between MVC and View First approach in web development

Today when I searched on the internet I saw the View first approach in web development of Lift framework. Can somebody tell me the differences between view first and MVC approach ? Thank you very much

like image 421
Xitrum Avatar asked Nov 08 '12 13:11

Xitrum


People also ask

What is the main difference between MVC and MVVM?

MVVM separates the different components of the development process into three categories, model, view and ViewModel. This typically involves code markup or graphical user interfaces (GUI). MVC, or model-view-control is a way developers separate programs into these three components.

What is the difference between MVC and MVP?

Although the Flow diagram looks same as MVC the difference is how the VIew and Presenters/Controllers interacts with each other. In MVP the Views and presenters interact via an interface(unlike MVC). Presenters perform some action on the Interface, which is implemented in Views and hence the view gets updated.

Which is better MVVM or MVC?

MVVM is better than MVC/MVP because of its unidirectional data and dependency flow. Dependency is one way, thus it is a lot easier to decouple it when we need to. It is also easier for testing. All my projects(written in Kotlin for Android app) are based on MVVM.

What is difference between ViewModel and controller?

The view renders presentation of the model in a particular format. The controller responds to the user input and performs interactions on the data model objects. The controller receives the input, optionally validates it and then passes the input to the model.


2 Answers

View first is based not on a model and a controller, but mostly interested in the view. Many problem domains do not neatly compose in controllers and models. Think about a ecommerce site, the shopping cart exists on all pages, but should every controller control it? Personally in MVC too much of my time is spent thinking about how to logically make the problem fit into MVC than just coding. View first takes away this controller / view / model and instead just has a view which in Lift can call "snippets". It is almost a superset of MVC since if you wanted you could only have a single snippet per page, but Lift allows you to do much more. Snippets can be cross cutting concerns or very page specfic logic.

From the lift website..

Lift is different [from MVC]. For HTML requests, Lift loads the view first and builds your page from the view. Lift also supports REST style requests for non-HTML data. (See 11 on page 1↑) “Why?” Because complex HTML pages rarely contain a dominant piece of logic... a single controller... but contain many different components. Some of those components interact and some do not. In Lift, you define the collection of components to be rendered in the resulting HTML page in the view.

like image 108
Reuben Doetsch Avatar answered Oct 06 '22 00:10

Reuben Doetsch


When your using lift, you basically have a view(page) and from this you could incorporate any snippet(app) that you have without much of the antics you'd normally have to do in an MVC framework/environment.

Basically you don't have to choose what the most important thing on the page is just what you want to add to a page and then add it.

like image 40
korefn Avatar answered Oct 06 '22 01:10

korefn