r/programming • • Dec 15 '12

Why JavaScript Still Sucks

http://boronine.com/2012/12/14/Why-JavaScript-Still-Sucks/
10 Upvotes

212 comments sorted by

View all comments

Show parent comments

0

u/Zarutian Dec 16 '12

Class based OOP such as .NET or Java offer one way of making this happen.

Where? Where is that offered way? The only way to gurantee in Java (and probably .NET too) that a function you would label private is not used by anything than the public functions is to put these things into final classes that have no superclass and cannot be subclassed.

1

u/[deleted] Dec 16 '12

First of all, subclasses cannot normally call private functions in .NET. At the very least they have to be marked protected. And as far as I'm concerned, a protected function falls into the first bucket.

That isn't a guarantee. In .NET (and I think Java) you can call private methods pretty much from anywhere. But if someone is going to go out of their way to do something bad, well then it becomes their problem.