Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Sencha Touch fit well with a MVVM pattern like that of KnockoutJS?

I am currently building a web-app on top of KnockoutJS - true, programming bliss to use!

I have reached a stage were I need to add a mobile development framework and have been contemplating my choices.

I am currently inclined to go with Sencha Touch because of its maturity and unique plugins which I need.

My only worry is will Sencha Touch's, OO + declarative javascript coding, be a good fit with a MVVM framework such as Knockout?

I mean Knockout leverages off the concept that a View (HTML page) will invoke the model by data-binding. ExtJS (Sencha Touch) does not enrich a View... instead it expects that all the HTML content gets written declaratively.

Am I dealing with oil and water here? What's your thoughts.

Note: I am interested to know if these two different architectures will go well together. Less interested to hear about how Sencha Touch compares to other frameworks out there.

like image 691
Hady Avatar asked Jul 27 '11 13:07

Hady


1 Answers

GluJS provides MVVM for both ExtJS 3.x and 4.x . Sencha Touch binding is in the pipeline. These guys also provide a neat specification (SVVM) approach. This stuff should really be part of the Sencha core code base and the ExtJS 4.x class model would be a perfect fit as 4.x can provide hooks for the two way binding that GluJS uses.

DeftJS: Another nice option that has been well supported is DeftJS; an open source lib that adds MVC with ViewControllers (so not quite full MVVM) to both Sencha ExtJS and Touch. It also adds inversion of control (IoC) and Promises/Deferreds for cleaner asynchronous coding.

Update ...

Sencha ExtJS 5.x now supports full MVVM with View Models and we expect that the next major release ... Sencha Touch 3.x ... will likely do the same. ExtJS 5.x was also updated to include the same core classes and class model as Sencha Touch so this make it even more likely that Touch 3.x will match the same View Model as ExtJS 5.x .

KnockoutJS does what it does very well but it's just one part of what you need. The down side is that you end up having to go and hunt for all the missing pieces and then play "version me if you can" crossing your fingers that all the bits are still supported next year by "someone". In contrast, Sencha APIs provide most of what you need to build and maintain the whole app under one version cycle. Check out the heading "The Modern Web Stack" under this blog post.

like image 144
Tony O'Hagan Avatar answered Sep 23 '22 06:09

Tony O'Hagan