开发者

Will a client side MVC framework suit building UI controls

Lately i have been thinking of developing UI controls suite similar to Extjs or YUI but using a MVC framework like Backbone or Spine. Am i wrong in taking this decision? Will a mvc framework suit the purpose开发者_如何学Go of such development? What would the significance, cost of maintaining such a project would be.


Technically, I don't see why you can't do this. You would forgo the "router" portion of Backbone and stick with Models, Collections and Views. You would probably also forgo all of the backend syncing capabilities of the Collections and Models in favor of your own interface with the client application. You would also have to come up with a way to apply the Backbone render pattern generically to allow the client app to host your widgets. You would get some separation of concerns still and your widget kit would work.

But, I don't know if I would recommend it. By building a widget kit around Backbone, you are requiring that your users be bound to Backbone, Underscore and probably jQuery as well. You'd be doing this but throwing out many of the features that Backbone has to offer (like routing and syncing). If the client application is also using Backbone, you might also get into version incompatibility issues, so you'd have to deal with that by using noConflict.

In all, it would feel to me like you are shoehorning a whole suite of tools into your widget kit for minimal gain. Your widget kit would be fat and bloated right off the bat. Instead, I would try to make my widget kit more lightweight. Use the patterns you've learned in Backbone but don't use backbone itself. Even consider ripping some of the Backbone code out to base your infrastructure off of, but modify it to eliminate the features that you won't be using and make it your own.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜