Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!usc!wuarchive!uunet!mcsun!hp4nl!targon!ruud From: ruud@targon.UUCP (Ruud Harmsen) Newsgroups: comp.lang.c++ Subject: Re: object-oriented design (was Re: are 'friend's really necessary ??) Message-ID: <1114@targon.UUCP> Date: 5 Apr 90 09:59:06 GMT References: <169@pollux.kulcs.uucp> <10589@alice.UUCP> <1082@targon.UUCP> <1110@targon.UUCP> <4593@pegasus.ATT.COM> Reply-To: ruud@targon.UUCP (Ruud Harmsen) Organization: Nixdorf Computer BV., SWP, P.O. Box 29,Vianen, The Netherlands Lines: 35 In article <4593@pegasus.ATT.COM> psrc@pegasus.ATT.COM (Paul S. R. Chisholm) writes: >I wrote: >> >A "thing" in this case may be a whole class. If you're careful, only a >> >few functions in class B (e.g., member function foo and static member >> >function bar) will need to know about the implementation of class A; in >> >which case, only B::foo and B::bar will need be friends of A. This is >> >a Good Thing; it specifically limits what software can mess with an A, >> >and what code must be looked at when the implementation of A changes. > I wrote: >> In theory, this is correct. But if in practice, in a particular >> application 70 to 80 percent *has* to mess with a class A, then you can't >> do very much limiting. > >Exactly right. That's the signature of a poor design. You have to >*try*, hard, to hide the implementation of your data types. Twenty >years of programming have taught me that it's worth the effort. Lots >of other believe it, too. I really hope you, and the other believers, are right. But I'm not convinced. I don't think the trouble is in bad design, I think it's in the nature of things. The world simply isn't simple, cannot be forced into strict hierarchical models (remember hierachical databases, how much trouble they cause(d) in designing a system?), and any design method that ignores or simplifies these facts, will eventually fail. But I am always willing to learn, and I will keep on trying to apply the theories, because I do believe the principles you mention are themselves useful, and will help a bit, only not as much as many people seem to think. >I'm not speaking for the company, I'm just speaking my mind. So am I. Ruud Harmsen.