<?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>Question Re: Abstract Class - UI5 &amp; javascript understanding in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/abstract-class-ui5-javascript-understanding/qaa-p/12620599#M4733788</link>
    <description>&lt;P&gt;Hi Emil,&lt;BR /&gt;these are many interesting questions in your post. Let me try to answer them:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. Abstract Class - General&lt;BR /&gt;&lt;/STRONG&gt;JS (ES5) has not a concept of abstract classes. So, UI5 just use the term "abstract" as a logical concept and to inform the developer to not instantiate this class. The functionality of a class might be missing when the class is instantiated by the developer itself. UI5 internally there might be usages of the instantiation but for application developers this is not useful.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;2. Constructor of abstract classes in Documentation&lt;BR /&gt;&lt;/STRONG&gt;The constructor is public available because there might be subclasses extending the abstract class and these classes have to know how they can call the super class constructor. However having this code snippet in an abstract class constructor is wrong. This we will fix.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3. getId - Single Point of truth&lt;BR /&gt;&lt;/STRONG&gt;In JS it's not possible to determine which class has introduced a method e.g. &lt;EM&gt;getId&lt;/EM&gt;. You can only determine the class an instance have which has the method e.g. &lt;EM&gt;getId&lt;/EM&gt;. The getId method is placed on the sap/ui/base/ManagedObject but only subclasses, like sap/ui/core/Element or sap/ui/core/Component does enforce the IDs. For further information see &lt;A href="https://ui5.sap.com/#/api/sap.ui.base.ManagedObject%23methods/getId" target="test_blank"&gt;https://ui5.sap.com/#/api/sap.ui.base.ManagedObject%23methods/getId&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Sep 2022 05:31:16 GMT</pubDate>
    <dc:creator>FlorianVogt</dc:creator>
    <dc:date>2022-09-01T05:31:16Z</dc:date>
    <item>
      <title>Abstract Class - UI5 &amp; javascript understanding</title>
      <link>https://community.sap.com/t5/technology-q-a/abstract-class-ui5-javascript-understanding/qaq-p/12620598</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;
  &lt;P&gt;I am trying to understand &amp;amp; learn some concepts of UI5 and I was going through some tutorials but rather than copying thoughlessly code from tutorials I prefer understanding what is happening below the surface.&lt;/P&gt;
  &lt;P&gt;One of the examples I encountered was handling the &lt;STRONG&gt;class sap.m.image &lt;/STRONG&gt;event &lt;STRONG&gt;press&lt;/STRONG&gt;. According to the API reference event is fired, which I handled in a View Controller in a line:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;onImagePress: function(oEvent){
            var oSOurce = oEvent.getSource(); 
            var ID = oSOurce.getId();
}&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;I wanted to get the Source and finally get the ID of the image.&lt;/P&gt;
  &lt;P&gt;Here unfortunatelly comes my question. According to API reference, &lt;STRONG&gt;getSource &lt;/STRONG&gt;of&lt;STRONG&gt; oEvent &lt;/STRONG&gt;returns object of class &lt;STRONG&gt;EventProvider&lt;/STRONG&gt;:&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2091682-image.png" /&gt;&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2091681-abstract-class.png" /&gt;&lt;/P&gt;
  &lt;P&gt;Although the class is marked in API to be &lt;STRONG&gt;abstract&lt;/STRONG&gt; it can be &lt;STRONG&gt;instantiated&lt;/STRONG&gt; (according to API ref., which is in contradiction to my understanding of abstract classes).&lt;/P&gt;
  &lt;P&gt;I was trying to understand where does the availability of method &lt;STRONG&gt;getId &lt;/STRONG&gt;come from and tried to debug the Event.js but without any spectacular results. I was hoping that maybe methods like &lt;STRONG&gt;oSOurce.&lt;/STRONG&gt;constructor.&lt;STRONG&gt;name &lt;/STRONG&gt;could help but not really. &lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt; Event.prototype.getSource = function() {
		return this.oSource;
	}; 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Aug 2022 19:56:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abstract-class-ui5-javascript-understanding/qaq-p/12620598</guid>
      <dc:creator>emil_lazarski</dc:creator>
      <dc:date>2022-08-31T19:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class - UI5 &amp; javascript understanding</title>
      <link>https://community.sap.com/t5/technology-q-a/abstract-class-ui5-javascript-understanding/qaa-p/12620599#M4733788</link>
      <description>&lt;P&gt;Hi Emil,&lt;BR /&gt;these are many interesting questions in your post. Let me try to answer them:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1. Abstract Class - General&lt;BR /&gt;&lt;/STRONG&gt;JS (ES5) has not a concept of abstract classes. So, UI5 just use the term "abstract" as a logical concept and to inform the developer to not instantiate this class. The functionality of a class might be missing when the class is instantiated by the developer itself. UI5 internally there might be usages of the instantiation but for application developers this is not useful.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;2. Constructor of abstract classes in Documentation&lt;BR /&gt;&lt;/STRONG&gt;The constructor is public available because there might be subclasses extending the abstract class and these classes have to know how they can call the super class constructor. However having this code snippet in an abstract class constructor is wrong. This we will fix.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3. getId - Single Point of truth&lt;BR /&gt;&lt;/STRONG&gt;In JS it's not possible to determine which class has introduced a method e.g. &lt;EM&gt;getId&lt;/EM&gt;. You can only determine the class an instance have which has the method e.g. &lt;EM&gt;getId&lt;/EM&gt;. The getId method is placed on the sap/ui/base/ManagedObject but only subclasses, like sap/ui/core/Element or sap/ui/core/Component does enforce the IDs. For further information see &lt;A href="https://ui5.sap.com/#/api/sap.ui.base.ManagedObject%23methods/getId" target="test_blank"&gt;https://ui5.sap.com/#/api/sap.ui.base.ManagedObject%23methods/getId&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 05:31:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abstract-class-ui5-javascript-understanding/qaa-p/12620599#M4733788</guid>
      <dc:creator>FlorianVogt</dc:creator>
      <dc:date>2022-09-01T05:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class - UI5 &amp; javascript understanding</title>
      <link>https://community.sap.com/t5/technology-q-a/abstract-class-ui5-javascript-understanding/qaa-p/12620600#M4733789</link>
      <description>&lt;P&gt;Thanks for the fix and explanation. &lt;/P&gt;&lt;P&gt;The only thing I did not get is:&lt;/P&gt;&lt;P&gt;You can only determine the class an instance have which has the method e.g. &lt;EM&gt;getId&lt;/EM&gt;. &lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 06:29:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abstract-class-ui5-javascript-understanding/qaa-p/12620600#M4733789</guid>
      <dc:creator>emil_lazarski</dc:creator>
      <dc:date>2022-09-01T06:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class - UI5 &amp; javascript understanding</title>
      <link>https://community.sap.com/t5/technology-q-a/abstract-class-ui5-javascript-understanding/qaa-p/12620601#M4733790</link>
      <description>&lt;P&gt;Try to use TypeScript for your ui5 app. This has the concept of real classes including abstract classes. Here you have the getting started &lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 06:52:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abstract-class-ui5-javascript-understanding/qaa-p/12620601#M4733790</guid>
      <dc:creator>WouterLemaire</dc:creator>
      <dc:date>2022-09-01T06:52:29Z</dc:date>
    </item>
    <item>
      <title>Re: Abstract Class - UI5 &amp; javascript understanding</title>
      <link>https://community.sap.com/t5/technology-q-a/abstract-class-ui5-javascript-understanding/qaa-p/12620602#M4733791</link>
      <description>&lt;P&gt;e.g If you have an instance of sap/m/Text you can check that &lt;EM&gt;getId&lt;/EM&gt; is available and you can determine that the instance is based on the class sap/m/Text but not which class in the class hierarchy has introduced &lt;EM&gt;getId&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 07:28:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/abstract-class-ui5-javascript-understanding/qaa-p/12620602#M4733791</guid>
      <dc:creator>FlorianVogt</dc:creator>
      <dc:date>2022-09-01T07:28:42Z</dc:date>
    </item>
  </channel>
</rss>

