Summary
In this chapter, we learned about structural design patterns and specifically about the following: adapter, decorator, bridge, composite, facade, flyweight, and proxy. We went through the details of each of them and showed a class diagram as well as a code example for each. Because of the richness of Scala, sometimes there can be a better implementation using some of the nice features of Scala but sometimes the design pattern just looks the same as it would in a language such as Java.
In many cases, the structural design patterns seem quite similar. This, however, shouldn't confuse you as they still have different purposes. Some examples include:
Adapter versus Bridge: Adapter is used to convert one interface to another when we do not have access to the code. Bridge is used while designing software and it decouples abstraction from implementation for easier extensions in the future.
Proxy versus Decorator: Decorators usually enhance an interface. Proxies provide the same interface...