Ok ... you need a factory class, or just you need to call the constructor. Why are people afraid to call a constructor?
I think the templates are good. I also believe that their abuse is pure evil :)
If you begin to realize that your programming paradigm makes your life more complicated, discard that paradigm, not your programmer’s ability. Once too much abstraction is simply not useful.
Being clean and writing clean codes does not mean following the pattern, which means that the write code makes sense.
Factory pattern: if we need to write factory for factory and factory for factory for factory .... until the deadline comes when we write the real code?
Since I see system analysts more as architects than masons, I believe that only after some rule cannot make your software good.
People can blame Turing or the Church or Goedel if they want to, but not their fault if the software that writes the software cannot be written :) We still need our human part to write the software, our creativity and imagination and of our soul, also, if any software developer tried to make it a pure mechanical action, programming is still an art in a large part of it.
Conclusion: I think that templates are very good if they are used with the right criticism and always follow a good programmer in the sixth sense :)
I think that programming requires some flexibility, we are not in an ideal world, we do not have an ideal computer, we are not perfect, and our software cannot be perfect, and especially a machine cannot think, still.
So, calling a constructor is always better than 2,000 lines of code to just call the constructor.
Salvatore previti
source share