zoukankan      html  css  js  c++  java
  • 7.2 GRASP原则二:信息专家 Information Expert

    2、GRASP原则二:信息专家 Information Expert
       What is a general principle of assigning responsibility to objects?

        为一个对象 分配职责的一般原则是什么?

       “鸡鸣狗盗” 战国时候,齐国的孟尝君喜欢招纳各种人做门客,号称宾客三千….
    2.2 GRASP rule2: Information Expert

       Name: Information Expert (信息专家)

       Problem:

         What is a general principle of assigning responsibility to objects?

       Solution:

         Assign responsibility to the class that has the information necessary to fulfill responsibility
       Information

         an object's own state,

         about other objects, the world around an object,

         information the object can derive,

         and so forth

       Answer to Mini exercise 2
    2.3 Information Expert — How to?

       步骤

         1)Clearly state the responsibility

         2)Look in Design Model for relevant classes

         3)Else look in Domain Model and create design classes

       信息专家的优点

         封装性 Encapsulation

           对象充分利用自身的信息 objects support their own information

           支持低耦合 supports low coupling

         系统行为分布到不同的类 Behavior is distributed across classes

           支持高内聚 supports high cohesion

  • 相关阅读:
    matplotlib讲义
    车间调度问题(part3: 遗传算法)
    sympy库和matplotlib库简介
    python列表
    第十周周三练习
    第十一周周一练习题
    MyEcplise中关于部署文件不成功的问题
    Java中的get()和set()方法
    Java中this关键字的使用
    信号完整性问题的几个基本原则
  • 原文地址:https://www.cnblogs.com/mayZhou/p/10550012.html
Copyright © 2011-2022 走看看