[英]Client Server Data Exchange Persistence - Smells
Suppose I have a client that sends some RunLogicCommand with input to a server.假设我有一个客户端将一些带有输入的 RunLogicCommand 发送到服务器。 The server responds with some output which is a report for the user to verify.
服务器以一些输出作为响应,该输出是供用户验证的报告。 At this point, the server has not persisted anything.
此时,服务器还没有持久化任何东西。 The client then sends back the entire report in a separate SaveCommand which will then persist the report data.
然后客户端在单独的 SaveCommand 中发回整个报告,然后保存报告数据。
To me, certain parts of this exchange seem unnecessary.对我来说,这种交流的某些部分似乎没有必要。 That is, once the user has verified the report, it seems unnecessary for them to send the entire report back to the server for persistence.
也就是说,一旦用户验证了报告,他们似乎就没有必要将整个报告发送回服务器进行持久化。 Perhaps there is a chance some sensitive data could exposed here as well?
也许一些敏感数据也有可能在这里暴露?
What is the typical approach in this case?在这种情况下,典型的方法是什么?
I can see two options:我可以看到两个选项:
Are there any problems with either of these approaches?这些方法中的任何一种都有问题吗? Is there a better, more typical approach?
有没有更好、更典型的方法?
Thanks!谢谢!
There is no single best solution here:这里没有单一的最佳解决方案:
The cons for the approach you mentioned firsts are:您首先提到的方法的缺点是:
The cons for the first of your two options are:您的两个选项中第一个的缺点是:
I would use a variation of your second option:我会使用您的第二个选项的变体:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.