<?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: Abstract Class and class-method in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821196#M1955865</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Please find my scenario below.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Jul 2016 18:48:56 GMT</pubDate>
    <dc:creator>asuji20</dc:creator>
    <dc:date>2016-07-19T18:48:56Z</dc:date>
    <item>
      <title>Abstract Class and class-method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821190#M1955859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been reading various posts on OOPS ABAP and&lt;SPAN style="font-size: 13.3333px;"&gt; below is the inference i have got so far.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We go for abstract classes when we have some common functions and some unique functions respective to implementing class.&lt;/P&gt;&lt;P&gt;Interfaces can also achieve what is mentioned above about abstract classes but we mainly go for it for polymorphism and when there is no need for common functions/global functions between implementing classes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is ?? what i told about abstract class can also be achieved using class-methods, class-data (for global functions) and normal class inheritance (for redefining unique functions), then why should we go for abstract classes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Moreover, we have a disadvantage with abstract classes, that all the implementing classes must redefine all the abstract methods. We add a new abstract method to an abstract class, we need to define it in all implementing classes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then why are we not sticking with using class-method and normal inheritance and instead go for abstract classes?&lt;/P&gt;&lt;P&gt;Even interfaces have this disadvantage, but it is the only way for polymorphism.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, the global/common methods of an abstract class can be redefined where as class-methods cannot be, helping us achieve OO Pardigm better. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could anyone please help me understand this, please forgive me if i am wrong anywhere.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2016 15:06:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821190#M1955859</guid>
      <dc:creator>asuji20</dc:creator>
      <dc:date>2016-07-19T15:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class and class-method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821191#M1955860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Puhhh, where to start? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the usual case you use abstract classes i.e. abstract methods only for these cases, where you really want to redefine it always in the sub classes. It's not needed to define all methods as abstract, you can implement methods also in an abstract class.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course you can also avoid a redefinition of an already implemented method by using FINAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interfaces are good to hide implementations (open-close-principle) and to seperate concerns. They are also very good for dependency injections in well layered applications.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you say, you can implement the functionalities also as static methods, then it sounds like you need in fact helper or utility classes. So you should not take inheritance as solution, but delegation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2016 15:25:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821191#M1955860</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-07-19T15:25:28Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class and class-method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821192#M1955861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Armin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you. &lt;/P&gt;&lt;P&gt;"FINAL" is a great solution to prevent redefinition of abstract classes' common methods, but i still don't understand why were abstract classes formed when we could do it all using simple static methods and normal redefinition of a super classes' methods.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you explain more about "&lt;SPAN style="color: #333333; font-size: 12px;"&gt;it sounds like you need in fact helper or utility classes. So you should not take inheritance as solution, but delegation"&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2016 16:21:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821192#M1955861</guid>
      <dc:creator>asuji20</dc:creator>
      <dc:date>2016-07-19T16:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class and class-method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821193#M1955862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Madhu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in short, because you often can not. Consider this example in my pseudo language:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class Primitive {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; abstract draw(canvas);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class Line extends Primitive {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private x_1, y_1, x_2, x_2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; draw(canvas) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; canvas.drawLine(x_1, y_1, x_2, y_2);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class Rect extends Primitive {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; draw(canvas) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; canvas.drawRect(x_1, y_1, x_2, y_2, &lt;SPAN style="font-size: 13.3333px;"&gt;x_3, y_3, x_4, y_4&lt;/SPAN&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you can have drawing code that always draws the correct shape with the correct points. E.g:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;primitives = [ new Line(), new Line(), new Rect() ];&lt;/P&gt;&lt;P&gt;for (primitive in primitives) { primitive.draw() };&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This would not work that easily if you'd use static methods because you'd have to check from which class the static method has to be called, e.g.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class Primitive {&lt;SPAN style="font-size: 10pt;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class Line extends Primitive {&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private x_1, y_1, x_2, x_2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static draw(line, canvas) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; canvasdrawLine(line.&lt;SPAN style="font-size: 13.3333px;"&gt;x_1, &lt;SPAN style="font-size: 13.3333px;"&gt;line.&lt;/SPAN&gt;y_1, &lt;SPAN style="font-size: 13.3333px;"&gt;line.&lt;/SPAN&gt;x_2, &lt;SPAN style="font-size: 13.3333px;"&gt;line.&lt;/SPAN&gt;y_2&lt;/SPAN&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;class Rect extends Primitive {&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static draw(rect, canvas) {&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; canvas.drawRect(rect.x_1, rect.y_1, rect.x_2, rect.y_2, rect.&lt;SPAN style="font-size: 13.3333px;"&gt;x_3, rect.y_3, rect.x_4, rect.y_4&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;}&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Your drawing code will now have to do sth. like this:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;primitives = [ new Line(), new Line(), new Rect() ];&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;for (primitive in primitives) { &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (typeof(Primitive) == Line) { Line.draw(canvas, primitive) }&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if &lt;SPAN style="font-size: 13.3333px;"&gt;(typeof(Primitive) == Rect) { Rect.draw(canvas, primitive) }&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;}&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;So as you can see, the objects do not automatically select the right method to draw anymore, that's your job now. Therefore the solutions are not equivalent.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;But keep in mind that inheritance is not the only way to solve the problem. Pick the one best suited for the job. You should also look at composition which is considered to be more flexible than inheritance by many.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;The first example could as easily implemented by using an interface, but consider that there could be methods that are useful for all primitives, e.g. a transformation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;In this case you could do sth. like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;abstract class Primitive {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected points;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; translate(x, y) {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for point in Points {&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point.x = point.x + x;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; point.y = point.y + y;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; abstract draw(canvas)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;By extending the class above all your primitives will have a translate method that will move all points by the given x and y amount.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Frank&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;More info on Inheritance vs. Composition&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;A href="http://stackoverflow.com/questions/49002/prefer-composition-over-inheritance" title="http://stackoverflow.com/questions/49002/prefer-composition-over-inheritance"&gt;language agnostic - Prefer composition over inheritance? - Stack Overflow&lt;/A&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;A href="https://www.thoughtworks.com/insights/blog/composition-vs-inheritance-how-choose" style="font-size: 13.3333px;" title="https://www.thoughtworks.com/insights/blog/composition-vs-inheritance-how-choose"&gt;https://www.thoughtworks.com/insights/blog/composition-vs-inheritance-how-choose&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Added links.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2016 17:32:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821193#M1955862</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-07-19T17:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class and class-method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821194#M1955863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you have a superclass with 10 methods "concrete" and 15 methods abstract, and you have subclasses where you only implement these abstract methods and need not reimplementing the 10 concrete methods, would you really instead prefer not using an abstract class and implementing the same code in all 10 methods of all subclasses? I prefer doing the code once.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2016 17:48:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821194#M1955863</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2016-07-19T17:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class and class-method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821195#M1955864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you so much, the below try out was what actually made me doubt why and when do we really need abstract class ( programming wise, not conceptual )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A scenario &lt;/P&gt;&lt;P&gt;abstract_class&lt;/P&gt;&lt;P&gt;method display importing info FINAL&amp;nbsp;&amp;nbsp; "common method&lt;/P&gt;&lt;P&gt;abstract method "get info"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "method for redefinition&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"if we add new abstract method we need to redefine in all classes - Issue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class1 inheriting from abstract_class&lt;/P&gt;&lt;P&gt;redefine method "get info" to "get name info"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class2 inheriting from abstract_class&lt;/P&gt;&lt;P&gt;redefine method "get info" to "get age info"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class_trigger&lt;/P&gt;&lt;P&gt;class-method call_all importing classimp type ref to abstract_class&lt;/P&gt;&lt;P&gt;call method classimp-&amp;gt;get_info()&lt;/P&gt;&lt;P&gt;call method classimp-&amp;gt;display()&lt;/P&gt;&lt;P&gt;endmethod&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create objects class1, class2&lt;/P&gt;&lt;P&gt;class_trigger-&amp;gt;call_all ( class1 ).&lt;/P&gt;&lt;P&gt;class_trigger-&amp;gt;call_all ( class2 ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Now, I can do the same using class-method and normal redefinition&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Main_class&lt;/P&gt;&lt;P&gt;class-method display importing info&amp;nbsp; "common method&lt;/P&gt;&lt;P&gt;method "get info"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&lt;SPAN style="font-size: 13.3333px;"&gt;"method for redefinition&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class1 inheriting from main_class&lt;/P&gt;&lt;P&gt;redefine method "get info" to "get name info"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;class2 inheriting from main_class&lt;/P&gt;&lt;P&gt;redefine method "get info" to "get age info"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;class_trigger&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;class-method call_all importing classimp type ref to abstract_main&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;call method classimp-&amp;gt;get_info()&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;call method classimp-&amp;gt;display()&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;endmethod&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;create objects class1, class2&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;class_trigger-&amp;gt;call_all ( class1 ).&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;class_trigger-&amp;gt;call_all ( class2 ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="1096645" __jive_macro_name="user" class="jive_macro_user jive_macro" data-objecttype="3" data-orig-content="sandra rossi" href="https://community.sap.com/"&gt;&lt;/A&gt; i think that's what i am trying to know, why go through the trouble of creating abstract classes methods and compel implementing classes to redefine them all.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Frank kirck , could you please help me understand this scenario and why abstract is needed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2016 18:41:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821195#M1955864</guid>
      <dc:creator>asuji20</dc:creator>
      <dc:date>2016-07-19T18:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class and class-method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821196#M1955865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Please find my scenario below.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2016 18:48:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821196#M1955865</guid>
      <dc:creator>asuji20</dc:creator>
      <dc:date>2016-07-19T18:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class and class-method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821197#M1955866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Please find my response and scenario below, I was unable to tag your names correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2016 18:54:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821197#M1955866</guid>
      <dc:creator>asuji20</dc:creator>
      <dc:date>2016-07-19T18:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class and class-method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821198#M1955867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Madhu,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in your example, both approaches will work just fine. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Abstract classes vs. non abstract base classes&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Abstract classes are tools to make coding easier by making it easier to communicate the intent of your code to your fellow programmer.&lt;/P&gt;&lt;P&gt;In your example, if I only look at the code you have, I could try to create an instance of the class Main_class which could work or not depending on the implementation. But if you make the class abstract, I know that the Main_class is not intended to be used directly. This will prevent me from making a mistake.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Abstract classes vs. interfaces&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can achieve that I never try to create an instance of Main_class by making it an interface. But now you force me to implement all methods of Main_class anytime I want to create a new class to be used by the static method. If it is possible to provide meaningful default implementation for some of the methods, it makes sense to provide an abstract base class that implements all these method for me so that I can create a new class with less effort.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Frank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jul 2016 19:49:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821198#M1955867</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-07-19T19:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class and class-method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821199#M1955868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Frank,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much. I think i get the point now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2016 04:21:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821199#M1955868</guid>
      <dc:creator>asuji20</dc:creator>
      <dc:date>2016-07-20T04:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class and class-method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821200#M1955869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P&gt;Frank Krick wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Abstract classes vs. non abstract base classes&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Abstract classes are tools to make coding easier by making it easier to communicate the intent of your code to your fellow programmer.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Not just your fellow programmer, but yourself in a few years time! But it's not just to make things easier - it can be part of good design.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use interfaces for polymorphism mainly, where subclassing hierarchies don't make sense. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you really want to understand how to use abstract classes, sub classes and interfaces well, I suggest that you get hold of a book of Design Patterns, or research into them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note, this is &lt;STRONG&gt;not&lt;/STRONG&gt; an ABAP specific issue. It pertains across all OO languages.There are some blogs here that talk about ABAP implementations of design patterns. I suggest searching,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2016 08:04:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821200#M1955869</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2016-07-20T08:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class and class-method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821201#M1955870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Agreed, the gang of four is everywhere &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.sap.com/108/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2016 13:24:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821201#M1955870</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-07-20T13:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class and class-method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821202#M1955871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Mathew, I sure will when I get a chance. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2016 19:11:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abstract-class-and-class-method/m-p/11821202#M1955871</guid>
      <dc:creator>asuji20</dc:creator>
      <dc:date>2016-07-20T19:11:43Z</dc:date>
    </item>
  </channel>
</rss>

