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

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


          網站導航:
           
          主站蜘蛛池模板: 利辛县| 梁平县| 永安市| 潢川县| 灵山县| 井冈山市| 板桥市| 邵东县| 手游| 菏泽市| 陇南市| 曲周县| 澄江县| 航空| 新干县| 乐山市| 德阳市| 若尔盖县| 河东区| 文化| 禄丰县| 宜昌市| 曲松县| 乌鲁木齐市| 衡水市| 察隅县| 临武县| 鸡西市| 达尔| 金乡县| 东海县| 永靖县| 郧西县| 马公市| 兴国县| 洛扎县| 屏东市| 承德县| 宿迁市| 许昌市| 扎囊县|