Yeah, I was going to ask what's wrong with Factory that makes such
"solutions" seem attactive to people. I suspect that's just because
there are people who haven't read GoF or its derivatives, and who are
struggling to find an approach to a common problem on their own.
I'm impressed you've read GoF.
I'm wondering why you're substituting my name with "there are people
who". I suspect there are people who think they have a superior mind
because they've read some book. Still impressed.
I didn't say that anything was wrong with the factory design pattern.
I didn't say that my solution was more or less attractive, neither did I
say my solution was attractive at all.
From your post I derive that alternatives to a solution may not be
considered. Why is that? (don't answer this one)
Instead of insulting me of doing useless thinking, you'd better give me
a reason why my solution is not a solution (or how should I interpret
your quotes?)
I will tell you why my solution is a solution:
1. I'm allowed to define in the contract of the superclass that all
childclasses are responsible themselves for initializing the instance
fields.
2. Childclasses must obey the contract
Yours sincerely,
Jeroen