Book Image

Scala Design Patterns

By : Ivan Nikolov
Book Image

Scala Design Patterns

By: Ivan Nikolov

Overview of this book

Scala has become increasingly popular in many different IT sectors. The language is exceptionally feature-rich which helps developers write less code and get faster results. Design patterns make developer’s lives easier by helping them write great software that is easy to maintain, runs efficiently and is valuable to the company or people concerned. You will learn about the various features of Scala and be able to apply well-known, industry-proven design patterns in your work. The book starts off by focusing on some of the most interesting features of Scala while using practical real-world examples. We will also cover the popular "Gang of Four" design patterns and show you how to incorporate functional patterns effectively. By the end of this book, you will have enough knowledge and understanding to quickly assess problems and come up with elegant solutions.
Table of Contents (20 chapters)
Scala Design Patterns
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Preface
Index

Chapter 9. Behavioral Design Patterns – Part 2

The group of behavioral design patterns is a relatively big one. In the previous chapter, we looked at the first part of behavioral design patterns and understood what their purpose is. As we already know, these patterns are used to deal with behavior and modeling object communication in computer programs.

In this chapter, we will continue going through the different behavioral design patterns as seen from the point of view of Scala. We will look at the following topics:

  • Iterator

  • Mediator

  • Memento

  • Observer

  • State

  • Template method

  • Visitor

The design patterns that we will cover in this chapter might not be as relevant to functional programming as some of the others we've seen earlier. They might look like Scala implementations of Java design patterns and this will actually be the case. However, this does not make them unnecessary and they are still important due to the hybrid nature of Scala.

As in the previous chapters, we will follow the same structure—give...