Summary
In this chapter, we've revisited a handful of common software design patterns and seen first hand how Kotlin makes the implementation and utilization of these patterns very easy. We saw how Kotlin provides first-party support for the Singleton pattern through the use of object classes. We explored how to implement the Factory pattern using companion objects. We examined how the use of named arguments and default parameter values enables us to forgo the traditional Builder pattern implementation in favor of simple functions. And finally, we explored how Kotlin's support of higher-order functions simplifies the implementation of the Strategy pattern.
Whether it's the patterns shown in this chapter, or your own favorite design patterns, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access