{"id":3511,"date":"2024-02-12T21:49:46","date_gmt":"2024-02-12T20:49:46","guid":{"rendered":"https:\/\/oopm.org\/?page_id=3511"},"modified":"2025-01-24T17:33:46","modified_gmt":"2025-01-24T16:33:46","slug":"46-aspects","status":"publish","type":"page","link":"https:\/\/oopm.org\/?page_id=3511","title":{"rendered":"18. Aspects"},"content":{"rendered":"<div class=\"pdfprnt-buttons pdfprnt-buttons-page pdfprnt-top-right\"><a href=\"https:\/\/oopm.org\/index.php?rest_route=wpv2pages3511&print=pdf\" class=\"pdfprnt-button pdfprnt-button-pdf\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/oopm.org\/wp-content\/plugins\/pdf-print\/images\/pdf.png\" alt=\"image_pdf\" title=\"View PDF\" \/><\/a><a href=\"https:\/\/oopm.org\/index.php?rest_route=wpv2pages3511&print=print\" class=\"pdfprnt-button pdfprnt-button-print\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/oopm.org\/wp-content\/plugins\/pdf-print\/images\/print.png\" alt=\"image_print\" title=\"Print Content\" \/><\/a><\/div>\n<p class=\"wp-block-paragraph\">We have learned that the modeling of phenomena by means of objects represents properties in terms of e.g. data-items and methods, and we have learned how classes of objects represent the corresponding domain concepts. Specialization hierarchies are expressed by a class being a subclass of another (super) class. As an example the class <code>Customer<\/code> from before could have been defined as a subclass of a class <code>Person<\/code>, and <code>Person<\/code> would have a <code>name<\/code> attribute of type String.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>class<\/strong> Person:\n   name: <strong>var<\/strong> String\n\n<strong>class<\/strong> Customer: Person\n   addr: <strong>var<\/strong> String         \n   email: <strong>var<\/strong> String<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Altogether this model the situation that a customer <em>is<\/em> a person and that a customer <em>has<\/em> the properties represented by data-items and methods. A <code>Customer<\/code> object <em>is<\/em> a <code>Person<\/code> and it <em>has<\/em> the properties of <code>Person<\/code> <em>and<\/em> the properties defined in <code>Customer<\/code>. We have also seen that an object (<strong><code>obj<\/code><\/strong>) also may have a superclass.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this section, we will show how to model the situation where phenomena in addition to be classified (and thereby represented by a class) also have some aspects. An aspect is a set of properties that may readily be modelled by data-items, methods, and computations. Many phenomena may have the same aspects, and this calls for the definition of types of aspects. As an aspect may have the same properties as an object, types of aspects may be represented by classes. It will thereby also be possible to classes an subclasses of aspects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In most cases, classes with aspects will also be subclasses of classes from the domain, e.g. <code>Customer<\/code> being a subclass of <code>Person<\/code>. As we only have tree-structured classification by means of classes and subclasses, i.e. a class can only have one superclass, aspects come in play when a class in addition to a superclass also shall have the properties defined by one or more aspect classes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the following we will, by a number of examples, show how to <em>represent types of aspects by classes<\/em>, and to use <em>composition <\/em>to represent aspects of classes and objects. Composition means that an object with aspects simply has an intrinsic\/part object for each aspect. An aspect object is specified as an object of an aspect class or as a singular object with an aspect class as superclass.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A class like <code>Customer<\/code> may typically tailor the fact that it is a <code>Person<\/code>, by extending possible virtual methods of class <code>Person<\/code>. We will have the same need for aspects. An aspect may e.g. be that of being addressable. Different objects and classes may be addressable, and each of them may have a slightly different way of being addressable. We will therefore show how to tailor a general type of aspect to different objects and classes.<\/p>\n<div style=\"display:flex; gap:10px;justify-content:center\" class=\"wps-pgfw-pdf-generate-icon__wrapper-frontend\">\n\t\t<a  href=\"https:\/\/oopm.org?action=genpdf&amp;id=3511\" class=\"pgfw-single-pdf-download-button\" ><img src=\"https:\/\/oopm.org\/wp-content\/plugins\/pdf-generator-for-wp\/admin\/src\/images\/PDF_Tray.svg\" title=\"Generate PDF\" style=\"width:auto; height:45px;\"><\/a>\n\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>We have learned that the modeling of phenomena by means of objects represents properties in terms of e.g. data-items and methods, and we have learned how classes of objects represent the corresponding domain concepts. Specialization hierarchies are expressed by a class being a subclass of another (super) class. As an example the class Customer from [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":21,"menu_order":18,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-3511","page","type-page","status-publish","hentry"],"mb":[],"mfb_rest_fields":["title","gutenberg_elementor_mode"],"_links":{"self":[{"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/pages\/3511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oopm.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3511"}],"version-history":[{"count":135,"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/pages\/3511\/revisions"}],"predecessor-version":[{"id":11315,"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/pages\/3511\/revisions\/11315"}],"up":[{"embeddable":true,"href":"https:\/\/oopm.org\/index.php?rest_route=\/wp\/v2\/pages\/21"}],"wp:attachment":[{"href":"https:\/\/oopm.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}