Refactoring Composite to Visitor and Inverse Transformation in Java
The authors describe how to use refactoring tools to transform a Java program conforming to the Composite design pattern into a program conforming to the Visitor design pattern with the same external behavior. They also describe the inverse transformation. They use the refactoring tools provided by IntelliJ idea and Eclipse. Composite and Visitor patterns have dual properties with respect to modularity: while the Composite pattern (as well as the Interpreter pattern and classic class hierarchies) provides modularity along subtypes and leaves operation definitions crosscut, the Visitor pattern provides modularity along operations and leaves behavior definitions crosscutting with respect to subtypes.