Cargando…

Scala functional programming patterns : grok and perform effective functional programming in Scala /

Annotation

Detalles Bibliográficos
Clasificación:Libro Electrónico
Autor principal: Khot, Atul S. (Autor)
Formato: Electrónico eBook
Idioma:Inglés
Publicado: Birmingham, UK : Packt Publishing, 2015.
Colección:Community experience distilled.
Temas:
Acceso en línea:Texto completo
Texto completo
Tabla de Contenidos:
  • Cover; Copyright; Credits; About the Author; Aknowledgement; About the Reviewers; www.PacktPub.com; Table of Contents; Preface; Chapter 1: Grokking the Functional Way; Abstractions; Concise expression; Functions; Immutable; Referential transparency; The problem
  • grouping continuous integers; Java code; Going scalaish; Thinking recursively ... ; Reusability
  • the commonality/variability analysis; The one-liner shockers; Scala idioms; Patterns and those aha! moments; The command design pattern; The strategy design pattern; Passing algorithms around; Summary.
  • Chapter 2: Singletons, Factories, and BuildersSingletons
  • being one and only one; Null Objects
  • singletons in another garb; Null Objects
  • the Scala way; Options are container; Scala singletons; The apply() factory method; The factory method pattern; The Scala version; Builders; Ease of object creation; Scala shines again; Summary; Chapter 3: Recursion and Chasing your Own Tail; Recursive structures; Pattern matching; Deconstruction with case statements; Stack overflows; Tail recursion to the rescue; Getting the nth element of a list; An expression parser; Persistent data structures.
  • Two forms of recursionSummary; Chapter 4: Lazy sequences
  • Being Lazy, Being Good; Illusion and reality
  • the proxy pattern; Hibernate's lazy loading; Lazy val
  • calling by need; Infinite sequences
  • Scala streams; Recursive streams; Memoization and the flyweight pattern; Call by name; Streams are collections; Sieve of Eratosthenes; A view to a collection; Summary; Chapter 5: Taming Multiple Inheritance with Traits; The iterator design pattern; Interfaces as types; The dreaded diamond; Traits
  • Scala's rich interfaces; Mix-ins
  • rich interfaces; Frills and thrills
  • the decorator pattern.
  • Scala's easy and breezy decorations
  • stackable modificationsDependencies injection pattern; A taste of the cake pattern; Sealed traits; Defeating the dreaded diamond; Summary; Chapter 6: Currying Favors with Your Code; Functions as first-class values; Roping in a scope; Local functions
  • hiding and biding their time; The underscore
  • Scala's Swiss army knife; A taste of the curry; Type inference; Of implicits and explicits; Stylish blocks; The loan pattern; Serving the curry; Frills and thrills
  • decorators again; Wrapping it up; Summary.
  • Chapter 7: Of Visitors and Chains of ResponsibilitiesA tale of two hierarchies; The Visitor pattern; Many hues of pattern matching; De-structuring; Typed patterns; Pattern guards; Tuple explosion; Partial functions; Visitor pattern
  • the Scala way; Lifting it up; The chain of responsibility; Scalaish Chain Of Responsibilities; Match and mismatch
  • the collect idiom; Summary; Chapter 8: Traversals
  • Mapping/Filtering/Folding/Reducing; Iterating the Scala way; A validation problem; Setting the stage ; First cut-using arrays; Second cut-using a map; Third cut-using a for expression.