Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Have you tried using MVC for GWT client code?

Have you tried using MVC or any other UI pattern for GWT client code. What are the pitfalls/advantages you've faced in different approaches?

like image 338
Sathish Avatar asked Jan 05 '09 21:01

Sathish


People also ask

What is MVC client?

Client side MVC means that a MVC framework is built entirely on the client side. So the server only delivers data to the application. The binding of the data to the models happens client side. An example of a framework that implements this principle is AngularJs Another one is Ember.

What is MVC used for?

MVC (Model-View-Controller) is a pattern in software design commonly used to implement user interfaces, data, and controlling logic. It emphasizes a separation between the software's business logic and display.

Is GWT a MVC?

GWT Model-View-Presenter is a design pattern for large scale application development. Being derived from MVC, it divides between view and logic and helps to create well-structured, easily testable code.

What is MVC and how it works?

-MVC is an architectural pattern consisting of three parts: Model, View, Controller. Model: Handles data logic. View: It displays the information from the model to the user. Controller: It controls the data flow into a model object and updates the view whenever data changes. -It is invented by Trygve Reenskau.


1 Answers

I think you need to treat GWT just like any other UI framework, like Swing, Cocoa, etc. Everything that makes sense in those frameworks in terms of MVC (or other paradigms) makes sense in GWT as well. I think sometimes people take the MVC thing too far, and I like the way it works in Cocoa more than most frameworks. You create a view, you have a ViewController that controls all the behaviour of the view, and then you have model objects with all your data. I don't think you need to be dogmatic about where all of your business logic is, it just needs to be where it makes sense.

In terms of pitfalls,the main one you will run into is that GWT is purely a front end technology, so technically the back end is sitting on a server somewhere. I don't see this as being that different to writing a client server swing application, that stores it's data in the cloud somewhere. The difference is that GWT is compiled down into javascript, and has all the limitations of a javascript web application, so there will be some things that you simply cannot do on the front end. Let's say for example you want to create a PDF and show that to the user, you can't do that in GWT, you need to call the back end to do it for you. In a Swing app on the other hand you could probably use itext and do it on the client side.

like image 200
rustyshelf Avatar answered Oct 24 '22 03:10

rustyshelf