Automated Verification of Open/Closed Principle: A Code Analysis Approach

Gifty Roy, M. Manohar, Benjamin A. Jacob · 2024

The SOLID principles are foundational to software engineering, focusing on the maintainability, scalability, and extensibility of software systems. The Open/Closed Principle (OCP), a pivotal element among these principles, underscores the need to design software modules that are open for extension yet closed for modification. This research explores automated verification techniques for OCP, addressing the validation of software modules through extensibility and adaptability assessments. The principal objectives involve the development of a code analysis approach and a methodology capable of automating the verification of adherence to OCP in developed codes, providing actionable insights to software developers. The system focuses on specific aspects of OCP, including inheritance, abstraction, and polymorphism, and aims to provide clear indications of where violations occur within a codebase. The implementation uses the Abstract Syntax Tree (AST) analysis to examine class definitions. The automated analysis of Python code using the defined rules offers a clear understanding of OCP adherence. Results are presented in Pandas DataFrames, indicating potential violations and providing developers with actionable insights to enhance code quality and maintainability. Overall, the automated code verification system aims to enhance code quality and adherence to fundamental design principles, paving the way for advancements in automated code analysis and software engineering practices.

Read the paper · More papers on PaperTik