The Infer Type Refactoring and its Use for Interface-Based Programming

Interface-based programming, i.e. the systematic use of interface types in variable declarations, serves the decoupling of classes and increases a program’s changeability. To maximize this effect, interfaces should contain as few elements as possible. For the design of minimal (i.e., maximally general) interfaces, an in-depth analysis of the protocol needed from objects in a given context is required. However, currently available refactorings for the creation of such interfaces (such as Extract Interface) leave programmers alone with the decision what to include or, more importantly, what to omit: they let them choose manually from the protocol of a class, and only then offer the use of the new interface where (if) possible. To end this trial and error process, we have developed a new refactoring named Infer Type that, using type inference, completely automates the construction of new, context-specific interfaces and their use in variable declarations, thus supporting greater decoupling and access protection of code, serving the goals of interface-based programming.

[1]  David Grove,et al.  Optimization of Object-Oriented Programs Using Static Class Hierarchy Analysis , 1995, ECOOP.

[2]  Ralph E. Johnson,et al.  Creating abstract superclasses by refactoring , 1993, CSC '93.

[3]  Friedrich Steimann,et al.  Interface utilization in the Java Development Kit , 2004, SAC '04.

[4]  Dhananjay M. Dhamdhere,et al.  Bidirectional data flow analysis for type inferencing , 2003, Comput. Lang. Syst. Struct..

[5]  Don Box,et al.  Programming Distributed Applications with Com+ and Microsoft Visual Basic 6.0, Second Edition , 2000 .

[6]  Gregor Snelting,et al.  Refactoring class hierarchies with KABA , 2004, OOPSLA '04.

[7]  William R. Cook,et al.  Interfaces for strongly-typed object-oriented programming , 1989, OOPSLA '89.

[8]  Bowen Alpern,et al.  Efficient implementation of Java interfaces: Invokeinterface considered harmless , 2001, OOPSLA '01.

[9]  Frank Tip,et al.  Understanding class hierarchies using concept analysis , 2000, TOPL.

[10]  Chris F. Kemerer,et al.  A Metrics Suite for Object Oriented Design , 2015, IEEE Trans. Software Eng..

[11]  Gerald Baumgartner,et al.  Safe Structural Conformance for Java , 2000, Comput. J..

[12]  Scott F. Smith,et al.  Precise Constraint-Based Type Inference for Java , 2001, ECOOP.

[13]  H. D. Rombach,et al.  The Goal Question Metric Approach , 1994 .

[14]  Brian Henderson-Sellers,et al.  Object-Oriented Metrics , 1995, TOOLS.

[15]  Frank Tip,et al.  Class hierarchy specialization , 2000, Acta Informatica.

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

[17]  Frank Tip,et al.  Practical extraction techniques for Java , 2002, TOPL.

[18]  Friedrich Steimann,et al.  Patterns of Interface-Based Programming , 2005, J. Object Technol..

[19]  M. Fowler Improving the Design of Existing Code , 2000 .

[20]  Florian Forster,et al.  Cost and benefit of rigorous decoupling with context-specific interfaces , 2006, PPPJ '06.

[21]  Jens Palsberg,et al.  Object-oriented type inference , 1991, OOPSLA 1991.

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

[23]  Friedrich Steimann,et al.  Towards the systematic use of interfaces in JAVA programming , 2003, PPPJ.