现在的位置: 首页 > 综合 > 正文

关于设计问题的总结-from 《code complete 2》

2013年06月17日 ⁄ 综合 ⁄ 共 939字 ⁄ 字号 评论关闭

1. 最小的复杂度 Minimal comlexity
2. 易于维护 Ease of maintenance
3. 松散耦合 loose coupling
4. 可扩展性 extensibility
5. 可重用性 reusability
6. 高扇入 high fan-in
7. 低扇出 low fan-out
8. 精简性 leanness
9. 层次性 stratification
10. 标准技术 standard techniques

1. 一个开发人员需要理解系统多少个不同的部分,才能在图形子系统中改动某些东西
2. 当你想在系统中加入一套新的用户界面时, 会发生什么
3. 当你想把数据存储到一台远程计算机上,会发生什么

形成一致的抽象 form consistent abstractions
封装实现细节 encapsulate implementation details
当继承能简化设计时就继承 inherit when inheritance simplifies the design
隐藏秘密 Hide secrets information hiding
秘密和隐私权 secrets and right to privacy
  类的接口的奋斗目标是完备且最小的

启发式:
高内聚性 Aim for strong cohesion
构造分层结构 build hierachies
严格描述类契约 formalize class contracts
分配职责 assign responsibilities
为测试而设计 Design for test
避免失误 avoid failure
有意识的选择绑定时间 choose binding time consciousl
创建中央控制点 make central points of control
考虑使用蛮力突破 consider using brute force
画一个图 draw a diagram
保持设计的模块化 keep your design modular

分而治之 divide and conquer
自上而下 自下而上的设计 top-down buttom-up design approaches
建立实验性原型 experimental prototyping
记录你的设计成果
  把设计文档插入到代码里
  用wiki来记录讨论和决策
  写总结邮件
  相机
  保留设计挂图
  crc卡片
  在适当的细节层创建uml图

抱歉!评论已关闭.