DEV Community

Discussion on: What Are Your Strategies for Enhancing Code Reusability & Maintainability?

Collapse
 
lexlohr profile image
Alex Lohr

The most reusable code is the one that simplifies one complex operation required in multiple places, striking a balance between abstraction and specificity.

Maintainable code is easy to understand and to change: functions, arguments and variables are aptly named. Only if the reasoning behind the functionality is not obvious, it should be added as comment. The code is automatically tested, so that changes cannot break the functionality undiscovered.