posts - 37,comments - 7,trackbacks - 0
          1. Observable is a class
            First, because Observable is a class, you have to subclass it. That means you can't add on the Observable to an existing class that already extends another superclass. This limits its reuse potential.
          Second, because there isn't an Observable interface, you can't even create your own implementation that plays well with Java's built-in Observer API. Nor do you have the option of swapping out the java.util implementation for another.
          2. Observable protects crucial methods
            If you look at the Observable API, the setChanged() method is protected. So what? Well, this means you can't call setChanged() unless you've subclassed Observable. This means you can't even create an instance of the Observable class and compose it with your own objects, you have to subclass. The design violates a second design principle here...favor composition over inheritance.
           
          posted on 2005-08-11 09:35 Dave 閱讀(141) 評(píng)論(0)  編輯  收藏

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 朝阳区| 新津县| 阿合奇县| 黎平县| 渑池县| 滨海县| 页游| 怀远县| 灵川县| 萨嘎县| 金昌市| 岳西县| 即墨市| 金门县| 信丰县| 乌海市| 深泽县| 潼关县| 宜章县| 卢湾区| 广河县| 临桂县| 清苑县| 冕宁县| 怀宁县| 和静县| 修水县| 泽州县| 怀化市| 斗六市| 平湖市| 马山县| 连山| 北票市| 益阳市| 巫山县| 岳普湖县| 科尔| 邢台县| 辽阳县| 调兵山市|