Scala Functional Programming Patterns
上QQ阅读APP看书,第一时间看更新

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 recursion.