Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • 2
    Yea, I'm aware how to marshall execution between threads. My question is whether or not we should be treating the operations as synchronous methods and letting the UI decide what to put on a background thread (what to execute asynchronously) or do we let the data layer dictate that the operation is asynchronous because we chose to implement the data layer asynchronously. Commented Aug 2, 2013 at 20:04
  • 1
    For me, it is always a matter of user experience over "proper code" so it depends on what makes more sense at the time. If the user should have nothing better to do than wait, then I put everything synchronously on the UI layer. If the user has an alternative to waiting, I prefer to keep the operation asynchronous and simply notify the UI (and sometimes the user) when it needs to change. Sometimes it even just boils down to what is easier to implement in the case that some platforms are built to use one of the other, and getting it to do the opposite is difficult. Commented Aug 5, 2013 at 21:01
  • What if the UI has nothing better to do than wait, but new circumstances ( phone call canceling the order to do something ) allow the user to cancel the async process. Keeping the UI responsive is still important even if don't think there is any other way to proceed, no?. Commented Sep 2, 2013 at 15:37
  • Yes, that is correct. Before you make something synchronous you should always think of every possible circumstance in which the user would not want to just wait. Nine times out of ten I make async calls but there are always a few edge cases in which you want an operation to be unstoppable and force the user to wait before continuing. A good example would be the synchronous loading of fonts and modules when MS Word loads. The application is pointless without those items and therefore the user must wait for them before interacting with the application. Commented Sep 2, 2013 at 15:44