免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1293 | 回复: 0
打印 上一主题 下一主题

what class is a good class [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-12-18 00:39 |只看该作者 |倒序浏览
•类的详细描述:类是一个域和方法的命名集合,域持有数据的值,方法操作这些这些值。
•一个类建立了一个域的集合:它定义了一个对象的属性。属性的类型是其它类、原子数据类型(如boolean或int)和接口。
•类设计者应该可以合理化类属性间的关联。
•类名应该既可以反映属性的意义,又能代表类的行为。
•一个类必须支持所有它所定义的行为,包括在超类中定义的和在类所支持的接口中定义的。(不支持超类或接口方法的决定有时也合理。)
•一个类与其超类要有合理的关联。
•每个类方法的名字应当是一个好的方法行为的注释。
• A nuts-and-bolts description of a class is, "A class is a named collection of fields that
hold data values and methods that operate on those values" (Flanagan 1999b, p. 61).
• A class establishes a collection of fields: that is, it defines the attributes of an object.
The attribute types are other classes, primitive data types, such as boolean and int,
or interfaces.
• A class designer should be able to justify how a class's attributes are related.
• The name of a class should reflect the meaning of the class both as a collection of
attributes and with respect to the class's behavior.
• A class must support all the behaviors it defines, as well as all those in superclasses,
and all methods in interfaces that the class implements. (A decision to not support a
superclass or an interface method is occasionally justifiable.)
• A class should have a justifiable relationship to its superclass.
• The name of each of a class's methods should be a good commentary on what the
method does.

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/68079/showart_1726711.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP