<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ABAP OO interfaces VS Class methods in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488152#M16283</link>
    <description>&lt;P&gt;class Parrot&lt;/P&gt;&lt;P&gt;      method Speak()&lt;/P&gt;&lt;P&gt;class GermanPerson&lt;/P&gt;&lt;P&gt;      method Speak()&lt;/P&gt;&lt;P&gt;each method will have its own code. I understand if I implement an interface in different classes I need to write code too and they can be the same as well...I still cannot see the benefit of interface.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Jun 2017 18:27:24 GMT</pubDate>
    <dc:creator>former_member195315</dc:creator>
    <dc:date>2017-06-14T18:27:24Z</dc:date>
    <item>
      <title>ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488148#M16279</link>
      <description>&lt;P&gt;Hi, everyone.&lt;/P&gt;&lt;P&gt;I've been trying to understand why and when we should use INTERFACES All the examples I've found on internet are pretty much the same. You created an interface with 2 methods. Then you implement them into a CLASS and write your code. If you create another class and implement that interface, you will have to write your code again. &lt;/P&gt;&lt;P&gt;So I ask: why not, instead of using INTERFACES, create 2 METHODS for each CLASS? &lt;/P&gt;&lt;P&gt;Can somebody help me understand the use of INTERFACES?&lt;/P&gt;&lt;P&gt;Look: Interface Speak. Implement in Class SpanishPerson('Hola') and EnglishPerson('Hello'). Why not a method Speak for SpanishPerson and a method Speak for EnglishPerson?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 14:28:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488148#M16279</guid>
      <dc:creator>former_member195315</dc:creator>
      <dc:date>2017-06-14T14:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488149#M16280</link>
      <description>&lt;P&gt;If you primarily want to reuse code, prefer composition with &lt;EM&gt;thin interfaces&lt;/EM&gt; to inheritance with &lt;EM&gt;rich interfaces&lt;/EM&gt;.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;With interface Speak, you can add a Class Parrot('Hallo') and a Class GermanPerson('Hallo').&lt;/LI&gt;&lt;LI&gt;With method Speak, you will have to pretend your Parrot &lt;A href="https://en.wikipedia.org/wiki/Fragile_base_class"&gt;is a&lt;/A&gt; GermanPerson.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;JNN&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 15:42:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488149#M16280</guid>
      <dc:creator>nomssi</dc:creator>
      <dc:date>2017-06-14T15:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488150#M16281</link>
      <description>&lt;P&gt;You are in middle of room and someone let say a tiger attacks you.&lt;/P&gt;&lt;P&gt;You have no weapon.&lt;/P&gt;&lt;P&gt;You see on the window, a human being is out standing willing to help you.&lt;/P&gt;&lt;P&gt;You will shout " help me.." Give me something to hit it back.&lt;/P&gt;&lt;P&gt;in above statements: you asked something from man standing outside to throw something.&lt;/P&gt;&lt;P&gt;It can be a baseball,&lt;/P&gt;&lt;P&gt;it can be a rod.&lt;/P&gt;&lt;P&gt;it can be wood log.&lt;/P&gt;&lt;P&gt;It can be anything, that can help you save yourself.&lt;/P&gt;&lt;P&gt;What are the characteristics of that thing:&lt;/P&gt;&lt;P&gt;- it can be thrown from that window&lt;/P&gt;&lt;P&gt;- it can be tossed&lt;/P&gt;&lt;P&gt;- its something that you can grab &amp;amp; hold.&lt;/P&gt;&lt;P&gt;It actually doesn't matter what it throws to you..&lt;/P&gt;&lt;P&gt;Interface is like the same: you specify the characteristics. ( import &amp;amp; export  Parameters) structure.&lt;/P&gt;&lt;P&gt;the Class that implements that interface defines if, its going to throw baseball, or rod. etc..&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Anand&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 16:11:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488150#M16281</guid>
      <dc:creator>anand_sagarsethi</dc:creator>
      <dc:date>2017-06-14T16:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488151#M16282</link>
      <description>&lt;P&gt;All right but since you need to implement(write your code) in your class, isn't it the same to have a method with the same signature? I can only see interface works in BAdIs where everyone who implements it needs to respect the signature. Understand what I mean?&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 18:24:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488151#M16282</guid>
      <dc:creator>former_member195315</dc:creator>
      <dc:date>2017-06-14T18:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488152#M16283</link>
      <description>&lt;P&gt;class Parrot&lt;/P&gt;&lt;P&gt;      method Speak()&lt;/P&gt;&lt;P&gt;class GermanPerson&lt;/P&gt;&lt;P&gt;      method Speak()&lt;/P&gt;&lt;P&gt;each method will have its own code. I understand if I implement an interface in different classes I need to write code too and they can be the same as well...I still cannot see the benefit of interface.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 18:27:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488152#M16283</guid>
      <dc:creator>former_member195315</dc:creator>
      <dc:date>2017-06-14T18:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488153#M16284</link>
      <description>&lt;P&gt;1.That's one example you said is correct.&lt;/P&gt;&lt;P&gt;2. you forgot your hands. in above example.. your hands are capable to hold anything that is thrown, so you will define your hand of interface type, instead of specific class type.&lt;/P&gt;&lt;P&gt;3.If you generalize the perspective, then everything can be solved in the structured programming. &lt;/P&gt;&lt;P&gt;4.its just a way to divide the processes based on use, but still generalize to make it available everywhere.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 19:48:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488153#M16284</guid>
      <dc:creator>anand_sagarsethi</dc:creator>
      <dc:date>2017-06-14T19:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488154#M16285</link>
      <description>&lt;P&gt;Personally I like this answer from stack overflow.  It's not coded in ABAP, but the same concepts apply:  &lt;A href="https://stackoverflow.com/a/6878726"&gt;https://stackoverflow.com/a/6878726&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 20:31:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488154#M16285</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-06-14T20:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488155#M16286</link>
      <description>&lt;P&gt;Hello Oscar,&lt;/P&gt;&lt;P&gt;I suggest searching the web for an explanation of the &lt;A href="https://sourcemaking.com/design_patterns/strategy"&gt;Strategy pattern&lt;/A&gt;. I will hope the following will make sense to you.&lt;/P&gt;&lt;P&gt;What is the benefit of having the same method in many classes? &lt;/P&gt;&lt;P&gt;Our aim is to write &lt;I&gt;code&lt;/I&gt; that receive any object implementing a given method Speak( ) and invoke the Speak( ) method dynamically. The code should work for current an future object without change. How can we achieve that?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Inheritance&lt;/STRONG&gt;: Limit the object types our code will accept to subtypes of a [Person] class that implement a method Speak( ).&lt;/P&gt;&lt;P&gt;Make sure [Parrot], [GermanPerson], [SpanishPerson]... are subclasses of class [Person]. Each subclass redefines method Speak( ), e.g. [SpanishPerson]-&amp;gt;Speak( ), [GermanPerson]-&amp;gt;Speak( ), [EnglishPerson]-&amp;gt;Speak( ), even [Parrot]-&amp;gt;Speak( ). &lt;/P&gt;&lt;P&gt;Problem: we derived [Parrot] from class of [Person] just to make it Speak( ), but if we implement a Fly( ) method, someone could derive a subclass from [Parrot] that is a [Person] that can fly.  Rich public interfaces will cause inheritance problems&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Composition&lt;/STRONG&gt;: define an interface [Person] with a method Speak( ) and make sure our code only calls method Speak( ) of Interface [Person]. &lt;/P&gt;&lt;P&gt;We can now implement the method Person~Speak( ) in any class that choose to implement the interface [Person] without further restrictions on the type, e.g. [SpanishPerson]-&amp;gt;Person~Speak( ), [GermanPerson]-&amp;gt;Person~Speak( ), [EnglishPerson]-&amp;gt;Person~Speak( ), [Parrot]-&amp;gt;Person~Speak( ). &lt;/P&gt;&lt;P&gt;Benefit: the classes do not need to have an inheritance relationship.&lt;/P&gt;&lt;P&gt;Defining a stable public interface is a design challenge, but using one is quite simple.&lt;/P&gt;&lt;P&gt;JNN&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 21:25:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488155#M16286</guid>
      <dc:creator>nomssi</dc:creator>
      <dc:date>2017-06-14T21:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488156#M16287</link>
      <description>&lt;P&gt;I had gone through many topics on that site but hadnt found one about interfaces. It has many explanations and examples but I still think you can use class methods in place of interfaces.&lt;/P&gt;&lt;P&gt;I had used the example of Speak.&lt;/P&gt;&lt;P&gt;Class englishPerson&lt;/P&gt;&lt;P&gt;         method Speak() &lt;/P&gt;&lt;P&gt;                  Hi&lt;/P&gt;&lt;P&gt;Class spanishPerson&lt;/P&gt;&lt;P&gt;         method Speak()&lt;/P&gt;&lt;P&gt;                 Hola&lt;/P&gt;&lt;P&gt;Then lets say you check the sy-langu&lt;/P&gt;&lt;P&gt;If Spanish then create spanishPerson, call method Speak&lt;/P&gt;&lt;P&gt;If English then create englishPerson, call method Speak&lt;/P&gt;&lt;P&gt;With interfaces&lt;/P&gt;&lt;P&gt;Interface Speaker&lt;/P&gt;&lt;P&gt;        Speak&lt;/P&gt;&lt;P&gt;Class englishPerson&lt;/P&gt;&lt;P&gt;        Interface Speaker, method Speak&lt;/P&gt;&lt;P&gt;              Hi&lt;/P&gt;&lt;P&gt;Class spanishPerson&lt;/P&gt;&lt;P&gt;        Interface Speaker, method Speak&lt;/P&gt;&lt;P&gt;             Hola&lt;/P&gt;&lt;P&gt;Then, again, lets say you check sy-langu&lt;/P&gt;&lt;P&gt;If Spanish then create spanishPerson, call method Speak of interface Speaker&lt;/P&gt;&lt;P&gt;If English then create englishPerson, call method Speak of interface Speaker&lt;/P&gt;&lt;P&gt;With interface or method, we have to write code lines anyway. See? That's what I dont understand. Why interfaces if we can achieve what we want with methods of a class. But I appreciate yours and everyone elses efforts to explain interfaces to me.&lt;/P&gt;&lt;P&gt;I found this example: &lt;A href="https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+Objects+-+Interface+In+Local+Class+-+Real+Time+Example" target="test_blank"&gt;https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+Objects+-+Interface+In+Local+Class+-+Real+Time+Example&lt;/A&gt; &lt;/P&gt;&lt;P&gt;He created an interface and then implemented in both classes, why not create a method which makes the same in the implemented interface in both classes? &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    DATA : zcl_so_header TYPE REF TO lcl_so_header,
           zif_so_longtext TYPE REF TO lif_longtext.
MOVE zcl_so_header TO zif_so_longtext.
*******************************************
** Get Text ids for Sales Order Document **
*******************************************
 zif_so_longtext-&amp;gt;get_textid( ). ====&amp;gt; why not zcl_so_header-&amp;gt;get_textid( ) ???&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Jun 2017 22:17:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488156#M16287</guid>
      <dc:creator>former_member195315</dc:creator>
      <dc:date>2017-06-14T22:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488157#M16288</link>
      <description>&lt;P&gt;An interface is not so much to benefit for the one implementing it, which is what you are perfectly justified in questioning. However it is incredibly useful for the one using the object. &lt;/P&gt;&lt;P&gt;Think polymorphism without inheritance, or an alternative to superclasses. They are actually far more flexible than inherited classes. Without interfaces, the next developer might build another class and call his method GermanPerson.talk. An interface fixes the signature for all classes that implement a particular function.&lt;/P&gt;&lt;P&gt;In other words, interfaces let you abstract the class. The caller doesn't know or care if it's a German, English or Spanish person, or even a parrot for that matter. The interface zif_person ensures that the caller can tell everyone to speak.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 23:33:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488157#M16288</guid>
      <dc:creator>pokrakam</dc:creator>
      <dc:date>2017-06-14T23:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488158#M16289</link>
      <description>&lt;P&gt;Imagine you are writing code and you want to add a user exit (call a method with parameters) at some place so that other developers can add some code to change a variable how they like. So you can't create a class for this code now. The simplest way is to create an interface, and you call the method of this interface (before that, you instantiate the object by getting the name of the class via a customizing class: empty -&amp;gt; don't create the object/don't call the method). The day a developer wants to add some code, he will create a class which implements this interface (and enter the name of the class in the table).&lt;/P&gt;&lt;P&gt;This is the principle of BAdIs for instance.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 04:46:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488158#M16289</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2017-06-15T04:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488159#M16290</link>
      <description>&lt;P&gt;Other example: imagine you want to improve the method ADD_ATTACHMENT of class CL_DOCUMENT_BCS, so that it's easier to add a file as attachment of a mail. Currently, the file content is passed by a horrible parameter of type table of 255 bytes, or another one of type table of 255 characters if it's a text file. Moreover, it would be better to connect directly the source of the file to the input of the method, so that the developer doesn't have to bother with reading the file, converting the type, etc.&lt;/P&gt;&lt;P&gt;So it's better to have only one "FILE" parameter being an instance of an interface, with method GET_FILE_CONTENT which returns a string of bytes.&lt;/P&gt;&lt;P&gt;In the new method of ADD_ATTACHMENT, you'll call the method GET_FILE_CONTENT of the parameter FILE to get the bytes. Later you will create one class which implements the interface and method GET_FILE_CONTENT, for reading a file from the application server. Later you will create another class for reading a file from the frontend. Etc.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 05:18:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488159#M16290</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2017-06-15T05:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488160#M16291</link>
      <description>&lt;P&gt;Interfaces are the new Badis &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I do think your explanation with &lt;A rel="user" href="https://answers.sap.com/users/6464/mikepokraka.html" nodeid="6464"&gt;Mike Pokraka&lt;/A&gt;'s sum it up. It is not for the original writer... it is to keep subsequent programmers out of the original program/class/method while ensuring that the original code can communicate with the new.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 12:41:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488160#M16291</guid>
      <dc:creator>raghug</dc:creator>
      <dc:date>2017-06-15T12:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488161#M16292</link>
      <description>&lt;P&gt;I found a very good video with an example that helped me understand interfaces:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=su41Dg17HDI&amp;amp;list=PLXFymkG-_2DhQQg3dP0HWQa7TlH-0gDhz" target="test_blank"&gt;https://www.youtube.com/watch?v=su41Dg17HDI&amp;amp;list=PLXFymkG-_2DhQQg3dP0HWQa7TlH-0gDhz&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thank you all for helping me... I feel I have taken another step to become a real developer lol.&lt;/P&gt;&lt;P&gt;Is there a way to make all your answers helpful?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 15:13:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488161#M16292</guid>
      <dc:creator>former_member195315</dc:creator>
      <dc:date>2017-06-15T15:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488162#M16293</link>
      <description>&lt;P&gt;You can up- or downvote any answer (even on other people's questions) by clicking the arrows to the left of it. Upvoting is the new 'helpful'. Downvote if you think a response is not good.&lt;/P&gt;&lt;P&gt;Comments on the other hand you can only 'like', though I think this counts as the same thing.&lt;/P&gt;&lt;P&gt;Edit: And you can always vote on other people's questions too. e.g. I've given yours the thumbs up because it was a good question which triggered some really useful discussion that I'm sure others will also find useful in future. In searches, discussions with many positive votes will come out on top, that's the general thinking behind this platform.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2017 19:46:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488162#M16293</guid>
      <dc:creator>pokrakam</dc:creator>
      <dc:date>2017-06-15T19:46:41Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488163#M16294</link>
      <description>&lt;P&gt;No, interfaces are not the new Badis. Sandra is presenting a use case.&lt;/P&gt;&lt;P&gt;Furthermore, there are use cases that are beneficial to the original programmer - I don't know about you, but I often call methods of classes I've written!&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 05:07:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488163#M16294</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2017-06-16T05:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488164#M16295</link>
      <description>&lt;P&gt;Interfaces are a way of assigning more than one type to a class. In C++ you can inherit from two super classes. You can't in ABAP. You can, however, assign one or more interfaces. Sometimes sub classing just isn't flexible enough, it depends on your needs. I use it if I have a set of related objects, but to make them all subclasses of a super class seems overly heavy. &lt;/P&gt;&lt;P&gt;E-g- I have a set of plug in checks. The actual checks made depend on configuration. I have a factory method that reads the configuration and returns a table of references. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA checks TYPE STANDARD TABLE OF REF TO zif_checks WITH EMPTY KEY.
checks = zcl_check_reader=&amp;gt;get_checks( for_this_config-entry). 
LOOP AT checks INTO data(check).
  LOOP AT my_data INTO data(data_entry).
    check-&amp;gt;perform_check( data_entry ).
  ...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now of course I could have a hierarchy of check, and do it via subclassing. But then I must implement or have a super implementation of every method, even if they don't really apply to all the sub classes. If I find I'm implemented an abstract method as &lt;EM&gt;"do nothing&lt;/EM&gt;, then that's an indication that interfaces would have been better.&lt;/P&gt;&lt;P&gt;Ultimately, it's a programming choice. Sometimes using interfaces makes life simpler. &lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 05:25:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488164#M16295</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2017-06-16T05:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488165#M16296</link>
      <description>&lt;P&gt;Another benefit: Testing&lt;/P&gt;&lt;P&gt;Imagine you want to test an event handler for a framework, e.g. an HTTP handler for ICF. During a module test there is no ICF. But you can easily create a small mock framework by implementing the ICF interfaces in own classes.&lt;/P&gt;&lt;P&gt;See example under &lt;A href="https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abapinterfaces_partially.htm" target="test_blank"&gt;https://help.sap.com/http.svc/rc/abapdocu_751_index_htm/7.51/en-US/index.htm?file=abapinterfaces_partially.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 07:12:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488165#M16296</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2017-06-16T07:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488166#M16297</link>
      <description>&lt;P&gt;Question: &lt;/P&gt;&lt;P&gt;If you can drive one car, why can you also drive almost any other car?&lt;/P&gt;&lt;P&gt;Answer:&lt;/P&gt;&lt;P&gt;Because all cars have the same interface(s) and behave the same way independent from the vendor specific implementation.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 07:19:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488166#M16297</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2017-06-16T07:19:40Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OO interfaces VS Class methods</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488167#M16298</link>
      <description>&lt;P&gt;Hmmm....  Isn't a Stuffed Crust Pizza a different object to a deep pan pizza ?  And aren;t they both sub-classes of the pizza super class ???&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2017 10:19:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-oo-interfaces-vs-class-methods/m-p/488167#M16298</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-06-16T10:19:40Z</dc:date>
    </item>
  </channel>
</rss>

