摘要: 1,接口定义就是功能抽象(找共同点)的过程,明确接口的适用范围,功能定义和使用约束。 举个例子:flash_read(int chip, int addr, int len, char *data) chip是flash芯片的编号,多芯片要求统一编码(不可重复),无论flash类型。 addr和le 阅读全文
posted @ 2017-04-02 14:17 soul.stone 阅读(591) 评论(0) 推荐(0) 编辑
摘要: 《敏捷软件开发:原则、模式与实践.pdf》定义了面向对象设计的5个基本原则: 单一职责原则(Single-Resposibility Principle) 其核心思想为:一个类,最好只做一件事,只有一个引起它的变化。单一职责原则可以看做是低耦合、高内聚在面向对象原则上的引申,将职责定义为引起变化的原 阅读全文
posted @ 2017-04-02 14:10 soul.stone 阅读(1208) 评论(0) 推荐(1) 编辑
摘要: step1:通过依赖倒置实现单向依赖 A依赖于B,胜过A/B互相依赖。 step2: 层次化 & 胶水层 A1,A2依赖于B,A1依赖于A2。重构为A1/A2依赖于B,A1/A2互不依赖,即分层。 A/B/C互相依赖,增加胶水层D,A/B/C依赖于D,D作为代理模块,A/B/C互不依赖。 step3 阅读全文
posted @ 2017-04-02 13:59 soul.stone 阅读(2033) 评论(0) 推荐(0) 编辑
摘要: http://www.open-open.com/doc/view/ceee1d75382f4bbc93c8a8a2a98b4e52 Characteristics of a Good API • Easy to learn • Easy to use, even without documenta 阅读全文
posted @ 2017-04-02 13:53 soul.stone 阅读(400) 评论(0) 推荐(0) 编辑
摘要: https://en.wikipedia.org/wiki/Coupling_(computer_programming) In software engineering, coupling is the degree of interdependence between software modu 阅读全文
posted @ 2017-04-02 13:28 soul.stone 阅读(506) 评论(0) 推荐(0) 编辑