开发者

MVC for a UI Heavy App

Is MVC architecture appropriate for an app that is a UI centric app?

Example: you want to build a basic flowchart app. Does it make sense to make the GUI components the view, the "node" and "line" objects part of the model, and the click handlers the controllers?开发者_如何学Python

It feels weird to me because there is not much functionality in the model here...


In your case, M is definitely not needed. So you can skip it. Nobody is forcing you to comply with MVC.

If you're using a MVC framework, then don't use features specific to M. Simple. :)


I think it would be pretty useful to use mcv in your project instead!

You have to store somewhere the input data of your charts so a model object would be ideal for that.

The view class would be a template for the boxes and every instance would have is coordinates.

Separating the data from the boxes view would allow you in the future to change aspect and behaviour of the box view without having to touch the data.

In the end you have to consider the mvc pattern not as something that help you build your application in the current state, but a way to have a clean design that you can change and improve without having to rewrite everything. So if you want to build an app that is going to grow go with MVC.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜