snippets from Object-Oriented Thought Process (1)
2005-09-01 16:32
603 查看
Properly constructed classes are designed in two parts—the interface and the implementation.
Perhaps the most important issue when designing a class is identifying the audience, or users, of the class. for the interface to a class should contain only what the user needs to know.
One goal regarding the implementation should be kept in mind: A change to the implementation should not require a change to the user's code.
When designing a class, the rule of thumb is to always provide the user with as little knowledge of the inner workings of the class as possible. To accomplish this, follow these simple rules:
1.Give the users only what they absolutely need. In effect, this means the class has as few interfaces as possible. When you start designing a class, start with a minimal interface.
2.Public interfaces are all the users will ever see. You should initially hide the entire class from the user.
3.It is vital to design classes from a user's perspective and not from an information systems viewpoint. Too often designers of classes (not to mention any other kind of software) design the class to make it fit into a specific technological model. Even if the designer takes a user's perspective, it is still probably a technician user's perspective, and the class is designed with an eye on getting it to work from a technology standpoint, and not from ease of use for the user.(Important!)
4.Users are the ones who will actually use the software.
Perhaps the most important issue when designing a class is identifying the audience, or users, of the class. for the interface to a class should contain only what the user needs to know.
One goal regarding the implementation should be kept in mind: A change to the implementation should not require a change to the user's code.
When designing a class, the rule of thumb is to always provide the user with as little knowledge of the inner workings of the class as possible. To accomplish this, follow these simple rules:
1.Give the users only what they absolutely need. In effect, this means the class has as few interfaces as possible. When you start designing a class, start with a minimal interface.
2.Public interfaces are all the users will ever see. You should initially hide the entire class from the user.
3.It is vital to design classes from a user's perspective and not from an information systems viewpoint. Too often designers of classes (not to mention any other kind of software) design the class to make it fit into a specific technological model. Even if the designer takes a user's perspective, it is still probably a technician user's perspective, and the class is designed with an eye on getting it to work from a technology standpoint, and not from ease of use for the user.(Important!)
4.Users are the ones who will actually use the software.
相关文章推荐
- 读《面向对象的思考过程》(Object oriented thought process)后的总结
- The Object-Oriented Thought Process
- The Object-Oriented Thought Process
- Object-Oriented Thought Process
- Reading [The Object-Oriented Thought Process] Introduction
- Reading [The Object-Oriented Thought Process] Chapter 1
- Management of the Object-Oriented Development Process
- Management of the Object-oriented Development Process
- Beginning Object-Oriented Programming with VB 2005: From Novice to Professional
- The Object-Oiented Thought Process
- Object-Oriented vs Process-Oriented
- PagerAdapter中的isViewFromObject()方法有什么用?
- 不能运行JSONObject.fromObject
- JOONE(Java Object-Oriented Network Engine)简单实例源代码
- 面向对象的概念(Object -oriented)
- ERROR: ld.so: object '/lib/libSegFault.so' from LD_PRELOAD cannot be preloaded: ignored.
- Object Oriented Analysis and Design Using UML
- JSONObject.fromObject(map)(JSON与JAVA数据的转换)
- 面向对象数据库(Object Oriented Databases)
- JSONObject j=JSONObject.fromObject(map) 这部分后就没反应了,无任何异常抛出