re: Gang of Four Patterns in Kotlin VIEW POST

VIEW PARENT COMMENT VIEW FULL DISCUSSION
 

Using apply for post constructor changes is nice but I wouldn't call it a builder. With the approach you are describing an instance is created first, with empty constructor, and then modified in the apply{} block. This means that

  1. Default values are required

  2. It is not possible to ensure that an instance exists only if the parameters are valid

code of conduct - report abuse