Skip to main content
added 58 characters in body
Source Link
k3b
  • 7.6k
  • 1
  • 21
  • 31
 > Which layer does async code belong?

Short answer: into presenter or into an extra service-layer but not in the gui, data or domain layer.

Long answer:

I would put it into a service-layer that sits between presenter- and domain-layer resulting in these layers

gui - presenter - service - domain - data

In the domainlayer (or the servicelayer) you have a synchronios version of the logic that needs to consume the data of the external service. Lets call it mySyncMethod.

In the servicelayer you create a thin async wrapper around mySyncMethod.

Reason: It is very difficuilt to unittest async methods. sync methods are much easier to test.

If there is only one reference to the async functionality you can put into the presenter.

 > Which layer does async code belong?

Short answer: not in the gui, data or domain layer.

Long answer:

I would put it into a service-layer that sits between presenter- and domain-layer resulting in these layers

gui - presenter - service - domain - data

In the domainlayer (or the servicelayer) you have a synchronios version of the logic that needs to consume the data of the external service. Lets call it mySyncMethod.

In the servicelayer you create a thin async wrapper around mySyncMethod.

Reason: It is very difficuilt to unittest async methods. sync methods are much easier to test.

If there is only one reference to the async functionality you can put into the presenter.

 > Which layer does async code belong?

Short answer: into presenter or into an extra service-layer but not in the gui, data or domain layer.

Long answer:

I would put it into a service-layer that sits between presenter- and domain-layer resulting in these layers

gui - presenter - service - domain - data

In the domainlayer (or the servicelayer) you have a synchronios version of the logic that needs to consume the data of the external service. Lets call it mySyncMethod.

In the servicelayer you create a thin async wrapper around mySyncMethod.

Reason: It is very difficuilt to unittest async methods. sync methods are much easier to test.

If there is only one reference to the async functionality you can put into the presenter.

added 49 characters in body
Source Link
k3b
  • 7.6k
  • 1
  • 21
  • 31
 > Which layer does async code belong?

Short answer: not in the gui, data or domain layer.

Long answer:

I would put it into a service-layerservice-layer that sits between presenter- and domain-layer: gui-presenter-service-domain-data resulting in these layers

gui - presenter - service - domain - data

In the domainlayer (or the servicelayer) you have a syschroniossynchronios version of the logic that needs to consume the data of the external service. Lets call it mySyncMethodmySyncMethod.

In the servicelayer you create a thin async wrapper around mySyncMethodmySyncMethod.

Reason: It is very difficuilt to unittest async methods. sync methods are much easier to test.

If there is only one reference to the async functionality you can put into the presenter.

 > Which layer does async code belong?

Short answer: not in the gui, data or domain layer.

Long answer:

I would put it into a service-layer that sits between presenter- and domain-layer: gui-presenter-service-domain-data

In the domainlayer (or the servicelayer) you have a syschronios version of the logic that needs to consume the data of the external service. Lets call it mySyncMethod.

In the servicelayer you create a thin async wrapper around mySyncMethod.

Reason: It is very difficuilt to unittest async methods. sync methods are much easier to test.

If there is only one reference to the async functionality you can put into the presenter.

 > Which layer does async code belong?

Short answer: not in the gui, data or domain layer.

Long answer:

I would put it into a service-layer that sits between presenter- and domain-layer resulting in these layers

gui - presenter - service - domain - data

In the domainlayer (or the servicelayer) you have a synchronios version of the logic that needs to consume the data of the external service. Lets call it mySyncMethod.

In the servicelayer you create a thin async wrapper around mySyncMethod.

Reason: It is very difficuilt to unittest async methods. sync methods are much easier to test.

If there is only one reference to the async functionality you can put into the presenter.

added 7 characters in body
Source Link
k3b
  • 7.6k
  • 1
  • 21
  • 31
 > Which layer does async code belong?

Short answer: not intoin the gui, data or domain layer.

Long answer:

I would put it into a service-layer that sits between presenter- and domain-layer: gui-presenter-service-domain-data

In the domainlayer (or the servicelayer) you have a syschronios version of the logic that needs to consume the data of the external service. Lets call it mySyncMethod.

In the servicelayer you create a thin async wrapper around mySyncMethod.

Reason: It is very difficuilt to unittest async methods. sync methods are much easier to test.

If there is only one reference to the async functionality you can put into the presenter.

 > Which layer does async code belong?

Short answer: not into data or domain layer.

Long answer:

I would put it into a service-layer that sits between presenter- and domain-layer: gui-presenter-service-domain-data

In the domainlayer (or the servicelayer) you have a syschronios version of the logic that needs to consume the data of the external service. Lets call it mySyncMethod.

In the servicelayer you create a thin async wrapper around mySyncMethod.

Reason: It is very difficuilt to unittest async methods. sync methods are much easier to test.

If there is only one reference to the async functionality you can put into the presenter.

 > Which layer does async code belong?

Short answer: not in the gui, data or domain layer.

Long answer:

I would put it into a service-layer that sits between presenter- and domain-layer: gui-presenter-service-domain-data

In the domainlayer (or the servicelayer) you have a syschronios version of the logic that needs to consume the data of the external service. Lets call it mySyncMethod.

In the servicelayer you create a thin async wrapper around mySyncMethod.

Reason: It is very difficuilt to unittest async methods. sync methods are much easier to test.

If there is only one reference to the async functionality you can put into the presenter.

Source Link
k3b
  • 7.6k
  • 1
  • 21
  • 31
Loading