<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    kukooBlog

    look to the master, follow the master, walk with the master, see through the master, become the master.

      BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
      213 隨筆 :: 0 文章 :: 285 評(píng)論 :: 0 Trackbacks
    我在5月25號(hào)的的blog: 如何思考Design Pattern?中,轉(zhuǎn)載了Eric Gamma對(duì)于Design Pattern 的論述(這是Artima Developer的總編 Bill Venners對(duì)Erich Gamma的采訪中的第一部分)。而第二部分中,Bill 和 Eric 則討論了重用性的重要性 (importance of reusability)。

          重用的最高境界是什么?我們創(chuàng)建一個(gè)非常高層的,面向具體應(yīng)用的框架,然后只要做簡(jiǎn)單的客戶化,并且重用這個(gè)框架中現(xiàn)有的設(shè)計(jì)。(“We thought the way to create software was to build high-level, domain-specific frameworks, and then you just customize them and reuse all the design that is codified into them. That was the reuse nirvana.”)但是,連Eric都意識(shí)到,這太理想化了,因?yàn)?“ I have learned that it's hard to create highly reusable frameworks.”

          在談到可重用的framework的時(shí)候,Eric提到了Eclipse:

        “A good example of how I like to see reuse at work is Eclipse. It's built of components we call plug-ins. A plug-in bundles your code and there is a separate manifest where you define which other plug-ins you extend and which points of extension your plug-in offers. Plug-ins provide reusable code following explicit conventions to separate API from internal code. The Eclipse component model is simple and consistent too. It has this kernel characteristic. Eclipse has a small kernel, and everything is done the same way via extension points. The combination of a component model and the focus on APIs is one of the key ingredients of Eclipse. Controlled extensibility is another important one. (Eclipse是構(gòu)構(gòu)建在我們稱之為plug-in的組件上面的。一個(gè)plug-in含有你的代碼,而且詳細(xì)定義了你從哪些其他的plug-in擴(kuò)展而來,以及你的plug-in提供了哪些擴(kuò)展點(diǎn)給別人使用。Plug-in提供了可重用的代碼,而且遵循將API和內(nèi)部的代碼分離開。同時(shí),Eclipse的組件模式簡(jiǎn)單而且一致。Eclipse只有一個(gè)很小的核心,所有其他的都市通過擴(kuò)展點(diǎn)這種同樣的方式來做的。Eclipse中的一個(gè)重要組成部分就是組件模型和面向API的方式的結(jié)合。另一個(gè)重要點(diǎn)則是受到控制的擴(kuò)展性。)”


          那么,什么又是Controlled extensibility呢?為什么要對(duì)擴(kuò)展性進(jìn)行控制呢?

        “You can go and expose everything, and people can change anything. The original Smalltalks had some of this flavor. The problems start when the next version comes along. If you have exposed everything, you cannot change anything or you break all your clients. … Also when you study the Eclipse API you will find that we go further than just specifying which classes are published API. The Eclipse API also specifies whether a class is intended to be subclassed. (你可以把一切都公布出來,SmallTalk就是這樣做的。但是,當(dāng)下一個(gè)版本出來的時(shí)候,可能就會(huì)碰到問題。如果你公布了一切,那么你就不能做改動(dòng)了,活著你可能會(huì)破壞你的客戶端使用的東西….在Eclipse里面,我們不僅僅定義了哪些類是公開的API,我們處理得更深層次,我們甚至定義了哪些API是可以被擴(kuò)展的,哪些不可以。” 


          Eric對(duì)于重用,定義了三個(gè)級(jí)別:最低一級(jí),重用類(classes);最高一級(jí),框架(framework);而中間一級(jí),就是設(shè)計(jì)模式(Design Pattern)(“This is where I see patterns. Design patterns are both smaller and more abstract than frameworks. They're really a description about how a couple of classes can relate to each other and interact with each other. The level of reuse increases when you move from classes to patterns and finally frameworks. ”

          Eric提到了一個(gè)有趣的現(xiàn)象。通常,我們拿到一個(gè)需求,會(huì)先做設(shè)計(jì),做設(shè)計(jì)的時(shí)候,我們會(huì)使用設(shè)計(jì)模式(Design Pattern)。但是,使用XP (eXtreme Programming)方式的人不這樣做,他們先寫測(cè)試(“They write a test”)

          那么,設(shè)計(jì)一個(gè)framework的時(shí)候,要注意什么呢?要避免frameworkitis. (“ Frameworks abstract and provide higher level default functionality. To do so the framework needs to be in control. This loss of control can lead to what is sometimes called frameworkitis. ”)

         Frameworkitis就是說,一個(gè)framework想要做的東西太多,或者它并不是按照你設(shè)想的做的而你又不能去改動(dòng)它。(“Frameworkitis is the disease that a framework wants to do too much for you or it does it in a way that you don't want but you can't change it.”)

          而且,一個(gè)framework要做的比較小,因?yàn)椋绻鹒ramework太大了,那么它可能就會(huì)做太多(可能會(huì)frameworkitis),而且,不容易學(xué)習(xí),學(xué)習(xí)曲線太長,也不容易維護(hù)。

          Eria的論述真是非常精彩,而且也解釋了Eclipse的一些內(nèi)部設(shè)計(jì)。一定要閱讀全文


    [Update] 感謝lxwde的中文翻譯。我的中文翻譯可能不完全準(zhǔn)確。中文翻譯,請(qǐng)參考Related Links中給出的lxwde的中文翻譯鏈接。




    Artima developer
    訪談的第一部分
    如何思考Design Pattern?
    CSDN上的中文翻譯

    Email this store to a friend (send a short email with a subject to this story)
    Subscribe to kukooBlog (subscribe kukooBlog's RSS feed)
    Send me feedback on this story

    Yourit Technorati cosmos
    Mycat Programming, Eclipse

    posted on 2005-05-31 14:20 kukooBlog 閱讀(1306) 評(píng)論(1)  編輯  收藏 所屬分類: EclipseProgramming

    評(píng)論

    # re: 靈活性和可重用 [Eric Gamma] 2005-06-01 10:58 大胃
    前不久剛看完P(guān)art I,還沒來得及看這個(gè)Part II。等中午讀一讀。  回復(fù)  更多評(píng)論
      

    主站蜘蛛池模板: 又大又硬又粗又黄的视频免费看| 亚洲国产精品成人综合色在线婷婷 | jizz免费在线影视观看网站| 精品国产麻豆免费网站| 亚洲色图激情文学| 好吊妞在线成人免费| 亚洲精品宾馆在线精品酒店| 成人免费毛片视频| 亚洲色少妇熟女11p| 无码视频免费一区二三区| 亚洲国产欧美一区二区三区| 免费无码又爽又刺激高潮| 亚洲乱理伦片在线观看中字 | 国产精品免费_区二区三区观看| 亚洲另类自拍丝袜第五页 | 久久精品国产亚洲精品| 99热在线日韩精品免费| 国产精品亚洲A∨天堂不卡| 嫩草在线视频www免费看| 亚洲精品无码久久久久久久 | 亚洲色中文字幕在线播放| 国产一级一片免费播放| 一级毛片a免费播放王色电影| 亚洲乱色熟女一区二区三区丝袜| 日本免费一区二区久久人人澡| 亚洲高清中文字幕| 免费看少妇作爱视频| 人人公开免费超级碰碰碰视频 | 免费无码成人AV片在线在线播放| 青青青视频免费观看| 亚洲国产精华液网站w| 免费影院未满十八勿进网站| 国产偷国产偷亚洲高清在线| 国产成人亚洲综合色影视| 成年男女免费视频网站| 一个人看www免费高清字幕| 中文字幕亚洲综合久久| 免费人成在线观看网站品爱网日本| 未满十八私人高清免费影院| 亚洲视频免费观看| 亚洲高清无码专区视频|