Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Scala Design Patterns

You're reading from   Scala Design Patterns Design modular, clean, and scalable applications by applying proven design patterns in Scala

Arrow left icon
Product type Paperback
Published in Apr 2018
Publisher Packt
ISBN-13 9781788471305
Length 396 pages
Edition 2nd Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
 Nikolov Nikolov
Author Profile Icon Nikolov
Nikolov
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
1. The Design Patterns Out There and Setting Up Your Environment FREE CHAPTER 2. Traits and Mixin Compositions 3. Unification 4. Abstract and Self Types 5. Aspect-Oriented Programming and Components 6. Creational Design Patterns 7. Structural Design Patterns 8. Behavioral Design Patterns – Part One 9. Behavioral Design Patterns – Part Two 10. Functional Design Patterns – the Deep Theory 11. Applying What We Have Learned 12. Real-Life Applications 1. Other Books You May Enjoy Index

Index

A

  • abstract factory
    • about / The abstract factory
    • class diagram, example / An example class diagram
    • code, example / A code example
    • Scala alternatives / Scala alternatives
    • advantages / What it is good for?
    • disadvantages / What it is not so good for?
  • abstract factory design pattern / The abstract factory design pattern
  • abstraction / Abstraction and vocabulary
  • abstract types
    • about / Abstract types, Abstract types
    • generics / Generics
    • versus generics / Generics versus abstract types
    • usage / Usage advice
  • adapter design pattern
    • about / The adapter design pattern, The adapter design pattern
    • example class diagram / Example class diagram
    • code example / Code example
    • with final classes / The adapter design pattern with final classes
    • with Scala / The adapter design pattern the Scala way
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • Ad hoc polymorphism / Generics, Ad hoc polymorphism
  • Akka
    • references / A code example
  • algebraic data types (ADTs)
    • about / Algebraic data types and class hierarchies, ADTs, An example class diagram
    • sum ADTs / Sum ADTs
    • product ADTs / Product ADTs
    • hybrid ADTs / Hybrid ADTs
    • unification / The unification
  • algebraic structure / What are monoids?
  • application
    • writing / Writing a complete application
    • specifications / Application specifications
    • implementation / Implementation
    • libraries, used / The libraries to use
    • code, writing / Writing some code
    • implementing / Wiring it all up
    • end result / The end result
    • testing / Testing our application
    • about / The future of our application
  • application configuration
    • reading / Reading the application configuration
  • application efficiency / Understanding application efficiency
  • application testing / Application testing
  • Aspect-oriented programming (AOP)
    • about / Aspect-oriented programming
    • application efficiency / Understanding application efficiency
    • application, timing without / Timing our application without AOP
    • application, timing with / Timing our application with AOP

B

  • balanced fold / Monoids and parallel computations
  • behavioral design patterns
    • about / Behavioral design patterns, Defining behavioral design patterns
    • value object design pattern / The value object design pattern, The value object design pattern
    • null object design pattern / The null object design pattern, The null object design pattern
    • strategy design pattern / The strategy design pattern, The strategy design pattern
    • command design pattern / The command design pattern, The command design pattern
    • chain of responsibility design pattern / The chain of responsibility design pattern, The chain of responsibility design pattern
    • interpreter design pattern / The interpreter design pattern, The interpreter design pattern
    • iterator design pattern / The iterator design pattern, The iterator design pattern
    • mediator design pattern / The mediator design pattern, The mediator design pattern
    • memento design pattern / The memento design pattern, The memento design pattern
    • observer design pattern / The observer design pattern, The observer design pattern
    • state design pattern / The state design pattern, The state design pattern
    • template method design pattern / The template method design pattern, The template method design pattern
    • visitor design pattern / The visitor design pattern, The visitor design pattern
  • boilerplate
    • minimizing / Minimizing the boilerplate
  • bridge design patterns
    • about / The bridge design pattern, The bridge design pattern
    • example class diagram / Example class diagram
    • code example / Code example
    • code class diagram / Code example
    • with Scala / The bridge design pattern the Scala way
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • builder design pattern
    • about / The builder design pattern, The builder design pattern
    • class diagram, example / An example class diagram
    • code, example / A code example
    • Java-like implementation / A Java-like implementation
    • implementation, with case class / Implementation with a case class
    • generalized type constraints, using / Using generalized type constraints
    • advantages / What it is good for?
    • disadvantages / What it is not so good for?
  • by-name parameters feature / The command design pattern the Scala way

C

  • cake design pattern / The cake design pattern, Composing with self-types
    • about / The cake design pattern
    • dependency injection / Dependency injection
    • dependency injection, in Scala / Dependency injection in Scala
    • dependency injection alternatives / Other dependency injection alternatives
  • caretaker / The memento design pattern
  • Cats
    • reference link / The Scalaz library
  • chain of responsibility design pattern
    • about / The chain of responsibility design pattern, The chain of responsibility design pattern
    • example class diagram / An example class diagram
    • code example / A code example
    • with Scala / The chain of responsibility design pattern the Scala way
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • clashing traits
    • about / Clashing traits
    • same signatures, and return types / Same signatures and return types
    • same signatures, and different return types traits / Same signatures and different return types traits
    • same signatures, and return types mixins / Same signatures and return types mixins
    • same signatures, and different return types mixins / Same signatures and different return types mixins
  • classes
    • versus traits / Traits versus classes
    • about / Functions and classes
  • class hierarchies / Algebraic data types and class hierarchies
  • command design pattern
    • about / The command design pattern, The command design pattern
    • example class diagram / An example class diagram
    • command / An example class diagram
    • receiver / An example class diagram
    • invoker / An example class diagram
    • client / An example class diagram
    • code example / A code example
    • with Scala / The command design pattern the Scala way
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • complex traits
    • composing / Composing complex traits
  • composite design pattern
    • about / The composite design pattern, The composite design pattern
    • example class diagram / Example class diagram
    • code example / Code example
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • console commands
    • executing / Executing console commands
  • context bounds / Type class example
  • creational design patterns
    • about / Creational design patterns, What are creational design patterns?
    • abstract factory design pattern / The abstract factory design pattern
    • factory method design pattern / The factory method design pattern
    • lazy initialization design pattern / The lazy initialization design pattern
    • singleton design pattern / The singleton design pattern
    • object pool design pattern /
    • builder design pattern / The builder design pattern
    • prototype design pattern / The prototype design pattern
  • curried functions / Partial functions are not partially applied functions

D

  • database
    • accessing / Accessing a database
  • DatabaseConnectorFactory / An example class diagram
  • decorator design pattern
    • about / The decorator design pattern
    • example class diagram / Example class diagram
    • code example / Code example
    • with Scala / The decorator design pattern the Scala way
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • dependency injection
    • about / Dependency injection
    • libraries / Dependency injection libraries and Scala
    • Scala / Dependency injection libraries and Scala
    • in Scala / Dependency injection in Scala
    • code, writing / Writing our code
    • wiring / Wiring it all up
    • unit testing / Unit testing our application
    • implicits, used / Dependency injection using implicits
  • dependency injection alternatives
    • about / Other dependency injection alternatives
    • implicits / Implicits for dependency injection
    • Reader monad / Reader monad for dependency injection
  • dependency management
    • about / Dependency management
    • Simple Build Tool (SBT) / SBT
    • Maven / Maven
    • SBT, versus Maven / SBT versus Maven
  • design patterns
    • about / Design patterns, Scala and design patterns
    • benefits / The need for design patterns and their benefits
    • need for / The need for design patterns and their benefits
    • selecting / Choosing a design pattern
    • structural design patterns / Defining structural design patterns
    • behavioral design patterns / Defining behavioral design patterns
  • design patterns categories
    • about / Design pattern categories
    • creational design patterns / Creational design patterns
    • structural design patterns / Structural design patterns
    • behavioral design patterns / Behavioral design patterns
    • functional design patterns / Functional design patterns
    • Scala-specific design patterns / Scala-specific design patterns
  • development environment
    • setting up / Setting up the development environment
  • diamond problem / The diamond problem
  • do not repeat yourself (DRY) / The type class design pattern
  • duck typing
    • about / Duck typing, Duck typing
    • example / Duck typing example
    • alternatives / Duck typing alternatives
    • using / When to use duck typing

E

  • expressions
    • terminal expression / An example class diagram
    • nonterminal expression / An example class diagram

F

  • facade design pattern
    • about / The facade design pattern, The flyweight design pattern, The facade design pattern
    • example class diagram / Example class diagram
    • code example / Code example
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • factory design patterns
    • about / Other factory design patterns
    • static factory / The static factory
    • simple factory / The simple factory
    • factory combinations / Factory combinations
  • factory method design pattern
    • about / The factory method design pattern, The factory method design pattern
    • class diagram, example / An example class diagram
    • code, example / A code example
    • Scala alternatives / Scala alternatives
    • advantages / What it is good for?
    • disadvantages / What it is not so good for?
  • flow / Defining behavioral design patterns
  • flyweight design pattern
    • about / The flyweight design pattern
    • example class diagram / Example class diagram
    • code example / Code example
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • functional design patterns
    • about / Functional design patterns
    • monoids / Monoids
    • monads / Monads
    • functors / Functors
  • function literals / Function literals
  • functions
    • about / Functions and classes
    • as classes / Functions as classes
    • without syntactic sugar / Functions without syntactic sugar
    • adding, for multiple types / Adding functions for multiple types
  • functor laws / Functors
  • functors
    • about / Functors, Functors
    • example / Functors in real life
    • using / Using our functors

G

  • generalized type constraints
    • using / Using generalized type constraints
    • person class, changing / Changing the Person class
    • adding, to methods / Adding generalized type constraints to the required methods
    • type-safe builder, used / Using the type-safe builder
    • require statements, used / Using require statements
  • generics
    • versus abstract types / Generics versus abstract types

H

  • H2 database engine
    • reference link / Writing our code

I

  • immutable / Immutable and verbose
  • implicit classes
    • reference link / What it is not so good for
  • implicit conversions / Implicit conversions
  • implicit dependency injection
    • testing / Testing with implicit dependency injection
  • implicit injection / Implicit injection, Implicit injection
  • implicits
    • used, for dependency injection / Dependency injection using implicits
  • increased expressivity / Increased expressivity
  • inheritance
    • versus self types / Self types versus inheritance
    • functionality, leaking / Inheritance leaking functionality
  • interpreter design pattern
    • about / The interpreter design pattern, The interpreter design pattern
    • example class diagram / An example class diagram
    • code example / A code example
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • invoker / The command design pattern
  • iterator / The iterator design pattern
  • iterator design pattern
    • about / The iterator design pattern, The iterator design pattern
    • example class diagram / Example class diagram
    • code example / Code example
    • advantages / What it is good for
    • disadvantages / What it is not so good for

J

  • json4s
    • reference link / Understanding application efficiency, Reading the scheduler configuration

L

  • lazy evaluation
    • about / Lazy evaluation, Lazy evaluation
    • by-name parameters, evaluating / Evaluating by-name parameters only once
    • alternative / Alternative lazy evaluation
  • lazy initialization
    • about / Lazy initialization
    • class diagram, example / An example class diagram
    • code, example / A code example
    • advantages / What it is good for?
    • disadvantages / What it is not so good for?
  • lazy initialization design pattern / The lazy initialization design pattern
  • lens design pattern
    • about / The lens design pattern, The lens design pattern, With the lens design pattern
    • example / Lens example
    • avoiding / Without the lens design pattern
  • libraries
    • using / Reasons to use libraries
  • linearization
    • about / Linearization
    • inheritance hierarchies, rules / Rules of inheritance hierarchies
    • rules / Linearization rules
    • working / How linearization works
    • initializing / Initialization
    • method overriding / Method overriding

M

  • Maven
    • about / Maven
    • URL, for downloading / Maven
    • versus SBT / SBT versus Maven
  • MD5 / Example class diagram
  • mediator design pattern
    • about / The mediator design pattern, The mediator design pattern
    • example class diagram / Example class diagram
    • code example / Code example
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • memento / The memento design pattern
  • memento design pattern
    • about / The memento design pattern, The memento design pattern
    • example class diagram / Example class diagram
    • code example / Code example
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • memoization
    • about / Memoization, Memoization
    • example / Memoization example
    • alternatives / Memoization alternatives
  • mixin / Traits as interfaces
  • Mixin compositions
    • about / Mixin compositions
    • traits, mixing / Mixing traits in
    • composing / Composing
  • modules
    • about / Modules and objects
    • using / Using modules
  • monad intuition / Monad intuition
  • monad laws
    • about / The monad laws
    • identity law / The monad laws
    • unit law / The monad laws
    • composition / The monad laws
  • monad rules / What is a monad?
  • monads
    • about / Monads, Monads, What is a monad?
    • flatMap method / The flatMap method
    • unit method / The unit method
    • relationship, between methods / The connection between map, flatMap, and unit
    • example / Monads in real life
    • using / Using monads, Using monads
    • option monad / The Option monad
    • advanced monad example / A more advanced monad example
    • in Scalaz / Monads in Scalaz
    • testing / Testing monads
  • monoid laws / What are monoids?
  • monoids
    • about / Monoids, Monoids, What are monoids?
    • example / Monoids in real life
    • using / Using monoids, When to use monoids, Using monoids
    • foldable collections / Monoids and foldable collections
    • parallel computations / Monoids and parallel computations
    • composition / Monoids and composition
    • in Scalaz / Monoids in Scalaz
    • testing / Testing monoids
  • multiple inheritance
    • about / Multiple inheritance
    • diamond problem / The diamond problem
    • limitations / The limitations
  • mutable properties
    • using / Using mutable properties
  • MysqlClient / An example class diagram

N

  • null object design pattern
    • about / The null object design pattern, The null object design pattern
    • example class diagram / An example class diagram
    • code example / A code example
    • advantages / What it is good for
    • disadvantages / What it is not so good for

O

  • object pool design pattern /
  • objects / Modules and objects
  • observer design pattern
    • about / The observer design pattern, The observer design pattern
    • example class diagram / Example class diagram
    • code example / Code example
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • option monad / The Option monad
  • originator / The memento design pattern

P

  • parametric polymorphism / Parametric polymorphism
  • partial functions
    • about / Partial functions, Partial functions, Partial functions are not partially applied functions
    • defining / Partially defined functions
  • pattern matching
    • about / Pattern matching
    • with values / Pattern matching with values
    • for product ADTs / Pattern matching for product ADTs
  • PgsqlClient / An example class diagram
  • pimp my library
    • about / Pimp my library, Pimp my library in real life
    • design pattern / The pimp my library design pattern
    • using / Using pimp my library
  • polymorphism
    • about / Polymorphism
    • subtype polymorphism / Subtype polymorphism
    • parametric polymorphism / Parametric polymorphism
    • Ad hoc polymorphism / Ad hoc polymorphism
  • process / Defining behavioral design patterns
  • prototype design pattern
    • about / The prototype design pattern, The prototype design pattern
    • class diagram, example / An example class diagram
    • code, example / A code example
    • advantages / What it is good for?
    • disadvantages / What it is not so good for?
  • proxy design pattern
    • about / The proxy design pattern, The proxy design pattern
    • example class diagram / Example class diagram
    • code example / Code example
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • purely functional parallelism
    • reference link / Monoids and parallel computations

S

  • sbtassembly plugin
    • reference link / SBT
    • about / SBT
  • Scala
    • about / Scala and design patterns
    • installing / Installing Scala
    • reference link / Installing Scala
    • tips, for installing / Tips for installing Scala manually
    • tips, for installing SBT used / Tips for installing Scala using SBT
    • components / Components in Scala
    • used, for building components / Using Scala's expressive power to build components
    • components, implementing / Implementing components
    • self types, for components / Self types for components
    • dependency injection / Dependency injection in Scala
  • Scala-specific design patterns
    • about / Scala-specific design patterns
    • lens design pattern / The lens design pattern
    • cake design pattern / The cake design pattern
    • pimp my library / Pimp my library
    • stackable traits / Stackable traits
    • type class design pattern / The type class design pattern
    • lazy evaluation / Lazy evaluation
    • partial functions / Partial functions
    • implicit injection / Implicit injection
    • duck typing / Duck typing
    • memoization / Memoization
  • Scala Binaries
    • reference link / Installing Scala
  • Scala design patterns
    • references / Setting up the development environment
  • Scala IDEs / Scala IDEs
  • ScalaTest
    • URL / Testing traits
  • Scalaz
    • URL / The Scalaz library
    • monoids / Monoids in Scalaz
    • possibilities / The possibilities of Scalaz
  • Scalaz library / The Scalaz library
  • scheduler configuration
    • reading / Reading the scheduler configuration
  • self type annotation / Writing our code
  • self types
    • composing / Composing with self-types
    • about / Composing with self-types, Self types
    • using / Using self types
    • multiple components, requiring / Requiring multiple components
    • components, conflicting / Conflicting components
    • cake design pattern / Self types and the cake design pattern
    • versus inheritance / Self types versus inheritance
  • SHA-1 / Example class diagram
  • SHA-256 / Example class diagram
  • Simple Build Tool (SBT)
    • about / SBT
    • URL, for downloading / SBT
    • versus Maven / SBT versus Maven
  • SimpleConnection / An example class diagram
  • simple traits
    • composing / Composing simple traits
  • singleton design pattern
    • about / The singleton design pattern, The singleton design pattern
    • class diagram, example / An example class diagram
    • code, example / A code example
    • advantages / What it is good for?
    • disadvantages / What it is not so good for?
  • slf4j
    • reference link / Timing our application without AOP
  • Spring
    • URL / Dependency injection libraries and Scala
  • stackable traits
    • about / The decorator design pattern, Stackable traits, The decorator design pattern the Scala way
    • design pattern / The stackable traits design pattern
    • using / Using stackable traits
  • state design pattern
    • about / The state design pattern, The state design pattern
    • example class diagram / Example class diagram
    • code example / Code example
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • static factory / Other factory design patterns, The static factory
  • strategy design pattern
    • about / The strategy design pattern, The strategy design pattern
    • example class diagram / An example class diagram
    • code example / A code example
    • with Scala / The strategy design pattern the Scala way
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • structural design patterns
    • about / Structural design patterns
    • adapter design pattern / The adapter design pattern, The adapter design pattern
    • decorator design pattern / The decorator design pattern, The decorator design pattern
    • bridge design patterns / The bridge design pattern
    • composite design pattern / The composite design pattern, The composite design pattern
    • facade design pattern / The facade design pattern, The facade design pattern
    • flyweight design pattern / The flyweight design pattern, The flyweight design pattern
    • proxy design pattern / The proxy design pattern, The proxy design pattern
    • defining / Defining structural design patterns
  • structural typing / Duck typing
  • subtype polymorphism / Subtype polymorphism

T

  • tasks
    • scheduling / Scheduling tasks
  • template method design pattern
    • about / The template method design pattern, The template method design pattern
    • example class diagram / Example class diagram
    • code example / Code example
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • tests
    • executing / Running the tests
  • traits
    • about / Traits
    • as interfaces / Traits as interfaces
    • mixing, with variables / Mixing in traits with variables
    • as classes / Traits as classes
    • classes, extending / Extending classes
    • extending / Extending traits
    • testing / Testing traits
    • class, using / Using a class
    • mixing / Mixing the trait in
    • test class, mixing / Mixing into the test class
    • test cases, mixing / Mixing into the test cases
    • versus classes / Traits versus classes
  • type-safe builder / Using generalized type constraints
  • type class
    • design pattern / The type class design pattern
    • example / Type class example
    • design pattern alternatives / Type class design pattern alternatives
  • type class design pattern / The type class design pattern

U

  • unit testing / Unit testing

V

  • value object design pattern
    • about / The value object design pattern, The value object design pattern
    • example class diagram / An example class diagram
    • code example / A code example
    • alternative implementation / Alternative implementation
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • verbose / Immutable and verbose
  • visitor design pattern
    • about / The visitor design pattern, The visitor design pattern
    • example class diagram / Example class diagram
    • code example / Code example
    • with Scala / The visitor design pattern the Scala way
    • advantages / What it is good for
    • disadvantages / What it is not so good for
  • vocabulary / Abstraction and vocabulary

Z

  • zero monad
    • zero identity / The monad laws
    • reverse zero / The monad laws
    • commutativity / The monad laws
lock icon The rest of the chapter is locked
arrow left Previous Section
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images