Say we want to make an application containing the following:
- Asynchronous and time consuming
operations - Information of these operations
progressandstatus. (e.g. 90% done, reconnecting, etc.) - The ability to
showthis information inmultiple views, and updateUI elementsaccordingly. (Progress bars, disable buttons for already triggered operations) - The ability to
cancelandpausethese operations frommultiple views.
Then my question is the following:
Where does these operations and their progress/status belong in an Application Design Pattern?
Decoupling the Service Layer or Network Controller from the View and Model in a design pattern like MVC or MVVM is quite straight forward, as long as you don't provide more UX feedback than a spinner when there's an active network request.
But when I am working on an application confirming to the criteria above, I always end up either
- Not allowing the
userto changeviewduring anoperation Taggingoperations with theidof the object currently processed and passing this to theviews, or looking in theNetwork Controllerdirectly from theviews/view controllers- Creating a separate
entitiesforoperations, and suddenly I have arequest operationin mymodel
So obviously there are (very smelly) ways to come around this, but they all feel dirty and not inline with how the patterns are intended.
So purely from a software architecture and design pattern point of view, how would you approaching this?
Aucun commentaire:
Enregistrer un commentaire