re: Gang of Four Patterns in Kotlin VIEW POST

VIEW PARENT COMMENT VIEW FULL DISCUSSION
 

I think one of the problems with your approach is theoretically possibility to have broken data, since constuction of object is separated from setting up field.

Approach with naming constructor parameters or more stable and looks like builder, since all preparations are happen in constructor of object. And if it will fail, you just will not receive a new object.

Sure, but separating construction from representation is the whole point of the Builder pattern.

code of conduct - report abuse