O'Reilly logo

Scala Functional Programming Patterns by Atul S. Khot

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Summary

We looked at three creational design patterns—Singleton, Factory method, and builder— specifically the rationale behind them and the Java implementations. We also learnt about a special singleton—Null Object. We saw how Scala helps avoid null using Options. We looked at multiple Scala idioms with respect to Options and saw how Options as a container theme helps. We also saw the special apply method and learned how this syntactic sugar sweetens the code. Finally we looked at builders—a design pattern for creating objects with many attributes. We also saw how Scala's case classes help us with the creation of objects having many attributes. Take a deep breath readers, grab a cup of your favorite hot beverage and settle down to read about ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required