Scala Web Services in 4 Hours
Published by Pearson
Build a Modern Web Service with Scala, Akka HTTP, and PostgreSQL
- Get hands-on experience building a modern, performant RESTful API server
- Improve your understanding of asynchronous programming in Scala with Futures
- Gain basic working knowledge of Akka HTTP, an advanced asynchronous HTTP server used in production by many leading companies
If you are familiar with Scala but use it for something other than web apps (for backend logic processes like Spark) or if you build web apps in other languages like Java or Python and are itching to learn how to do it in Scala, this course is for you. You will learn how to build a modern asynchronous RESTful API server using Akka HTTP and Scala—one of the most advanced tech stacks available today. We will start with a clean slate and end up with a functioning server ready to power a real-world Web application. You will learn key constituent concepts, like asynchronous programming with Futures, database access, test-driven development, etc. You will also gain a conceptual understanding of the actor concurrency model and Akka Actors.
What you’ll learn and how you can apply it
- Scala’s support for asynchronous programming with Futures
- The advantages of a high-level database access library like Slick
- How to build scalable Web services with Akka HTTP and the limits of single-server scalability
- The basics of the actor-based concurrency model and how our Web service could be made infinitely scalable with Akka actors
And you’ll be able to:
- Create an advanced Scala SBT project from scratch using a Giter8 template
- Program cooperating, asynchronous, lock-free processes with Scala Futures
- Manipulate relational data from a Scala program using Slick
- Build a simple, high-performing RESTful API server on top of Akka HTTP
- Develop unit tests that exercise API endpoints without building and deploying the server
This live event is for you because...
- You are a Scala programmer and are curious about building a performant API server.
- You have built Web services using some other tech stack and would like to check out an alternative that powers some of the highest-traffic sites on the web.
Prerequisites
- Working knowledge of Scala
- Experience developing concurrent software, ideally in the context of a web server
- Experience writing unit tests
- Working knowledge of SQL
Course Set-up
- An IDE of your choice
- Java JDK 11
- SBT https://www.scala-sbt.org/1.x/docs/Setup.html
- Code available here: https://github.com/iurisman/bookworms
Recommended Preparation
- Read: Scala for the Impatient, 3rd Edition by Cay Horstmann
- Read: Designing Web APIs by Brenda Jin et al
Recommended Follow-up
- Read: Learning Concurrent Programming in Scala, 2nd Edition by Aleksandar Prokopec
- Read: The Design of Web APIs by Arnaud Lauret
Schedule
The time frames are only estimates and may vary according to how the class is progressing.
Segment 1: Introduction (5 minutes)
- About the instructor
- About the course
- Q&A
Segment 2: Bootstrap the Akka HTTP Seed Application (20 minutes)
- Explain Giter8 templates
- Overview the seed application
- Demo the seed application
- Q&A
Segment 3: Side Trip #1 Akka Actors Overview (35 minutes)
- Actor concurrency model
- Akka Actors
- Revisit the Akka HTTP seed application
- Q&A
Segment 4: Introducing the Bookworms Demo Web Service (50 min)
- Inventory management for a used books store
- Explain the functionality of the Bookworms application
- Define the Bookworks database schema
- Define RESTful API endpoints
- Q&A
5 minute break
Segment 5: Create Scaffolding for the Bookworms API service (20 min)
- Create routes for the API endpoints
- Create unit tests for the routes
- Understand test-driven development
- Q&A
Segment 6: Add the Database Access Layer (20 min)
- Add the Postgres database to the project
- Create the database schema
- Define empty data access methods
- Q&A
Segment 7: Sidetrip #2: Slick RDBMS Access Library (20 min)
- Explain basic Slick concepts
- Hint at some more advanced Slick concepts
- Q&A
5 minute break
Segment 8: Finish Creating the Database Access Layer (20 min)
- Add Slick code to the data access method
- Add unit tests for the database access layer
- Q&A
Segment 9: Finish Building the Bookworms Application (30 min)
- Complete the HTTP routes
- Ensure that the unit tests pass
- Q&A
Segment 10: Course Wrapup (10 min)
- Quick recap of the material
- Give reference to the course materials on Github
- Give references to additional material
Your Instructor
Igor Urisman
Igor Urisman has over 25 years of experience working on several well-known products and services, such as Oracle RDBMS, Essbase OLAP database, ishares.com, and LendingClub. In recent years, while working on an open source A/B testing server, he made a clean break from Java to Scala—his fifth programming language. He finds Scala and its ecosystem equally productive and intellectually gratifying. Igor holds a MS degree in mathematics from Kharkiv State University in Ukraine. He is based in Berkeley, California.