Tag Archives: oo

Code Reuse

road

I’m reading Sandi Metz’s POODR book, and it is an invaluable resource for becoming a better OO programmer.

While many people are familiar with technical debt (the idea that you cut corners today to ship code today at the expense of the future), Sandi Metz brings up code reuse as another example of code written today that affects the quality of your future code.

From POODR, page 31:

Other programmers will reuse the methods instead of duplicating the code. They will follow the pattern you have established and create small, reusable methods in turn. This coding style propagates itself.

While you should always be striving to write good code, code reuse means that your code sets an example for future developers working in your code base. Your code today acts as a guidebook for future visitors showing what is acceptable practice. Your code patterns today will propagate throughout your future code base.

What does this mean? Well, Captain Obvious, it means the code you write today will impact your future codebase in countless ways.