zoukankan      html  css  js  c++  java
  • SAP系统里的胖接口Fat interface

    Recently I am planning an internal training regarding Software engineering concept to my colleagues and one topic is “Interface Segregation”.
    The following guideline is quoted from OODesign:

    “When we design an application we should take care how we are going to make abstract a module which contains several submodules. Considering the module implemented by a class, we can have an abstraction of the system done in an interface. But if we want to extend our application adding another module that contains only some of the submodules of the original system, we are forced to implement the full interface and to write some dummy methods. Such an interface is named fat interface orpolluted interface.
    The Interface Segregation Principle states that clients should not be forced to implement interfaces they don’t use. Instead of one fat interface many small interfaces are preferred based on groups of methods, each one serving one submodule.”

    I am very curious whether SAP standard code contains such fat interface or not. So I wrote a small CDS view:

    And get all interfaces which contains more than 10 methods:

    DATA: lt_int TYPE STANDARD TABLE OF Zfat_Interface.
    
    SELECT * INTO TABLE @lt_int FROM ZFAT_INTERFACE where method_count > 10 ORDER BY method_count DESCENDING.
    

    The result is there are totally 3139 such interfaces in my CRM development system.
    I quickly go through the list, most of them are used to build system functionalities and NO application will implement them, so in my opinion the fact is acceptable. If you are intrested with the list, you can find the excel here.

    On the other hand there is also another category of interfaces which has NO methods or attributes defined. Refer to this blog Tag(Marker) Interface in ABAP and Java for more detail.

    要获取更多Jerry的原创文章,请关注公众号"汪子熙":

  • 相关阅读:
    老潘 ListView分析 学以致用篇(一)
    安卓中如何参考寻找和参考他人的代码(待完善和待修正)
    android ListView 分析(一)
    chm 转 pdf 工具推荐与对比
    android v7包的关联
    高效程序员的45个习惯敏捷开发之道 读书笔记
    Fresco 源码分析(序)
    软件工程 软件工程师的誓言
    4 BFS & Topological Algorithm
    4 BFS & Topological Algorithm
  • 原文地址:https://www.cnblogs.com/sap-jerry/p/13570559.html
Copyright © 2011-2022 走看看