Thanks for your comment. I agree with you matra to design object-oriented code. Regarding the second part of your comment, I think that your approach could be correct, but there is no obvious use case listed in the post that refers to such approach :)
Anyway, for me, method factories are ok, as Joshua Bloch says in "Effective Java". Also in Scala, using the apply method, chose this way of creating objects. If you want to deal only with interfaces, the factory method is the only right way, I guess.
Thanks for your comment. I agree with you matra to design object-oriented code. Regarding the second part of your comment, I think that your approach could be correct, but there is no obvious use case listed in the post that refers to such approach :)
Anyway, for me, method factories are ok, as Joshua Bloch says in "Effective Java". Also in Scala, using the
apply
method, chose this way of creating objects. If you want to deal only with interfaces, the factory method is the only right way, I guess.The second part of my comment is explained here:amihaiemil.com/2017/10/16/javaee8-... (more directly) or here: amihaiemil.com/2017/09/01/data-sho... (more indirectly). Basically my whole blog is around those 3 points (so far), each post from a different perspective.
Yes, ok. IMHO, no approach is correct a priori. Anyway, nice work.