Re: Convenience constructors and non-final setters
- From: blue indigo <blue.indigo@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 22 Jan 2009 11:24:23 -0500
On Thu, 5623 Sep 1993 14:58:59 +0000, Andreas Leitgeb wrote:
Joshua Cranmer <Pidgeot18@xxxxxxxxxxxxxxx> wrote:
Andreas Leitgeb wrote:
Having to call setSeed() explicitly on user's side would have impacted
comfort severely (ok, I guess that argument doesn't count for OO-purists),
and determining the need to call it lazily only on each invocation of
next() would have been a performance issue. (another argument likely
not shared by OO-purists)
Are there even other ways out? (even if we could turn back time?)
I think the "cleanest" way out would have been to provide a protected
init() method which would have been called before setSeed.
But that would still have broken the rule:
"no non-final (& non-private) method calls from constructor"
True. I think his point is that it might have mitigated the consequences,
IF subclass writers had their constructors only call super and do any
post-setSeed initialization, while doing all of their pre-setSeed
initialization in an overridden init() method. Then the superclass
constructor runs, init() runs, setSeed() runs, and the subclass
constructor runs.
It still stinks, though opinions may vary as to whether it stinks half as
bad or twice as bad. In my opinion they should have made Random abstract,
or even an interface. An abstract Random with a getInstance factory method
would have been cleaner than the mess we actually got.
--
blue indigo
UA Telecom since 1987
.
- References:
- Convenience constructors and non-final setters
- From: Andreas Leitgeb
- Re: Convenience constructors and non-final setters
- From: Joshua Cranmer
- Re: Convenience constructors and non-final setters
- From: Andreas Leitgeb
- Re: Convenience constructors and non-final setters
- From: Joshua Cranmer
- Re: Convenience constructors and non-final setters
- From: Andreas Leitgeb
- Convenience constructors and non-final setters
- Prev by Date: Re: Convenience constructors and non-final setters
- Next by Date: Re: Pseudostrings
- Previous by thread: Re: Convenience constructors and non-final setters
- Next by thread: Re: Convenience constructors and non-final setters
- Index(es):
Relevant Pages
|