▶Book Description
Scala is a type-safe JVM language that incorporates object-oriented and functional programming (OOP and FP) aspects. This book gets you started with essentials of software development by guiding you through various aspects of Scala programming, helping you bridge the gap between learning and implementing. You will learn about the unique features of Scala through diverse applications and experience simple yet powerful approaches for software development.
Scala Programming Projects will help you build a number of applications, beginning with simple projects, such as a financial independence calculator, and advancing to other projects, such as a shopping application and a Bitcoin transaction analyzer. You will be able to use various Scala features, such as its OOP and FP capabilities, and learn how to write concise, reactive, and concurrent applications in a type-safe manner. You will also learn how to use top-notch libraries such as Akka and Play and integrate Scala apps with Kafka, Spark, and Zeppelin, along with deploying applications on a cloud platform.
By the end of the book, you will not only know the ins and outs of Scala, but you will also be able to apply it to solve a variety of real-world problems
▶What You Will Learn
⦁ Build, test, and package code using Scala Build Tool
⦁ Decompose code into functions, classes, and packages for maintainability
⦁ Implement the functional programming capabilities of Scala
⦁ Develop a simple CRUD REST API using the Play framework
⦁ Access a relational database using Slick
⦁ Develop a dynamic web UI using Scala.js
⦁ Source streaming data using Spark Streaming and write a Kafka producer
⦁ Use Spark and Zeppelin to analyze data
▶Key Features
⦁ Develop a range of Scala projects from web applications to big data analysis
⦁ Leverage full power of modern web programming using Play Framework
⦁ Build real-time data pipelines in Scala with a Bitcoin transaction analysis app
▶Who This Book Is For
If you are an amateur programmer who wishes to learn how to use Scala, this book is for you. Knowledge of Java will be beneficial, but not necessary, to understand the concepts covered in this book.
▶What this book covers
⦁ Chapter 1, Writing Your First Program, explains how to set up your environment to start programming in Scala, covering the basic tools that are required and what the simplest Scala application might look like.
⦁ Chapter 2, Developing a Retirement Calculator, puts into practice the features of the Scala language seen in the first chapter. We will also introduce other elements of the Scala language and SDK to develop the model and logic for a retirement calculator. This calculator will help people work out how long they'll need to save and how much they'll need to save to have a comfortable retirement.
⦁ Chapter 3, Handling Errors, has you continuing to work on the retirement calculator from the previous chapter, handling the errors that riddle it. For instance, the calculator works correctly as long as the right arguments are passed to it but fails badly with a horrible stack trace if any of the parameters are wrong.
⦁ Chapter 4, Advanced Features, explores the more advanced features of Scala. As with any programming language, some advanced constructs might be seldom used in practice or can obfuscate code. We will aim to only explain features that we have encountered in real projects that have been deployed to production.
⦁ Chapter 5, Type Classes, you will learn what a type class is, what are the most common type classes in the cats library, and how to use them in your projects.
⦁ Chapter 6, Online Shopping – Persistence, explains how to persist data in a relational database. The data will be the contents of a cart for a shopping website.
⦁ Chapter 7, Online Shopping – REST API, covers how to develop a REST API using Play Framework. API is an acronym for Application Programming Interface, and the acronym REST stands for Representational State Transfer. Basically, we will provide an interface for our application, so that other programs can interact with it.
⦁ Chapter 8, Online Shopping – User Interface, gets you using Scala.js to build the user interface for the online shopping application. In this interface, you will be able to select a product to add to your cart, update the number of products that you wish to buy, and remove them from the cart if needed.
⦁ Chapter 9, Interactive Browser, introduces the actor model by extending our shopping project. The extension will consist of a notification, provided to anyone connected to the website, about who is adding/removing a product to/from the cart.
⦁ Chapter 10, Fetching and Persisting Bitcoin Market Data, look at developing a data pipeline to fetch, store, and analyze Bitcoin transaction data. We will use Apache Spark in batch mode to do so.
⦁ Chapter 11, Batch and Streaming Analytics, focuses on how to use Zeppelin and Spark to query our historical data store. We will use Zeppelin's capability to plot interesting graphs and Apache Kafka with Spark streaming to analyze live transactions.