Summary
In this chapter, we learned when and how to use design patterns from the Creational family. We learned about different usages of theobject
keyword: as Singleton, as a container for the Static Factory Methods, and as an anonymous implementation of an interface. We then saw the workings of the destructuring declaration and generics in Kotlin with the use of thein
,out
, andwhere
keywords. We also learned about the default parameter values and named arguments, followed by the copy()
functionfor data classes.
In the next chapter, we'll cover the second family of design patterns, Structural patterns. Those patterns help extend the functionality of our objects.