Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about "data hiding" OOP paradigm issue


  • From: Cedric.Beust@xxxxxxx (Cedric Beust)
  • Subject: Question about "data hiding" OOP paradigm issue
  • Date: Thu, 30 Mar 2000 14:24:29 -0800

> From: Michael Brundage [mailto:michaelb@xxxxxxxxxxxxx]

> Note, however, that methods receiving the ConstMyClass object can still
> attempt to downcast to the mutable MyClass and then perform the nonconst
> operation.

People who do that deserve whatever they get :-)

More seriously, I am a trusting kind of a guy and I tend to think that a
developer is a reasonable person who knows what they are doing and I personally
feel quite angry when someone doesn't return the favor to me (e.g. by declaring
their methods final).

Sometimes, a user might have a very good reason to "cast away const" and you
shouldn't make it nearly impossible for them to do so (you can find another
justification of this leniency in the fact that C++ allows both const_cast<>
and the "mutable" keyword).

Don't try to protect people from their mistakes, it's an uphill battle. And it
will upset good programmers.

--
Cedric
http://beust.com/cedric


---
To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx