<?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: ABAPOO: local class VS Private method, which is better? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abapoo-local-class-vs-private-method-which-is-better/m-p/9702123#M1769208</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Even thought you split the logic into 4 new&amp;nbsp; private methods, to me it seems that the logic implementation for SEARCH should still be part of class CL_POST_ACCESS_IMPL. Those new methods may not be related to READ, MODIFY or DELETE, but they are still a process that belongs to CL_POST_ACCESS_IMPL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say you use the local class. If you ever have to use this class again somewhere else you would have to copy-paste the local class to the other objects in order to use the SEARCH implementation. Using an interface in most cases is enough for delivering different implementations for several classes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course there's a lot to consider, but based on your question I'd go with design A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Sep 2013 11:02:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2013-09-02T11:02:35Z</dc:date>
    <item>
      <title>ABAPOO: local class VS Private method, which is better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abapoo-local-class-vs-private-method-which-is-better/m-p/9702121#M1769206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my project I have one interface say IF_POST_ACCESS, which has methods READ, MODIFY, DELETE, SEARCH defined.&lt;/P&gt;&lt;P&gt;In its implementation class CL_POST_ACCESS_IMPL, the implementation for READ, MODIFY AND DELETE are very simple with just several lines for each. However the implementation for SEARCH is not trivial. It contains about 160 lines. I split the code into 4 seperately methods so the implementation for SEARCH looks like below:&lt;/P&gt;&lt;P&gt; init_for_search();&lt;/P&gt;&lt;P&gt; do_search();&lt;/P&gt;&lt;P&gt; post_search();&lt;/P&gt;&lt;P&gt; cleanup();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now CL_POST_ACCESS_IMPL has totally 7 methods, 3 public from interface and the 4 private. Let me call it design A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my concern is the new created 4 private methods are just serving for SEARCH, they have nothing to do with READ, MODIFY and DELETE and thus should not appear in class CL_POST_ACCESS_IMPL. As a result, I have design B: create a new local class LCL_POST_SEARCH_EXECUTOR and put all 4 private methods into it. In SEARCH implementation, just delegate the call to the local class. So in design B the global class only contains 4 methods defined in interface, which looks very clean.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you please kindly share your suggestion which design is better from your side? Thanks a lot!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Jerry&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Sep 2013 09:07:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abapoo-local-class-vs-private-method-which-is-better/m-p/9702121#M1769206</guid>
      <dc:creator>JerryWang</dc:creator>
      <dc:date>2013-09-02T09:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: ABAPOO: local class VS Private method, which is better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abapoo-local-class-vs-private-method-which-is-better/m-p/9702122#M1769207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jerry,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your design of classes is absolutely right.wasting the single method&amp;nbsp; for searching.it is better to design the separate class for these methods&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Khaleel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Sep 2013 09:54:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abapoo-local-class-vs-private-method-which-is-better/m-p/9702122#M1769207</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-09-02T09:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: ABAPOO: local class VS Private method, which is better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abapoo-local-class-vs-private-method-which-is-better/m-p/9702123#M1769208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Even thought you split the logic into 4 new&amp;nbsp; private methods, to me it seems that the logic implementation for SEARCH should still be part of class CL_POST_ACCESS_IMPL. Those new methods may not be related to READ, MODIFY or DELETE, but they are still a process that belongs to CL_POST_ACCESS_IMPL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's say you use the local class. If you ever have to use this class again somewhere else you would have to copy-paste the local class to the other objects in order to use the SEARCH implementation. Using an interface in most cases is enough for delivering different implementations for several classes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course there's a lot to consider, but based on your question I'd go with design A.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Sep 2013 11:02:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abapoo-local-class-vs-private-method-which-is-better/m-p/9702123#M1769208</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2013-09-02T11:02:35Z</dc:date>
    </item>
  </channel>
</rss>

