I have been using Dojo for some aspects of a commercial product to avoid the ugliness of JSF. However, some of the less desirable aspects of Dojo 0.4 have been recently addressed in a huge refactor being called Dojo 0.9. In order to take advantage of the big improvements - cardinal among these being consistent look & feel from the Dijit (Dojo Widget) package - I need to migrate our existing Dojo-dependent code over to Dojo 0.9. Apparently this is a fairly simple undertaking, but I have more ambitious goals than simply porting the code so it works. Dojo 0.9 has formalized and cleaned up the whole dojo.data package and data binding in general.
I would very much like for our Dojo Widgets to take advantage of this. Unfortunately, as of now, the Ajax fetching of data is mixed into these widgets directly. On top of that the Dojo 0.9 Beta refactor does not have the Grid dijit implemented so my heavy use of FilteringTable would require some temporary hacks to get working. It is still in for the Dojo 0.9 release later this month. Given my dislike of hacks I will port what I can around the FilteringTable's and leave them as placeholders for the time being. It looks like widgetsInTemplate is not working either so I will need to manually construct sub-widgets in my templates.
On the upside Dojo 0.9 introduces the dijit.Declaration widget which allows in-page refactoring of common components. It is an in-place widget declaration that can be immediately used within the same page for template-only widgets. Some of the Dojo Widgets I created could probably be done this way, but most of them rely heavily on maintaining instance-like state. It is however, an excellent launching point for refactoring existing repetitive HTML into something like a "function" instead of having to leap directly into making a full-blown widget to achieve the same effect.
So far the refactoring process has been painful, but mainly because of the terribly naive design decisions I made in my first round of Dojo-based development. A healthy dose of data bindings to separate the data management from the presentation should make the widgets easier to understand.