Wednesday, August 8, 2007

Don't use 'private' EVER!!!

I HATE PRIVATE VARIABLES: THEY ARE LAZY AND DOOMED TO IRRITATE

I see a bug that I could fix by extending something and adding a line of code. But that would be easy and solve the problem so instead I have to copy the source code, create the same package and class name, make sure my fixed version is ahead of the bad version in the class path and then fix my bug in the copied code.

What value did 'private' just provide? NONE! It just added a bunch of work for me to do. Had they simply used default access I could have done as I pleased and not had to worry about it. protected would have been ok too. But no, private makes people feel 'cool' and 'secure' when in fact they've done nothing but irritate people using their api.

If you type private, you are wrong! I don't care if you've got good reasons, they're wrong too!
:P

No comments: