cdot65 / pan-os-upgrade

An efficient tool to execute configuration backups, network state snapshots, system readiness checks, and operating system upgrades of Palo Alto Networks firewalls and Panorama appliances.
https://cdot65.github.io/pan-os-upgrade/
Apache License 2.0
39 stars 7 forks source link

Enhancement: Refactor Script Functions into Dedicated Class Objects for Improved Modularity and Maintainability #94

Closed cdot65 closed 5 months ago

cdot65 commented 5 months ago

Overview

This enhancement request proposes a significant refactor of our existing script functions into dedicated class objects. The aim is to improve code modularity, maintainability, and scalability by organizing related functionalities into cohesive units. The proposed class objects are as follows:

Rationale

Currently, our script consists of various standalone functions that, while functional, contribute to a monolithic codebase that can be challenging to maintain and extend. By transitioning these functions into dedicated class objects, we stand to gain several benefits:

Enhanced Modularity: Grouping related functions into classes will make the codebase more organized and navigable. This modularity facilitates easier understanding and modification of the code, especially for new contributors.

Improved Maintainability: With functionalities encapsulated within classes, maintaining the code becomes more straightforward. Updates, bug fixes, and enhancements can be managed more efficiently, with reduced risk of side effects.

Increased Reusability: Class objects allow for the reuse of code across different parts of the project without duplication. This not only reduces the overall code volume but also ensures consistency in functionality.

Scalability: As new requirements emerge, the class-based structure will accommodate additional functionalities with minimal disruption to the existing codebase. This scalability is crucial for adapting to future needs and integrations.

Better Testing: Class objects facilitate unit testing by providing a clear structure for mocking dependencies and isolating test cases. This leads to more robust and reliable code.

Proposed Class Objects:

Implementation Considerations

Conclusion

Refactoring our script functions into these dedicated class objects represents a strategic investment in the codebase's future. This reorganization will not only address current maintainability concerns but also lay a solid foundation for future enhancements and expansions. We invite feedback and contributions from all stakeholders as we undertake this significant improvement to our project's structure.