Professional scala combine object-oriented and functional programming to build high-performance application
If your application source code is overly verbose, it can be a nightmare to maintain. Write concise and expressive, type-safe code in an environment that lets you build for the JVM, browser, and more. Key Features Expert guidance that shows you to efficiently use both object-oriented and functional...
Otros Autores: | , |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham ; Mumbai :
Packt
2018.
|
Edición: | 1st edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009630532606719 |
Tabla de Contenidos:
- Intro
- Preface
- Setting up the Development Environment
- Simple Program
- Definitions: Packages, Imports, and Objects
- Object Definition
- The main Method
- Inside main
- Structure of a Scala Project
- Basic sbt Commands
- Activity: Performing Basic Operations with sbt: Build, Run, Package
- IDE
- Activity: Loading and Running a Sample Project in the IDE
- REPL
- Obtaining the Time Request from Our Chatbot Program
- Base Syntax
- Base Syntax for Definitions
- Base Syntax for Expressions
- Unit Testing
- Adding a Test to Our Project
- Inside Tests
- Running Tests for Chatbot
- Summary
- Basic Language Features
- Objects, Classes, and Traits
- Object
- Classes
- Equality and Case Classes
- Pattern Matching
- Traits
- Self-Types
- Special Classes
- OO in Our Chatbot
- Decoupling Logic and Environment
- Sealed Traits and Algebraic Datatypes
- Function Calls
- Syntax Goodies
- Named Parameters
- Default Parameters
- Currying Forms (Multiple Argument Lists)
- Special Magic Methods
- Implementing + in CartesianPoint
- Parameter-Passing Mode
- By Value
- By Name
- By Need
- Creating a Runnable Construction
- Printing the log Argument to the Console and File
- Summary
- Functions
- Functions
- Function Values
- Function from an OO Point of View
- Conversions
- Defining and Measuring the Time of a Unit Function
- Syntax Sugar in a Function Definition
- Partial Functions
- Exploring Pattern Matching
- Binding a Sequence of Variables in the Pattern Matcher
- Partial Functions in Practice
- Representing ChatbotMode as a Partial Function
- Implementing RemindStore as a Set of Partial Functions
- Using Lifting for Conversations between Total and Partial Functions
- Summary
- Scala Collections
- Working with Lists
- Constructing Lists
- Operations on Lists
- Pattern Matching on Lists.
- First-Order Methods on List
- Appending and Concatenation
- Taking the Length of a List
- Reversing a List
- Prefixes and Suffixes
- Element Selection
- Display
- Activity: Creating a New Mode for Chatbot Using Lists
- Abstracting on Sequences
- The Traversable Trait
- Iterators
- Streams
- Activity: Implementing Fibonacci Series Using Streams and Iterators
- Other Collections
- Sets
- Tuples
- Maps
- Mutable and Immutable Collections
- Activity: Implementing the Tower of Hanoi Problem
- Summary
- Scala Type System
- Type Basics and Polymorphism
- A Unified Type System
- Parametric Polymorphism
- Type Inference
- Parameterized Types
- Bounds
- Existential Types
- Activity: Generalizing the Implementation of the Binary Tree
- Variance
- Covariance
- Contravariance
- Invariance
- Activity: Implementing Covariance and the Database for Tools
- Advanced Types
- Abstract Type Members
- Structural Types
- Option
- Higher Kind Types
- Type Erasure
- Activity: Finding an Element Based on a Given Predicate
- Summary
- Implicits
- Implicit Parameters and Implicit Conversions
- Implicit Parameters
- Implicit Conversions
- Implicit Resolution
- Activity: Creation of Extension Methods
- Ad Hoc Polymorphism and Type Classes
- Types of Polymorphism
- Type Classes
- Context Bounds and Implicitly
- Type Classes in the Standard Library
- Summary
- Functional Idioms
- Introduction to Functional Programming Concepts
- Pure Functions
- Immutability
- Implementing the standard library
- Higher-Order Functions
- Functional Design Patterns
- Monoids
- Using Monoids to Write Polymorphic Functions
- Functor
- Monads
- Popular Libraries
- Validating Data Using Cats
- Prerequisites for Using Cats
- Introduction to Cats
- Validating Data
- Validating Using Validated
- Communicating with Databases Using Doobie.
- Prerequisites for Doobie
- Doobie
- ConnectionIO
- Transactor
- Selecting Rows
- Querying Using Parameters
- Deleting, Inserting, and Updating Rows
- A Complete Example
- Activity: Adding Priority to the Todo List
- Summary
- Domain Specific Languages
- DSLs and Types of DSLs
- External DSLs
- Internal DSLs
- ScalaTest - A Popular DSL
- Adding ScalaTest to Your Project
- Overview of ScalaTest Styles
- Activity: Implementing ScalaTest Styles
- Language Features for Writing DSLs
- Flexible Syntax for Method Invocation
- By-Name Parameters
- Extension Methods and Value Classes
- Writing a Small DSL
- Modeling Test Cases
- DSL for TestCase
- Activity: Creating a DSL to Specify Assertions
- Beyond This Book
- Various Scala Libraries
- Akka
- Apache Spark
- Shapeless
- Uncovered Language Features
- Macros
- Def Macros
- Implicit Macros
- Quasiquotes
- Reflection
- Resources to Keep You Updated
- Scala Improvement Process
- Scala Times
- Summary
- Index.