How the Factory Method designpattern affect software maintainabilityand structural code quality in Java-based systems : An experimental study on self-made Java systems

Samuel Tolliner · KTH Publication Database DiVA (KTH Royal Institute of Technology) · 2026

Software systems and software development are continuing to evolve and as a result require frequent updates, bug fixes, and additional features. Therefore, the need for software maintainability has become a critical aspect of system longevity. There are many proposed approaches to improve the maintainability of systems, and one commonly proposed solution is the use of design patterns. Therefore, the thesis examines the impact of the Factory Method design pattern on software maintainability and structural code quality in Java systems. The thesis uses a quantitative experimental approach where two functionally equivalent implementations were developed, one implementing the Factory Method design pattern and one using direct instantiation. The aim of the thesis is to examine how the Factory Method design pattern affects key maintainability metrics and how it affects modularity and extensibility of systems. To answer these questions, both implementations of the system were evaluated using established structural code quality metrics. The metrics were gathered using static analysis tools. The system was also extended with additional classes, after which new metrics were gathered. These metrics were then analyzed to determine the impact that the Factory Method design pattern had on the maintainability and extensibility of the system. The results suggested that the use of the Factory Method design pattern does have a positive impact on the complexity of the system, while coupling increases. The results show that while the Factory Method design pattern can contribute to improved maintainability,modularity, and extensibility, it does come with a trade-off. To conclude, whether the use of the Factor Method design pattern does have a positive impact on maintainability and structural code quality is dependent on its implementation and context, the pattern does come with trade-offs and therefore highlights the importance of careful design decisions. The small-scale nature of the system used in this thesis may also limit the generalization of the results from the thesis.

Read the paper · More papers on PaperTik