home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!cs.utexas.edu!sdd.hp.com!spool.mu.edu!sol.ctr.columbia.edu!ira.uka.de!math.fu-berlin.de!unidui!Germany.EU.net!mcsun!sunic!lunic!my!sm-emac15.sm.luth.se!matti
- From: matti@my.sm.luth.se (Matti Larborn)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Think Pascal - Whats the latest version ?
- Message-ID: <1353@my.sm.luth.se>
- Date: 18 Nov 92 10:00:42 GMT
- References: <6746@m1.cs.man.ac.uk>
- Sender: news@sm.luth.se
- Organization: Lule} University
- Lines: 42
- X-UserAgent: Nuntius v1.1.1d11
- X-XXMessage-ID: <A72FD2D8C302037B@sm-emac15.sm.luth.se>
- X-XXDate: Wed, 18 Nov 92 10:00:40 GMT
-
- In article <1992Nov18.172004.12287@waikato.ac.nz> Lawrence D'Oliveiro,
- ldo@waikato.ac.nz writes:
- >Why bother? There are too many potential complications with this scheme:
- >
- >* What if you want the user to be able to read, but not write those
- fields?
- >* What if you want the user to be able to write those fields in a certain
- > restricted fashion to preserve certain relationships to the values in
- > other fields?
-
- If you want the user to be able to access or modify these fields you
- should have modifiers and accessors. In this way you can control what the
- user can do.
-
- If the data structure is visible the user can store whatever he likes
- into those fields!
-
- >* What if you later decide not to store that field, but compute it from
- > some other fields? Changing this would break existing clients.
-
- If you change the field or remove it, it shouldn't be of so much
- importance and therefore unreferenced, or with few references to it. The
- changes wouldn't be so big. Otherwise if you change an important field
- you change the behavior of the whole object and in this case I wonder
- what you where doing in the first place.
-
- With good data abstraction the client shouldn't know anything about the
- implementation and therefore it should be possible to change the
- implementation whenever you want.
-
- >A simpler and more general approach is to define accessor procedures and
- >functions. These can enforce any constraints you like. And they don't
- need
- >a new language feature!
-
- Yes, but these doesn't prevent you from accessing the data directly!
- (Without using your accessors)
-
- --Matti Larborn, Sweden.
-
-
- ----- More security to the data! -----
-