Enabling View-based Programming with SCROLL: Using roles and dynamic dispatch for etablishing view-based programming

Present-day software systems have to fulfill an increasing number of requirements rendering them more and more complex. Many systems need to anticipate changing contexts (self-adaptive systems) or need to adapt to changing business rules or requirements (self-optimizing systems). The challenge of 21th century software development will be to cope with these aspects. We believe that the role concept offers a simple way to adapt object-oriented programs to their changing contexts. In a role-based language, an object plays multiple roles during its lifetime. If the contexts are represented as first-class entities, they provide dynamic views to the object-oriented program, and if the context changes, the dynamic views can be switched easily, and the software system adapts automatically. However, the concepts of roles and dynamic contexts have been discussed for a long time in many areas of computer science. So far, their implementation in an existing object-oriented language requires a specific runtime environment. Also, classical object-oriented languages and their runtime systems are not able to cope with essential role-specific features, such as true delegation or dynamic binding of roles. As a solution, this work presents a simple implementation pattern for role-based objects that does not require a specific runtime system, SCROLL (SCala ROles Language). The implementation pattern is demonstrated on the basis of the Scala language. As technical support from Scala, the pattern requires dynamic mixins, compiler-translated function calls, and implicit conversions. The implementation details of the pattern are hidden in a Scala library and therefore transparent to Scala programmers. The SCROLL library supports roles embedded in structured contexts, so-called compartments. We show that they are specific, hierarchic runtime views, which enables hierarchic view-based programming for free in Scala. We also discuss how to apply the implementation pattern of SCROLL for other languages, in particular for behavioral modeling languages in MDSD. This discussion shows that the SCROLL pattern can be embedded into the generated code, so that it still is hidden to the developer, but does not require a specific runtime system. Using the pattern in model-driven code generation enables dynamic views for all kinds of modeling languages. And therefore, this paper shows a way how to realize dynamic views for all modeling languages in MDSD.

[1]  Uwe Aßmann,et al.  A Metamodel Family for Role-Based Modeling and Programming Languages , 2014, SLE.

[2]  Terry A. Halpin,et al.  Orm 2 , 2005, OTM Workshops.

[3]  Giancarlo Guizzardi,et al.  Relational roles and qua-individuals , 2005, AAAI 2005.

[4]  Fernando Sérgio Barbosa,et al.  Modeling and Programming with Roles: Introducing JavaStage , 2012, SoMeT.

[5]  G. Guizzardi,et al.  Tutorial: Conceptual simulation modeling with Onto-UML , 2012, Proceedings Title: Proceedings of the 2012 Winter Simulation Conference (WSC).

[6]  Uwe Aßmann,et al.  Invasive Software Composition , 2003, Springer Berlin Heidelberg.

[7]  Guido Boella,et al.  An implementation of roles as affordances: powerJava , 2007, WOA.

[8]  MengChu Zhou,et al.  Role-based collaboration and its kernel mechanisms , 2006, IEEE Transactions on Systems, Man, and Cybernetics, Part C (Applications and Reviews).

[9]  Mengchi Liu,et al.  Information Networking Model , 2009, ER.

[10]  Stephan Murer,et al.  Managed Evolution , 2008, Informatik-Spektrum.

[11]  Guido Boella,et al.  The ontological properties of social roles in multi-agent systems: definitional dependence, powers and roles playing roles , 2007, Artificial Intelligence and Law.

[12]  Stephan Herrmann Programming with Roles in ObjectTeams/Java , 2005 .

[13]  Patrick Th. Eugster,et al.  A Relational Model of Object Collaborations and Its Use in Reasoning About Relationships , 2007, ECOOP.

[14]  Nicola Guarino,et al.  An Overview of OntoClean , 2004, Handbook on Ontologies.

[15]  Keqing He,et al.  Rava: designing a Java extension with dynamic object roles , 2006, 13th Annual IEEE International Symposium and Workshop on Engineering of Computer-Based Systems (ECBS'06).

[16]  Guido Boella,et al.  powerJava: ontologically founded roles in object oriented programming languages , 2006, SAC '06.

[17]  Tetsuo Tamai,et al.  A Smooth Combination of Role-based Language and Context Activation , 2010 .

[18]  Stephan Herrmann,et al.  Demystifying object schizophrenia , 2010 .

[19]  Charles W. Bachman,et al.  The Role Concept in Data Models , 1977, VLDB.

[20]  K. Graversen,et al.  Implementation of a Role Language for Object-Specific Dynamic Separation of Concerns , 2003 .

[21]  Gavin M. Bierman,et al.  First-Class Relationships in an Object-Oriented Language , 2005, ECOOP.

[22]  Anind K. Dey,et al.  Understanding and Using Context , 2001, Personal and Ubiquitous Computing.

[23]  Uwe Aßmann,et al.  Using Role-Based Composition to Support Unanticipated , Dynamic Adaptation-Smart Application Grids , 2012 .

[24]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[25]  Valerio Genovese A Meta-model for Roles: Introducing Sessions , 2007 .

[26]  Guido Boella,et al.  Roles as a Coordination Construct: Introducing powerJava , 2006, MTCoord@COORDINATION.

[27]  Ivar Jacobson,et al.  The unified modeling language reference manual , 2010 .

[28]  Thomas R. Gross,et al.  Relations: Abstracting object collaborations , 2011 .

[29]  Mengchi Liu,et al.  Modeling context-dependent information , 2009, CIKM.

[30]  Terry Halpin,et al.  Object-Role Modeling (ORM/NIAM) , 2006, Handbook on Architectures of Information Systems.

[31]  Yannis Smaragdakis,et al.  Implementing Layered Designs with Mixin Layers , 1998, ECOOP.

[32]  Friedrich Steimann,et al.  On the representation of roles in object-oriented and conceptual modelling , 2000, Data Knowl. Eng..

[33]  Mengchi Liu,et al.  Modeling Complex Relationships , 2009, DEXA.

[34]  Rolf Hennicker,et al.  Foundations for Ensemble Modeling - The Helena Approach - Handling Massively Distributed Systems with ELaborate ENsemble Architectures , 2014, Specification, Algebra, and Software.

[35]  Gerd Wagner,et al.  Conceptual simulation modeling with onto-UML , 2012, WSC.

[36]  Dirk Riehle,et al.  The Role Object Pattern , 1997 .

[37]  Alain Pirotte,et al.  A Generic Role Model for Dynamic Objects , 2002, CAiSE.

[38]  Martin Odersky,et al.  Scala Roles: Reusable Object Collaborations in a Library , 2008, ICSOFT.

[39]  S. Monpratarnchai,et al.  The design and implementation of a role model based language, EpsilonJ , 2008, 2008 5th International Conference on Electrical Engineering/Electronics, Computer, Telecommunications and Information Technology.

[40]  Stephan Herrmann,et al.  A precise model for contextual roles: The programming language ObjectTeams/Java , 2007, Appl. Ontology.

[41]  Tetsuo Tamai,et al.  Towards safe and flexible object adaptation , 2009, COP@ECOOP.