Feeling

              三人行,必有我?guī)熝?/p>

             ::  :: 新隨筆 :: 聯(lián)系 ::  :: 管理 ::
            185 隨筆 :: 0 文章 :: 392 評論 :: 0 Trackbacks

          comparator 

          Decorator Pattern and Adapter Pattern have the same alias name: wrapper. But they face different aspects. Decorator pattern changes the object function, but the adapter pattern changes the interface.

          The typical decorator pattern is the java OutputStream, you can use the BufferedOutputStream to wrap it, then get the extra function.
          The typical adapter pattern in the BIRT is the ElementAdapter, it can convert any object to an other object.

          Decorator pattern must extend the class which you want to wrap, but the adapter class must implements the interface using by the client.


          FlyWeight pattern extracts the same part of some different objects, and the part doesn't be changed when these objects changed. String class uses the FlyWeight pattern, jface 
          ImageRegistry also uses it. 
          FlyWeight can have a interface to get external data, and change the external data's status, but FlyWeight internal status shouldn't be changed.

          The Collections.sort() method implementation contains template method design pattern and strategy design pattern, but it doesn't contain the visitor design pattern. The Collections.sort() method uses the merge sort algorithm, you can't change it, but you can change the comparator logic, it's one step of the sort algorithm. So it's a template method pattern, but not a classic implementation, it uses the callback method to implement the pattern, but not extending the parent template class. The comparator class use the strategy design pattern, it not a visitor pattern, visitor pattern have a accept method to operate the element to deal some logic. 




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


          網(wǎng)站導(dǎo)航:
           
          GitHub |  開源中國社區(qū) |  maven倉庫 |  文件格式轉(zhuǎn)換 
          主站蜘蛛池模板: 望奎县| 句容市| 顺义区| 湘潭县| 辽宁省| 阳新县| 宜春市| 蚌埠市| 射洪县| 阳谷县| 昌邑市| 五河县| 襄樊市| 林甸县| 竹溪县| 临朐县| 榕江县| 洛浦县| 三台县| 嵊泗县| 香河县| 南木林县| 浙江省| 桦川县| 安溪县| 长沙县| 沂源县| 西华县| 鞍山市| 合作市| 伊吾县| 徐闻县| 和龙市| 青河县| 神农架林区| 陵水| 宿州市| 九龙县| 石景山区| 虹口区| 周至县|