Visualizing Generalizations Rylan Cottrell
Generalization Contains common pieces from the original two source code fragments. Abstract the code fragments that are not in agreement using new variables. public void m1(Object obj) { print obj; } public void m2(Object o) { print o; } public void X 1 (Object X 2 ) { print X 2 ; } Generalization
Why Generalizations? Frameworks, libraries and modules help developers harness existing functionality. Small changes can have huge impact. Understanding the commonalties and differences between the uses is important to making any changes.
Problem Generalizing just 5 uses.