in reply to Re5: Constructor/Factory Orthodoxy
in thread Constructor/Factory Orthodoxy
I find it almost comical that this one construct gives so many people angina. I agree that cloning is separate and different. To clone means to make identical. To make a new instance of something means just that: make a new one. So in my mind you can do both. Offer a clone method if you truly are going to make an exact copy of the referent; offer a new method that allows instances as referents if you want to allow someone to make a new one like them. In other words, I don't see the dual constructor as two distinct methods (new and clone) but rather as two ways of asking for a new instance. I don't see the great value in forcing the caller to create the class name each time. In my mind new one of this class and new one like this one I already have are basically the same thing that this one simple line in one place can deal with. I believe the only reason people get so uptight about it is that traditional OO languages don't allow or offer it. If we follow that line of thinking we also should require set names for constructors, no inheritence of constructors, and (according to most) no multiple inheritence.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re7: Constructor/Factory Orthodoxy
by dragonchild (Archbishop) on Feb 27, 2003 at 14:21 UTC | |
by Abigail-II (Bishop) on Feb 27, 2003 at 14:40 UTC |