I have a long polled web service. Recent responses are cached. The web service notifies subscribers of new data.
Is it good to return a deep copy of the response, or should share data with all subscribers? Or does it just depend on the use case?
At first glance, I think this is similar to the case when you need to look for wider use.
. , ? , , .
, , . , , , - - /, .
, , , , , - .
, , service.SaveSomeInformation(responseInformation).
service.SaveSomeInformation(responseInformation)
TL; DR , () .
.
http://martinfowler.com/eaaCatalog/serviceLayer.html
, .
.... - , .
, -, .
, , , , , , , , , .
, / , weither , .
, ,
scope.response = bigDataObject;
- :
scope.data = angular.copy( bigDataObject.some.deeper.property ); scope.data.name = 'somethingElse';
, tou , . , , , .