Benefits:
• It preserves encapsulation boundaries.
• It simplifies the originator.
Applicable Scenarios:
• A snapshot containing enough information regarding the state of an object can be saved so that it can be restored to the complete state using the snapshot information later.
• Using a direct interface to obtain the state would impose implementation details that would break the rules of encapsulation for the object.
博客介绍了保存对象状态快照的好处,包括保留封装边界、简化发起者。适用场景为可保存含对象状态足够信息的快照以便后续恢复,且使用直接接口获取状态会破坏对象封装规则。
615

被折叠的 条评论
为什么被折叠?



