<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

    主站蜘蛛池模板: 亚洲人精品午夜射精日韩 | 亚洲久悠悠色悠在线播放| 免费观看久久精彩视频| 超清首页国产亚洲丝袜| 男人和女人高潮免费网站| 亚洲成A人片在线观看中文| 亚洲AV无码专区国产乱码不卡| 67194成是人免费无码| 伊人久久亚洲综合影院首页| 毛片基地免费观看| 亚洲天然素人无码专区| 免费看男女下面日出水视频| 日产久久强奸免费的看| 亚洲人成无码www久久久| 中文字幕在线免费看线人| 亚洲色大成网站WWW久久九九| 四虎影视无码永久免费| 久久亚洲私人国产精品| 毛片免费观看的视频在线| AV激情亚洲男人的天堂国语| 区三区激情福利综合中文字幕在线一区亚洲视频1 | 岛国岛国免费V片在线观看| 国产亚洲成av片在线观看 | 久久久精品免费国产四虎| 亚洲码一区二区三区| 成人免费看黄20分钟| 午夜在线免费视频| 亚洲AV综合色区无码一区爱AV| 91热成人精品国产免费| 亚洲hairy多毛pics大全| 久久久久亚洲AV成人网| 91av在线免费视频| 亚洲欧美成人综合久久久| 亚洲M码 欧洲S码SSS222| 欧洲人成在线免费| 亚洲精品久久无码| 亚洲色偷拍另类无码专区| 野花高清在线观看免费3中文 | 国产桃色在线成免费视频 | 美女裸免费观看网站| 久久精品7亚洲午夜a|