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

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

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

    隨筆 - 53, 文章 - 0, 評論 - 3, 引用 - 0
    數(shù)據(jù)加載中……

    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 閱讀(281) 評論(0)  編輯  收藏 所屬分類: Java

    主站蜘蛛池模板: 最近免费最新高清中文字幕韩国 | 亚洲丰满熟女一区二区哦| 亚洲欧洲另类春色校园网站| 日本免费污片中国特一级| 亚洲三区在线观看无套内射| 亚洲小说区图片区| 美女内射毛片在线看免费人动物| 国产免费AV片在线播放唯爱网| 亚洲色图校园春色| 国产精品亚洲产品一区二区三区| 国产成人+综合亚洲+天堂| 花蝴蝶免费视频在线观看高清版| 亚洲中文字幕伊人久久无码| 亚洲国产免费综合| 国产亚洲综合成人91精品 | 亚洲偷自精品三十六区| 日本阿v免费费视频完整版| 免费在线看片网站| 久久亚洲精品成人av无码网站| 99热这里有免费国产精品| 亚洲无人区视频大全| 成人免费a级毛片无码网站入口| 亚洲av成人一区二区三区在线观看| 黄页网站在线视频免费| 国产亚洲精午夜久久久久久| 亚洲国产成人精品无码一区二区| 亚洲av极品无码专区在线观看| 四虎影院免费在线播放| 成人在线免费视频| 亚洲国产精品免费视频| 亚洲综合图片小说区热久久| 免费精品国偷自产在线在线| 77777亚洲午夜久久多人| 久久精品免费电影| 日本一道综合久久aⅴ免费| 亚洲视频免费在线看| 成人免费无码大片A毛片抽搐| 亚洲欧洲日产国码久在线观看| 免费人成再在线观看网站 | 国产a v无码专区亚洲av| 国产免费一区二区三区|