4

Getting Familiar with Behavioral Patterns

This chapter talks about behavioral patterns using Kotlin. Behavioral patterns deal with how things interact with each other.

We will learn how an object can change how it acts depending on the situation, how objects can talk to each other without knowing all the details, and how to go through complicated setups easily. We will also touch on functional programming in Kotlin, which makes it easier to use some of these patterns.

In this chapter, we’ll explore the following topics:

  • Strategy
  • Iterator
  • State
  • Command
  • Chain of Responsibility
  • Interpreter
  • Mediator
  • Memento
  • Visitor
  • Template Method
  • Observer

By the end of this chapter, you’ll be able to structure your code in a highly decoupled and flexible manner. ...

Get Kotlin Design Patterns and Best Practices - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.