Refactoring to role objects

Role objects are a widely recognized design pattern for representing objects that expose different properties in different contexts. By developing a tool that automatically refactors legacy code towards this pattern and by applying this tool to several programs, we have found not only that refactoring to role objects as currently defined produces code that is hard to read and to maintain, but also that the refactoring has preconditions so strong that it is rarely applicable in practice. We have therefore taken a fresh look at role objects and devised an alternative form that solves the exact same design problems, yet is much simpler to introduce and to maintain. We describe refactoring to this new, lightweight form of role objects in informal terms and report on the implementation of our refactoring tool for the JAVA programming language, presenting evidence of the refactoring's increased applicability in several sample programs.

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

[2]  B. Pernici,et al.  Objects with roles , 1990, COCS '90.

[3]  Renzo Orsini,et al.  An Object Data Model with Roles , 1993, VLDB.

[4]  Friedrich Steimann,et al.  Role = Interface: A Merger of Concepts , 2001 .

[5]  William F. Opdyke,et al.  Refactoring object-oriented frameworks , 1992 .

[6]  William G. Griswold,et al.  Automated assistance for program restructuring , 1993, TSEM.

[7]  Edward Sciore,et al.  Object specialization , 1989, TOIS.

[8]  Emil Sekerinski,et al.  A Study of The Fragile Base Class Problem , 1998, ECOOP.

[9]  Martin Fowler,et al.  Dealing with Roles , 1997 .

[10]  Frank Tip,et al.  Refactoring for generalization using type constraints , 2003, OOPSLA '03.

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

[12]  Friedrich Steimann,et al.  The Infer Type Refactoring and its Use for Interface-Based Programming , 2007, J. Object Technol..

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

[14]  Lynn Andrea Stein,et al.  Delegation is inheritance , 1987, OOPSLA '87.

[15]  Michael Schrefl,et al.  Extending object-oriented systems with roles , 1996, TOIS.

[16]  Randall B. Smith,et al.  SELF: The power of simplicity , 1987, OOPSLA '87.

[17]  Henry Lieberman,et al.  Using prototypical objects to implement shared behavior in object-oriented systems , 1986, OOPLSA '86.

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

[19]  Guido Boella,et al.  Interaction between Objects in powerJava , 2007, J. Object Technol..

[20]  D. Janaki Ram,et al.  Object Schizophrenia Problem in Object Role System Design , 2002, OOIS.

[21]  Friedrich Steimann,et al.  Systematically refactoring inheritance to delegation in java , 2008, 2008 ACM/IEEE 30th International Conference on Software Engineering.

[22]  Joshua Kerievsky,et al.  Refactoring to Patterns , 2004, XP/Agile Universe.

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