《程序员修炼之道:从小工到专家》笔记-----第二章

来源:互联网 发布:2016版数据的有效性 编辑:程序博客网 时间:2024/05/17 02:28

7.The Evils of Duplication ---------DRY(Don't Repeat Yourself)

    复制出现的四种场合

    (1)Imposed duplication. 由于不同语言,环境的需要

    (2)Inadvertent Duplication

         Sometimes, duplication come about as the result of mistakes in the design.

         Where possible, always use accessor functions to read and write the attributes of objects(Java/C++/...)

    (3)Impatient Duplication        "Short cats make for long delays"

    (4)Interdeveloper Duplication

        不同的开发者会在同一个project中互相复制代码(比如一个功能在不同模块各自实现)

        解决办法:encourage active and frequent communication between developers.


8.Orthogonality

    简单理解: 正交:即X轴向上的变化对Y轴来说是无影响的。eg.接口, 数据库与UI

     Eliminate Effects Between Unrelated Things.

     正交规律的运用:(1)project teams,各司其职   (2)Design, 如模块化设计,分层设计等。Don't rely on the properties of things you can't control

     有几种技巧来维持代码中的“正交性”:

    (1)keep your code decoupled   (2)Avoid global data   (3)Avoid similar functions.


9.Reversibility

    在做决策时需要考虑全面:让设计具有可逆性。如从cs模式到单机的转变,要让其改变可以可配性


10.Tracer Bullets.

      在一个项目的整个过程中,需要有tracer code 的不断发展。它帮助error check, structuring, documentation 等。

      有以下的好处:(1)Users get to see something working early.用户更高兴更早看到不成熟的产品

      (2)Developers build a structure to work in. 对于端到端,有内容可做

      (3)You have an integration platform.更方便测试

      (4)You have something to demonstrate. 有东西可展示给那些project spnsors

      (5)You have a better feel for progress.

      轻量级的开发,对于需求变更方便修改(灵活可变的架构)


11.Prototypes and Post-in Notes.

     建立软件原型的目的:分析并暴露缺陷

    原型 建立过程中我们可忽略正确性,完整性,鲁棒性,样式等

    原型的建立,我们关注的领域主要有:

     (1)主要的部件是否已经合适并很好的定义

     (2)主要部件之间的合作功能是否很好定义

     (3)耦合是否最小化了

     (4)能否发现代码中会存在的潜在复制

     (5)界面定义和限制是否合理

     (6)每个模块在执行时,是否有一个合法的权限路径


12. Domain Languages

      选择合适的语言来表达用户的需求,对于不同层次的users,需实现不同的语言,如Mini-language, Data language,imperative language


13. Estimating

      学会合理地估计各种任务等量级,了解什么可以做得到什么做不了(Estimate to Avoid Surprises) 

0 0
原创粉丝点击