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 閱讀(140) 評(píng)論(0)  編輯  收藏

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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 弥渡县| 榆林市| 江华| 微山县| 资兴市| 阿勒泰市| 阜康市| 云安县| 奎屯市| 涿州市| 龙门县| 阳东县| 炉霍县| 翁源县| 扎囊县| 宾阳县| 云龙县| 方城县| 潮安县| 集安市| 昌黎县| 习水县| 鹤山市| 东海县| 通州区| 雷波县| 杭锦旗| 札达县| 泌阳县| 留坝县| 永吉县| 新兴县| 顺平县| 建德市| 隆回县| 平泉县| 张北县| 兖州市| 湘阴县| 绵竹市| 亚东县|