rtrosper@esunix.UUCP (Robert Trosper) (11/10/89)
> In article <469f709a.20b6d@apollo.HP.COM> vinoski@apollo.HP.COM (Stephen Vinoski) writes: > ->What's your favorite way to handle "is-part-of" relationships between objects? I presume that one of your concerns is maintaining encapsulation while providing access to subcomponents of the complex object. "My favorite method" is to construct objects which know how to navigate the database in response to user queries. Yes, this does require the controller to know about the structure of the hierarchy, but not necessarily the structure of each object in it. This is not a purist approach. More pure, but many times less efficient, is to broadcast messages to the entire database asking if they have the requested information. The advantage to the abstract class for navigation is that the structure of the data can be changed without impacting the end user. My next project is to make the database self describing, thus constructing its own controllers, but I have sufficient work that they are paying me for :-). P.S. Another advantage to the controller approach is that you can peform multiple operations or use more user-meaningful keywords and so on without putting that stuff in all the objects. Robert Trosper
jtr@cs.exeter.ac.uk (Jason Trenouth) (11/21/89)
>>>>> On 4 Nov 89 01:57:17 GMT, barmar@leander.think.com (Barry Margolin) said: Barry> You'd probably want to have a component of the component object that Barry> points back to the object of which it is a part, though. Sometimes Barry> component objects need to affect their containers. For instance, a gas Barry> tank object might want to send a message to the car's gas gauge object. Barry> The component should be prepared for that slot to be empty, Barry> interpreting that to mean that it hasn't been installed. Barry Barry> Margolin, Thinking Machines Corp. This isn't a good example in general. Monitoring facilities are probably better implemented transparently with respect to monitored objects. They should not have to "know" about that sort of thing. _Active values_ are a way of doing this. For example, see: Stefik, M. J., Bobrow, D. G., and Kahn, K. M. (1986) "Integrating Access-Oriented Programming into a Multiparadigm Environment," in IEEE Software, January 1986, pages 10-18. JT -- ______________________________________________________________________________ | Jason Trenouth, | JANET: jtr@uk.ac.exeter.cs | | Computer Science Dept, | UUCP: jtr@expya.uucp | | Exeter University, Devon, EX4 4PT, UK. | BITNET: jtr%uk.ac.exeter.cs@ukacrl|