Micro Patterns in Java Code
San Diego Room
Tuesday, 14:30, 30 minutes
Joseph (Yossi) Gil, Technion-Israel Institute of Technology
Itay Maman, Technion-Israel Institute of Technology
Micro patterns are similar to design patterns, except they are mechanically recognizable and stand at a lower, closer to the implementation, level of abstraction. Each pattern can be written as a simple formal condition on the class structure. This paper presents a catalog of 27 micro-patterns defined on Java on Java classes and interfaces. The catalog captures a wide spectrum of common programming practices, including a particular and (intentionally restricted) use of inheritance, immutability, data management and wrapping, restricted creation, and emulation of procedural-, modular- and even functional-programming paradigms in object oriented programming. Together, the patterns present a set of prototypes after which about 75% of all Java classes and interfaces are modeled.
A statistical analysis of occurrences of micro patterns in a large data set, spanning some 70,000 Java classes drawn from a rich set of application domains, shows, with high confidence level that the use of these patterns reflects consciousness and discernible design decisions, which is sustained in the software evolution. With high confidence level, we can also show that the use of these patterns is tied to the specification, or the purpose, that the software realizes. The traceability, abundance and the statistical significance of micro pattern occurrence raises the hope of using the classification of software into these patterns for a more founded appreciation of its design and code quality.