IDEAS home Printed from https://ideas.repec.org/a/prg/jnlaip/v2016y2016i1id83p34-45.html
   My bibliography  Save this article

A Solution to the Square-Rectangle Problem Within the Framework of Object Morphology

Author

Listed:
  • Zbyněk Šlajchrt

Abstract

The square-rectangle problem is often cited as an illustration of pitfalls arising when using object-oriented programming (OOP). A number of solutions have been proposed, however, according to the author, none of them solve the problem satisfactorily, mainly because they tackle the problem from within the current OOP paradigm. This paper presents another solution stemming from object morphology (OM), a new object-oriented paradigm developed to model mutable phenomena. In the framework of OM the problem can be solved directly under the basic OM principle that an object may mutate not only with regard to its state, but also with regard to its type. The main contrast between the presented and the other solutions is that constraint violations caused by changes in an object's state are no longer necessarily considered errors; instead, they may be interpreted as triggers initiating a mutation of the object's type. The solution is demonstrated using Morpheus, a proof-of-concept implementation of OM in Scala.

Suggested Citation

  • Zbyněk Šlajchrt, 2016. "A Solution to the Square-Rectangle Problem Within the Framework of Object Morphology," Acta Informatica Pragensia, Prague University of Economics and Business, vol. 2016(1), pages 34-45.
  • Handle: RePEc:prg:jnlaip:v:2016:y:2016:i:1:id:83:p:34-45
    DOI: 10.18267/j.aip.83
    as

    Download full text from publisher

    File URL: http://aip.vse.cz/doi/10.18267/j.aip.83.html
    Download Restriction: free of charge

    File URL: http://aip.vse.cz/doi/10.18267/j.aip.83.pdf
    Download Restriction: free of charge

    File URL: https://libkey.io/10.18267/j.aip.83?utm_source=ideas
    LibKey link: if access is restricted and if your library uses this service, LibKey will redirect you to where you can use your library subscription to access this item
    ---><---

    As the access to this document is restricted, you may want to search for a different version of it.

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:prg:jnlaip:v:2016:y:2016:i:1:id:83:p:34-45. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    We have no bibliographic references for this item. You can help adding them by using this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: Stanislav Vojir (email available below). General contact details of provider: https://edirc.repec.org/data/uevsecz.html .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.