I am using IntelliJ 10 Comnunity Edition, and I noticed there are two refactoring options which are similar:
开发者_如何学JAVA-Replace constructor with factory -Replace constructor with builder
What are the differences between these two? When would I want to use over another?
Thanks
Use constructors to build an object when it can satisfy all the invariants. To understand the difference between builder and factory look this post What is the difference between Builder Design pattern and Factory Design pattern?
精彩评论