Constructors vs converters

Thomas Kuehne kuehne at informatik.uni-kl.de
Wed Sep 12 10:00:54 UTC 2001


Hi,

I am comparing the merits of

Date class>>fromString:  (constructor class method)

versus

String>>asDate            (converter instance method)

when I remembered a thread about this topic on this list not too long ago.
I heavily searched for it but can not find it anymore.

Is perhaps one of the contributors able to remember one of the posts?
The example was not about dates and strings, but the question raised was the same.

While everything seems to speak for the constructor approach (more modular as the removal of a class consists only of removing the class itself without removing all of the converter methods elsewhere) there were some arguments for the converting method approach as well.

I'd very much appreciate a pointer to this recent discussion.

Cheers,

    Thomas

P.S.: My real conviction is that the conversion methods should be present but should be treated as being part of the class they create instances of. A module system should support the removal of all such conversion methods whenever the corresponding class is removed. This, however, is not at the focus of my question but simply the comparison of the two alternatives.

--
Dr. Thomas Kuehne
+49 178 4314387, http://www-agce.informatik.uni-kl.de/~kuehne
Experts are people who successfully calibrated their intuition. -- TK






More information about the Squeak-dev mailing list