Replace constructor with factory / or builder

I am using IntelliJ 10 Comnunity Edition, and I noticed that there are two refactoring options that are similar:

-Replace constructor with factory -Earn constructor with linker

What is the difference between the two? When do I want to use over another?

thanks

+4
source share
1 answer

Use constructors to construct an object when it can satisfy all invariants. To understand the difference between a constructor and a factory, check out this post . What is the difference between a Builder design pattern and a factory design pattern?

+1
source

Source: https://habr.com/ru/post/1335472/


All Articles