The Generalized Open-Closed Principle
The open closed principle of Object Oriented Programming (OOP) states that classes should be open to extension but closed to modification, but I find this principle to have more applicability than to just OOP. The Generalized Open-Closed Principle states that units of software should allow for flexibility of reuse in unexpected applications, but should not allow for direct modification which would alter how that unit operates throughout the software.
Openness of reuse creates a gradual but eventual explosion of functionality for a program. If a text search function can be reused in many different applications, than a new application may implement text search with less effort than if the text search was application specific.
Being closed to modification protects a program from unexpected regressions, which, by proxy, further bolsters the reusability of a unit of code by boosting confidence that it won’t cause future harm. Say the core text search function was updated to add a new wildcard feature, “The * ran”. If this new feature accidentally altered the results of existing use cases this could break code accross the program.
To maximize reusability of software, you should build softare to maximize its utility without relying on modification which could alter the results of existing use.