Over a million developers have joined DZone.

Using Private and Final In Open Source Software

DZone's Guide to

Using Private and Final In Open Source Software

· DevOps Zone
Free Resource

The Nexus Suite is uniquely architected for a DevOps native world and creates value early in the development pipeline, provides precise contextual controls at every phase, and accelerates DevOps innovation with automation you can trust. Read how in this ebook.

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 andfinal 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.

The DevOps Zone is brought to you in partnership with Sonatype Nexus.  See how the Nexus platform infuses precise open source component intelligence into the DevOps pipeline early, everywhere, and at scale. Read how in this ebook


Published at DZone with permission of Matt Farina, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}