+ 1
Code review [solved]
If there're senior/middle developers among you please review my code. Does it correspond to "builder pattern"? https://code.sololearn.com/w4GHOpdJ5hHO/?ref=app
6 Respostas
+ 1
Not quite. The builder, to be precise, a concrete implementation of a builder interface, is responsible for creating the object. That is the idea behind the builder pattern, to insert a creation mechanism that is flexible and can create many different kinds of object representations. So, you should do no more than to create a concrete builder, but not the object that is being build.
This would be my approach, using an abstract CarBuilder class as common interface. The StandardCarBuilder is one possible concrete implementation. The example does not allow for much flexibility, so it may all look a little over the top :) But, I am sure you get the idea.
https://code.sololearn.com/wHUwqgwo4vxE
+ 2
I improved it
+ 2
Great đ Enabled method chaining đ
+ 1
You're welcome :)
+ 1
Now it looks much better Ani Jona đ
0
Ani Jona đ thank you