Please don't make classes final. I hate when I just want to extend some class to have an extra tiny bit of functionality, but I can't because the author either made it final or made some members private when they could have been protected. Android is the worst at this. So many useful widgets and gesture detectors and what not, all having to be copy/pasted if you want to improve them at all.
There are times when you can't just wrap the code with some decorator to fix internal behavior.
So you have to go and copy the whole library into your project and make the tiny bits of changes that 'd be easily done if they were at least package-visible or protected, or the class weren't final.
Flow was the most annoying at this, I had to copy both Flow 0.12 back in the day, and also Flow 1.0-alpha into my project initially to fix its bugs, because most of its stuff just can't be fixed from the outside. Well, technically copying it and then putting it in a forked Github repository was the easiest solution, so there's that.
If the thing is fixing internal bugs, then that's how you should be doing it. Then send the fix to the maintainer. Don't subclass to fix behavior, as someone new to the project won't have any idea that you're using MyBaseClass instead of the one the library provides.
7
u/Phreakhead Nov 26 '16
Please don't make classes final. I hate when I just want to extend some class to have an extra tiny bit of functionality, but I can't because the author either made it final or made some members private when they could have been protected. Android is the worst at this. So many useful widgets and gesture detectors and what not, all having to be copy/pasted if you want to improve them at all.