home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.smalltalk
- Path: sparky!uunet!math.fu-berlin.de!ira.uka.de!scsing.switch.ch!univ-lyon1.fr!ghost.dsi.unimi.it!rpi!usc!cs.utexas.edu!torn!nott!cunews!cunews!knight
- From: knight@mrco.carleton.ca (Alan Knight)
- Subject: Re: get/set behaviour (was: >>Voluntary method typing)
- Message-ID: <knight.728224539@cunews>
- Sender: news@cunews.carleton.ca (News Administrator)
- Reply-To: knight@mrco.carleton.ca (Alan Knight)
- Organization: Carleton University
- References: <1993Jan27.001832.10017@cs.uow.edu.au> <1993Jan27.132905.3865@heeg.de> <knight.728144758@cunews> <1993Jan28.004755.1438@cs.uow.edu.au>
- Date: Thu, 28 Jan 1993 12:35:39 GMT
- Lines: 45
-
- In <1993Jan28.004755.1438@cs.uow.edu.au> humm@cs.uow.edu.au (Bernhard G Humm) writes:
-
- >No, you missed my point (and I didn't make it too clear I have to admit).
- >I am well aware that in an OO language methods can do more that get and
- >set internal variables, they can e.g. send messages to other objects. What
- >I want to say is:
-
- >The OO paradigm in its pure form is state based: the state of a system is
- >based on the state of all its objects only and the state of an object is
- >based on the values of its variables. And the only way of changing variables
- >is setting them. So, whatever a method might do its effect has to somehow
- >change object state.
-
- That's not entirely true. The state of the system is also determined
- by what objects exist, and a method can create new objects without
- modifying the state of any old ones. It is also determined by
- invocation stacks and parameters just as much as any functional
- language. It is quite conceivable that one could write a program
- using an OO language in which no state variables of any object were
- ever modified (i.e. set except at creation time). It has already been
- extensively debated whether this is "really OO", and I have no wish to
- re-open the topic, but such programs can certainly be written in a
- "pure OO" language, making it a question of style.
-
- In any case, this is clearly distinct from "database" type objects,
- which have no behaviour other than get/set.
-
- >>There is also the issue that in an OO language it is not necessary to
- >>provide these get/set methods, so the internal state of an object may
- >>not be (entirely) visible to code not part of that object. e.g.
- >> ...
-
- >Well, I suppose you are aware that encapsulation (one of the features of OO)
- >says that internal object state is NEVER visible to any outside code.
-
- It's not directly visible, but if you write get/set methods for all
- instance variables you have effectively circumvented encapsulation.
-
- --
- Alan Knight knight@mrco.carleton.ca +1 613 225 8812
- The Object People, 885 Meadowlands Dr., Suite 509
- Ottawa, Ontario, Canada, K2C 3N2
-
-