Object-Oriented Design Heuristics 笔记(1)

王朝other·作者佚名  2006-01-10
窄屏简体版  字體: |||超大  

我是从csdn的一个Blog里知道这本书的,下来一看,很奇怪的书名,很通俗的文风。今天读了Chapter1-2,觉得Arthur J. Riel他老人家说得很有道理,除此之外没有再多的感想了--可能是我缺乏OOD经验吧--只好把Chapter2的Summary摘录出来,聊以为笔记。

Summary of Heuristics

Heuristic 2.1 All data should be

hidden within its class.

Heuristic 2.2 Users of a class

must be dependent on its public interface, but a class should not be dependent

on its users.

Heuristic 2.3 Minimize the

number of messages in the protocol of a class.

Heuristic 2.4 Implement a

minimal public interface that all classes understand [e.g., operations such as

copy (deep versus shallow), equality testing, pretty printing, parsing from an

ASCII description, etc.].

Heuristic 2.5 Do not put

implementation details such as common-code private functions into the public

interface of a class.

Heuristic 2.6 Do not clutter the

public interface of a class with things that users of that class are not able to

use or are not interested in using.

Heuristic 2.7 Classes should

only exhibit nil or export coupling with other classes, that is, a class should

only use operations in the public interface of another class or have nothing to

do with that class.

Heuristic 2.8 A class should

capture one and only one key abstraction.

Heuristic 2.9 Keep related data

and behavior in one place.

Heuristic 2.10 Spin off

nonrelated information into another class (i.e., noncommunicating behavior).

Heuristic 2.11 Be sure the

abstractions that you model are classes and not simply the roles objects

play.

既然没有什么好说的,就不要说了,还不如静下心来搞些设计,在实践中体会OOD的精髓...... Practice make perfect!

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航