The constructor constructs the object you need, while the builder is a helper object to construct what you need. I think it is horrible!
- It contradicts the natural, well learnt method of object creation. What new methods will they come up with next?
- Instead of creating one object, you are forced to create two.
- It is absolutely not necessary! We always had to prepare variables for function params and we never used a builder.
eg:
// a class with ctor that takes lots of params
class Params
{
Params(int,int,int,String,char,boolean,int){}
}
// We dont need a builder.
// A builder will do the same following thing.
int p1 = 20;
int p2 = 40 + 40;
int p3 = (67 >> 1) * 3;
String p4 = "go" + "to" + "church";
char p5 = ' ' == 32 ? '5' : '7';
boolean p6 = true;
int p7 = MATCH_PARAMS;
new Params(p1,p2,p3,p4,p5,p6,p7);
//There is also this design pattern
new Params(
20,
40 + 40,
(67 >> 1) * 3,
"go" + "to" + "church",
' ' == 32 ? '5' : '7',
true,
MATCH_PARAMS
);
At the end of the day if you are a fan of builders no problem. But when Android makes constructors deprecated I don't like that. It like, type type type; deprecated.