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

  • 相关阅读:
    002-pythn基础-循环、编码
    001-python3 初识
    confluence6.x安装
    python+ffmpeg切割视频
    Elasticsearch6.x和Kibana6.x的安装
    django基础
    CDH的完全离线安装(ubuntu16)
    python之旅十【第十篇】paramiko模块
    解决 MariaDB无密码就可以登录的问题
    切割日志(mysql,nginx,php tomcat)使用logrotate
  • 原文地址:https://www.cnblogs.com/mayZhou/p/10550012.html
Copyright © 2011-2022 走看看