Path: utzoo!attcan!uunet!mcvax!enea!sommar From: sommar@enea.se (Erland Sommarskog) Newsgroups: comp.lang.misc Subject: Re: object oriented design decision Message-ID: <4099@enea.se> Date: 21 Nov 88 21:28:10 GMT Organization: ENEA DATA AB, Sweden Lines: 24 Daniel B Hankins (dan-hankins@cup.portal.com) writes: >I said: >>If I want to store an object in a tree and a >>linked list simultaneously, what is wrong with my class structure? > >These two sound like the same example. In either case, is is much better >programming practice to have a class Node which is not tied to any >structure. Objects which are nodes of class TreeNode or ListNode or >whatever should have objects of class Node as an acquaintance (or variable, >in Smalltalk terminology). So If have a link and a tree class just lying around I should just ditch them in favour of a more general node class which I haven't? So much for reuseable software! And I fail to see how I make it with my objects as nodes simply. I want to apply typical list operations as delete/insert them into the list, go to the next element and so. And I want to visit all of them in prefix order, insert them sorted into the right place in the tree, and so on. -- Erland Sommarskog ENEA Data, Stockholm sommar@enea.se "Frequently, unexpected errors are entirely unpredictable" - Digital Equipment