[5500] in java-interest

home help back first fref pref prev next nref lref last post

Follow-up to Copy Constructors...

daemon@ATHENA.MIT.EDU (Reginald Braithwaite-Lee)
Wed Feb 14 16:40:34 1996

Date: Tue, 13 Feb 1996 23:18:45 -0400
To: java-interest@java.sun.com
From: opendocguy@codestorm.com (Reginald Braithwaite-Lee)
Cc: "COLLINS-LEE" <collinsl@norcmail.uchicago.edu>,
        guillory@ncsa.uiuc.edu (Stan Guillory)

Hi!

Thanks very much to those who replied with tips. To summarize:

1. Create a constructor which takes an existing instance as an argument.
Then use the new operator.

2. There is no overloading, but the elimination of pointers eliminates much
of the need. I'm unclear on this. What I presume is that the widespread use
of references, along with dynamic garbage collection, means that all values
are returned by reference, so a copy constructor is not required, since you
can pass a reference to the original without fear of leaving a dangling
reference.

3. java.util defines a few of the things I was looking for. Specifically,
Observer and Observable. Notably, Observer is defined as an interface with
a single method, update(...). Compare this to Dependent, an interface I
rolled for myself:

interface Dependent {
        void update();
}

I'm not sure whether to laugh at my piercing insight or weep for the lost
hours...

The key difference between my own SharedValue class and the Observable
class is that I implemented SharedValue as an envelope class, which holds
an object of some other class. Observable is meant to be subclassed,
similar to the orignial SharedValue from SmallTalk.

4. java.util also includes all your Collection favourites, plus enumeration
classes to iterate through them. Could have saved me entire minutes rolling
my own sets out of arrays...

Thanks again for the 'pointers'...


-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post