Java – why use factories instead of ‘new’?
I'm reading this book EMF: Eclipse modeling framework, which says:
Why encourage the use of factories instead of new ones?
Your answer is not necessarily EMF specific, as long as it is java related
Solution
You can read effective Java item 1: consider static factory methods instead of constructors It details the advantages of using the factory method:
>One advantage of static factory methods is that, unlike constructors, they have names > the second advantage of static factory methods is that they do not need to create new objects every time they are called. > A third advantage of static factory methods is that they can return objects of any subtype of their return type. > The fourth advantage of static factory methods is that they reduce the redundancy of creating instances of parameterized types (which seems outdated since Java 7)