Using Private and Final In Open Source Software

In recent months I’ve seen an increase in the use of private and final keywords used in open source software projects. While I’m not opposed to the use of these in writing software, I’ve noticed a disturbing trend in the reasoning to use them.

Since I started using and contributing to open source software, more years ago than I care to admit to myself, I’ve noticed one amazing thing. Software is used to build useful things the original authors didn’t envision in ways the authors didn’t foresee. This is an important concept to remember.

The only way one can know or imagine all the ways a piece of open source software could be used is to peek into the future and know what’s happening in the minds of everyone. Can you do that? No… me either.

With that in mind, the use of private and final in software limits the ways software can be used. This is can be useful. If there is a design decision for a good clearly articulated reason not to allow a class to be extended than this makes sense.

If, on the other hand, there isn’t a clear reason to make the design decision to use private and final than don’t use them. By not using them you leave the possibility open for others to do things you couldn’t imagine but they could.

This is about enabling others to be successful using what you’ve open sourced.