From: Marc Merlin Date: 2004-12-30T13:26:44+09:00 Subject: Re: #send and private methods I find that my sympathies lie with the original poster (Brain Palmer) with regard to Object#send bypassing conventional access controls, although I do agree that the rationales presented by the other responders are more than likely historically accurate. What I mean is this. Private access designation, although an artifact of OO methodology, serves a much broader role. It is a mechanism for allowing a programmer to organize his or her implementation while explicitly noting that certain details of the implementation are subject to change. It is way of saying that such details should not be relied upon by clients of the implementation. Why? To put it simply, it is a way of saying "these things may behave differently or be entirely absent in future releases of this component." Although I agree that programming languages should be "enabling" in that they should promote creative problem-solving and although I agree that "adult" programmers accept the responsibility of bypassing the constraints imposed upon them by the structure of the programming languages that they use, the fact of the matter is that it is not necessarily the creative and mature programmer who suffers the consequences of having taken such liberties with access control. Sadly, other programmers - and ultimately end users - who rely on the integrity of complex software systems to continue to function properly in spite of ongoing revision are the ones likely to be injured when access controls are disregarded. In other words, information hiding is a way of making software systems resilient in the face of change. It is not simply a way "nanny" programming languages try to keep "top-gun" programmers from getting their job done. Of course, for small projects with a restricted user base these constraints hardly matter. If Ruby were intended to be only a prototyping tool, then bypassing access controls would be no big deal. But Ruby apparently is on the way to being adopted as a bona fide progamming-language-in-the-large, as evidenced by such trailblazing projects as the Rails framework. (I certainly hope so!) Consequently I think that the adherence to a rigorous informtation hiding schema should be taken seriously and mechanisms to bypass it should be brought into question. - Marc Merlin