Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn Scala Programming

You're reading from   Learn Scala Programming A comprehensive guide covering functional and reactive programming with Scala 2.13, Akka, and Lagom

Arrow left icon
Product type Paperback
Published in Oct 2018
Publisher Packt
ISBN-13 9781788836302
Length 498 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Slava Schmidt Slava Schmidt
Author Profile Icon Slava Schmidt
Slava Schmidt
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. An Introduction to Scala 2.13 FREE CHAPTER 2. Understanding Types in Scala 3. Deep Dive into Functions 4. Getting to Know Implicits and Type Classes 5. Property-Based Testing in Scala 6. Exploring Built-In Effects 7. Understanding Algebraic Structures 8. Dealing with Effects 9. Familiarizing Yourself with Basic Monads 10. A Look at Monad Transformers and Free Monad 11. An Introduction to the Akka and Actor Models 12. Building Reactive Applications with Akka Typed 13. Basics of Akka Streams 14. Project 1 - Building Microservices with Scala 15. Project 2 - Building Microservices with Lagom 16. Preparing the Environment and Running Code Samples 17. Assessments 18. Other Books You May Enjoy

What this book covers

Chapter 1, An Introduction to Scala 2.13, walks the reader through Scala 2.13. Apart from helping readers who are new to Scala, the book will help developers who are already familiar with Scala to start using the new version and give them the motivation to migrate.

Chapter 2, Understanding Types in Scala, transforms the reader into a type master. It starts by describing different ways to define types in Scala, as well as refreshing the reader's memory about type bindings, variance, and bounds. This foundation will establish a stable groundwork for explaining how types can be combined to form patterns and the situations in which these patterns are applicable.

Chapter 3, Deep Dive into Functions, starts out by going over the different ways of defining a function in Scala. Then, it will cover intermediate aspects, such as higher-order functions, polymorphism, and recursion. Finally, it will discuss advanced aspects, such as trampolining and the object-oriented nature of functions in Scala.

Chapter 4, Getting to Know Implicits and Type Classes, teaches parts of the language related to implicits, in particular, different types of implicits, the order of implicit scope resolution, and context bounds. Moving on, the chapter will explain machinery that facilitates the use of modern functional programming in Scala as we know it – type classes.

Chapter 5, Property-Based Testing in Scala, touches upon different ways to style Scala test code and use its facilities to test asynchronous and concurrent functionality. The reader will be taken through the concept of property-based testing and its practical applications in depth.

Chapter 6, Exploring Built-in Effects, covers built-in Scala effects, such as Option, Either, Try, and Future. It describes the scenarios in which it is appropriate to use one or, other abstraction and reveals the proper ways to do so. Most importantly, it helps the reader discover similarities between these seemingly different abstractions.

Chapter 7, Understanding Algebraic Structures, begins by identifying common patterns in combining data. It teaches you how these patterns are named and demonstrate how they can be implemented in Scala using type classes.

Chapter 8, Dealing with Effects, deals with effects the same way we dealt with algebraic structures in the previous chapter. First, the chapter provides motivation in the form of real use cases for effects, and describes why they are useful and even crucial. Then, it extends this intuition by providing a formal description. Finally, it walks the reader through the example implementation.

Chapter 9, Familiarizing Yourself with Basic Monads, continues consolidating abstract concepts by combining algebraic data types and effects defined in the two previous chapters into yet another powerful concept – monads. It explains why monads are necessary, describes monadic laws, and shows example implementations for a small number of essential monads and monad transformers.

Chapter 10, A Look at Monad Transformers and Free Monad, outlines the problems introduced by monad transformers. It explores a free monad and the possibilities they provide. Finally, it gives due attention to the new kid on the block – an IO monad.

Chapter 11, An Introduction to the Akka and Actor Models, outlines the need for and principles of event-based programming. It then demonstrates how to implement a simple actor-based application using classical Akka. Finally, we drop the most important Akka modules into the mix and help to understand various testing techniques.

Chapter 12, Building Reactive Applications with Akka Typed, reveals an alternative way to build reactive applications with Akka. It introduces Akka Typed, compares classical and typed approaches, and shows the reader how the latter reduces a developer's choices but increases type safety and simplifies reasoning concerning actor-based programs.

Chapter 13, Basics of Akka Streams, describes yet another way to structure reactive programs – reactive streams. It catalogs the basic building blocks of typical Akka Stream applications and discusses techniques for wiring them together. Toward the end, it covers the topics of error handling and testing.

Chapter 14, Project 1 - Building Microservices with Scala, covers two topics. First, it substantiates the need for microservices and describes their advantages and building principles. It also uncovers technical and organizational challenges related to the microservice-based approach. Second, it uses the knowledge the reader has gained from previous chapters to build two actual projects from scratch. Both projects represent simple microservices implementing, CRUD API with access to a database, validation, and data transformation. The first project will be based on knowledge obtained from first and second sections of the book. We will build a microservice using the open source functional programming libraries, http4s, and circe, for client API, monocle to demonstrate the use of optics, and doobie for database access. The second project will be built using reactive programming libraries and techniques covered in the third section of the book, Akka, and Akka HTTP. For database access, well use Lightbend Slick, while marshalling and unmarshalling will be done using Spray-JSON.

Chapter 15, Project 2 - Building Microservices with Lagom, goes into the details of the Lagom framework by discussing its philosophy, the way Lagom applications are structured, available APIs and how to use them, and the topics of running and deployment. This knowledge will be used by the reader to build a project where they will create an application from scratch and deploy an example Lagom application.

Appendix A, Preparing the Environment and Running Code Samples, provides detailed installation instructions for Java and SBT for all major platforms. It also contains useful suggestions about checking out accompanying code from the Github repository as well as working with SBT shell and Scala REPL.

lock icon The rest of the chapter is locked
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 $19.99/month. Cancel anytime
Banner background image