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) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 曲松县| 滁州市| 吉木乃县| 如皋市| 石楼县| 托克逊县| 浦县| 都江堰市| 海阳市| 马尔康县| 时尚| 保德县| 上饶市| 云和县| 寿宁县| 修文县| 兴宁市| 黄石市| 达州市| 新邵县| 宜丰县| 舒兰市| 奉贤区| 宁河县| 高阳县| 新巴尔虎右旗| 石河子市| 丰顺县| 泰兴市| 盐源县| 应城市| 大同县| 成都市| 高邮市| 冕宁县| 榆社县| 临颍县| 神木县| 武安市| 丰县| 嘉善县|