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

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

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

    隨筆 - 53, 文章 - 0, 評論 - 3, 引用 - 0
    數據加載中……

    Throw away unnecessary interface!

    Why we need Interface? The most important benefit come from the fact: The code depend on the interface no need to care about the implementaion class. and if the implementation class is changed later, the client code no need to update.
    This is the feature of Ploymophism of OOP, such as Java. 

    In some projects, the struts framework was adopted, so all the field need to be persisted is in ActionForm. In order to avoid that the Service layer /DAO layer will depends on the struts. One way is to define a interface which have getter and
    setter to access all the fields need to be persisted. The design is like this:

    XXXActionForm --------> XXXInterface <--------------ServiceLayer/DAO Layer
                                              most of them are 
                                              getter and setter
     
    I can understand this concern, it seems follow the paterns in Enterprise Application Architecture Pattern. but I can not agree this kinds of design. I believe this is misuse of interface.

    First, in this kinds of design, if we add some fields, we need update the actionForm, them also need to update interface.
    It is boring, and in this case, the interface can not provide any abstraction so the interface need to evolve as the implementation changed.

    Second, there is only one  kind of implementaion in the system, so the interface can not provide the benifit from making use of polymorphism.

    In a word, we can get nothing design benefit from Interface in this case, And Have burden to keep the implementaion and interface synchronized.

    posted on 2006-02-19 17:30 InPractice 閱讀(280) 評論(0)  編輯  收藏 所屬分類: Java

    主站蜘蛛池模板: 亚洲日韩人妻第一页| 日韩免费无砖专区2020狼| 中文亚洲AV片在线观看不卡| 美女免费视频一区二区| 国产成人aaa在线视频免费观看 | 亚洲AV成人无码天堂| 免费黄色福利视频| 亚洲伊人久久大香线蕉结合| 四虎最新永久免费视频| 亚洲国产午夜精品理论片| 成年在线观看网站免费| 亚洲欧洲日本在线观看| 成人免费无码大片a毛片| 理论亚洲区美一区二区三区| 亚洲福利精品一区二区三区| ww在线观视频免费观看w| 日韩亚洲人成在线综合日本 | eeuss影院免费92242部| 亚洲情综合五月天| 久久国产色AV免费观看| 亚洲mv国产精品mv日本mv| 精品国产一区二区三区免费看 | 国产va在线观看免费| 亚洲成年人免费网站| 免费毛片在线视频| 七次郎成人免费线路视频| 亚洲va国产va天堂va久久| 久久久久久久免费视频| 特黄aa级毛片免费视频播放| 亚洲AV无码乱码国产麻豆穿越| 久久午夜夜伦鲁鲁片免费无码影视| 亚洲熟伦熟女专区hd高清| 全部免费毛片在线| 久久精品视频免费看| 亚洲日韩精品无码专区加勒比| 亚洲国产精品一区二区第一页免| 久久久精品国产亚洲成人满18免费网站 | 久久精品中文字幕免费| 亚洲最大的视频网站| 免费一级做a爰片性色毛片| 日本免费久久久久久久网站|