您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

SAP ABAP Netweaver里的胖接口(fat interface)

2022/1/2 13:00:39 架构 字数 4892 阅读 816 来源 https://www.iteye.com/blogs/category/architecture

SAP ABAP Netweaver里的胖接口(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 w ... sapC4CCloudCDS viewCloudFoundry? JerryWang_SAP

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 or polluted 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.

 

 

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的原创文章,请关注公众号"汪子熙":


如果您也喜欢它,动动您的小指点个赞吧

除非注明,文章均由 laddyq.com 整理发布,欢迎转载。

转载请注明:
链接:http://laddyq.com
来源:laddyq.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


联系我
置顶