home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / objectiv / 516 < prev    next >
Encoding:
Internet Message Format  |  1992-09-03  |  3.2 KB

  1. Path: sparky!uunet!stanford.edu!bcm!aio!shirley
  2. From: shirley@fdr.jsc.nasa.gov (Bill Shirley [CSC])
  3. Newsgroups: comp.lang.objective-c
  4. Subject: Re: instance variable declarations..
  5. Message-ID: <1992Sep3.091617@fdr.jsc.nasa.gov>
  6. Date: 3 Sep 1992 14:16:17 GMT
  7. References: <MAS.92Aug30121306@csa.bu.edu> <19385@ector.cs.purdue.edu> <1992Sep2.045715.5803@panix.com> <1992Sep3.020352.1872@almserv.uucp>
  8. Sender: shirley@fdr (Bill Shirley [CSC])
  9. Organization: Software Technology Branch - NASA/JSC
  10. Lines: 67
  11. Originator: shirley@fdr
  12.  
  13.  
  14. In article <1992Sep3.020352.1872@almserv.uucp>, bnixon@fnma.com (Bill Nixon) writes:
  15. > Just my two cents:
  16. > It seems to me that declaring instance variables in an object's
  17. > interface file somewhat breaks the idea of encapsulation and
  18.  
  19. /breaks/ is much to harsh a word.  I can't just include Class.h and
  20. go about modifying it's IVs.
  21.  
  22. > abstraction that object-oriented languages should provide.
  23. > What I have seen done in other language specifications, most recently
  24. > OS/2 SOM, is to provide three interface files (.h) for an object:
  25.  
  26. I think you meant 3 files - 2 interface files.
  27.  
  28. > + public - which has all public instance variables and methods.
  29. > Everything defined in this file is directly accessible, even instance
  30. > variables.  This and the "compiled" code for the object is all an
  31. > object user needs to have.
  32. > + private - which has all private instance variables and methods.
  33. > All instance variables and methods declared in this file are limited
  34. > in scope and cannot be directly accessed.  (Normally this is also
  35. > the source file which contains all the code for the methods).
  36.  
  37. this is basically the source file, correct?  (.c/.m)
  38.  
  39. > + class - which has all instance variables and methods which can
  40. > be modified via inheritance.  An object subclasser would require
  41. > this file along with the "compiled" code in order to write a subclass of
  42. > the object.
  43. > I am more comfortable living in a private and public environment.
  44. > Basically only put "need to know" data (methods and maybe a few
  45. > instance variables) in the public interface file.  Since most instance
  46. > variables should be private to provide true data abstraction, they would
  47. > not be exposed and this may provide a simplier and "safer" view of the
  48. > object.
  49.  
  50. I agree that most IVs should be treated as private by subclassers, but
  51. I don't favor enforcing this via extra files, this could be more of a
  52. bookkeeping hassle.  Use of the @public, @private, etc.. would be just
  53. as affective and let you see it (and write it) all in one eyeshot.
  54. (I also don't know for sure whether these are still supported, but I
  55.  suspect they are.)
  56.  
  57. I don't think the code not knowing of the implementation should necessarily
  58. imply that the programmer isn't knowledgeable of the implementation.
  59.  
  60. > Bill
  61. > -- 
  62. > email: bnixon@fnma.com (NeXT Mail Okay)
  63. > Bill Nixon, Senior Programmer Analyst, Advanced Technology
  64. > FannieMae, 3900 Wisconsin Ave NW, Washington, DC 22016     (202) 752-5468
  65.  
  66. -- 
  67. Bill Shirley        |  ``Computer Science is not about computers any 
  68. shirley@fdr.jsc.nasa.gov|    more than astronomy is about telescopes.''
  69.  
  70. -- 
  71. Bill Shirley        |  ``Computer Science is not about computers any 
  72. shirley@fdr.jsc.nasa.gov|    more than astronomy is about telescopes.''
  73.