Path: utzoo!attcan!uunet!mcvax!enea!kth!draken!Urd!newsuser From: newsuser@LTH.Se (LTH network news server) Newsgroups: comp.lang.c++ Subject: Re: Friend specifier considered harmful Message-ID: <1988Sep15.113208.21989@LTH.Se> Date: 15 Sep 88 10:32:08 GMT References: <61@cybaswan.UUCP> <1988Sep2.094800.16353@LTH.Se> <77@cybaswan.UUCP> Reply-To: dag@Control.LTH.Se (Dag Bruck) Organization: Dept. of Automatic Control, Lund Inst. of Technology, Sweden Lines: 50 In article <77@cybaswan.UUCP> eeartym@cybaswan.UUCP (Dr R.Artym eleceng ) writes: >In article <1988Sep2.094800.16353@LTH.Se> dag@Control.LTH.Se (Dag Bruck) >writes: > >> I have seen many Modula-2 and Ada >> programs where the writer has been "forced" to use very large modules >> because of too strict encapsulation. > >Maybe this stemmed from lack of inheritance. Why do you say strict >encapsulation is to blame? Yes, object-oriented programming may be the best way to get a well-engineered program. I still think that some ``escape'' mechanism would improve Modula-2 and Ada programs, but probably not to the degree where I will drop C++ (:-). >> No, but I think my programs have improved by the use of a few friend >> functions and classes. > >Can you supply any details? The ``real'' work I do is too complicated to discuss in detail on the net, but I will give an example in general terms: In our application, my C++ program maintains a network of objects for representing control system models. As a typical example, the routine for connecting two components of a block diagram needs access to some internal information of so called terminals. This is really just an internal check to handle the special case of connecting to an undefined enclosing environment (in the case of bottom-up development). >> Should we start a discussion of GOOD >> design of classes? >This would be a very worthwhile endeavour. I will try to come up with a few topics in class design, but I'm sure there are more competent and experienced people on the net. I hope there will be time for discussion at the USENIX C++ Conference in Denver, CO. Dag Bruck -- Department of Automatic Control Internet: dag@control.lth.se Lund Institute of Technology UUCP: ...!enea!control.lth.se!dag P. O. Box 118 S-221 00 Lund, SWEDEN Phone: +46 46-108779