知识卡片

普通读书笔记卡 · 1971.o.1.b.1.a.2.c.1.b.2.f.2.a

现成发布协议优于私有抽象

理解等级:高级

原书的实际项目中,作者为一个用 Smalltalk 与 DB2 的产品做 Btrieve 接口,沿用客户自建的对象持久化抽象;集成成功,却因抽象缺少正式规范和文档而难以理解、复用,也进一步固化了客户私有模型。

作者提出的事后设想是只模拟产品真正用到的 DB2 接口子集。DB2 的接口虽复杂,却已有规范和文档;这可能更易说明兼容范围。标题中的“优于”指作者对本案例的事后判断;后者未实际实施或与私有方案做结果比较。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 原书第14章|Published Language · 查看原书依据

      This approach did work. The software smoothly integrated with my client's system. However, the lack of a formal specification or documentation of the abstractions of persistent objects in the client's design meant a lot of work for me to figure out the requirements of the new component. Also, there wasn't much opportunity to reuse the component to migrate some other application from DB2 to Btrieve. And the new software more deeply entrenched the company's model of persistence, so that refactoring that model of persistent objects would have been even more difficult. A better way might have been to identify the subset of the DB2 interface that the company was using and then support that. The interface of DB2 is made up of SQL and a number of proprietary protocols. Although it is very complex, the interface is tightly specified and thoroughly documented. The complexity would have been mitigated because only a small subset of the interface was being used. If a component had been developed that emulated the necessary subset of the DB2 interface, it could have been very effectively documented for developers simply by identifying the subset.

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第112章《Published Language》(源文件:_epub-src/0321125215_ch14lev1sec11.html;单元02) - 结论依据:原文区分实际沿用私有抽象的成功与代价,以及事后考虑的 DB2 接口子集替代方案。 - 原始内容:This approach did work. The software smoothly integrated with my client's system. However, the lack of a formal specification or documentation of the abstractions of persistent objects in the client's design meant a lot of work for me to figure out the requirements of the new component. Also, there wasn't much opportunity to reuse the component to migrate some other application from DB2 to Btrieve. And the new software more deeply entrenched the company's model of persistence, so that refactoring that model of persistent objects would have been even more difficult. A better way might have been to identify the subset of the DB2 interface that the company was using and then support that. The interface of DB2 is made up of SQL and a number of proprietary protocols. Although it is very complex, the interface is tightly specified and thoroughly documented. The complexity would have been mitigated because only a small subset of the interface was being used. If a component had been developed that emulated the necessary subset of the DB2 interface, it could have been very effectively documented for developers simply by identifying the subset.