Subscribe

Rules of Programming: Leave Your Code Open To Change

To be open is a good thing. To leave code open to change is a better thing.

It should be easy to extend existing functionality, without breaking it.

It is trickier than it sounds though. But don't be scared!

To write code that is open to change, you should basically make it possible to inherit and override existing classes and methods. This way you don't have to think of broken functionality, you don't have to deal with re-writing tests for the existing code - since you've not touched the existing code. It'll make it easier to focus at your new code and your new tests. Full of win!

Rule #15 of programming:

Leave your code open to change

Write a comment





Or use Twitter to identify


To the top