Scala Programming Projects

Build real world projects using popular Scala frameworks like Play, Akka, and Spark
 
 
Packt Publishing
  • erschienen am 29. September 2018
  • |
  • 398 Seiten
 
E-Book | ePUB mit Adobe-DRM | Systemvoraussetzungen
978-1-78839-534-2 (ISBN)
 
Discover unique features and powerful capabilities of Scala Programming as you build projects in a wide range of domainsKey FeaturesDevelop a range of Scala projects from web applications to big data analysisLeverage full power of modern web programming using Play FrameworkBuild real-time data pipelines in Scala with a Bitcoin transaction analysis appBook DescriptionScala 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 problemsWhat you will learnBuild, test, and package code using Scala Build ToolDecompose code into functions, classes, and packages for maintainabilityImplement the functional programming capabilities of ScalaDevelop a simple CRUD REST API using the Play frameworkAccess a relational database using SlickDevelop a dynamic web UI using Scala.jsSource streaming data using Spark Streaming and write a Kafka producerUse Spark and Zeppelin to analyze dataWho this book is forIf 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.
  • Englisch
  • Birmingham
  • |
  • Großbritannien
  • 6,36 MB
978-1-78839-534-2 (9781788395342)
weitere Ausgaben werden ermittelt
Mikael Valot is Principal Software Engineer at IHS Markit in London, UK. He is the lead developer of a strategic market risk solution for banking regulation. He has over 15 years of experience in the financial industry of the UK, Switzerland, and France. He has a Diplome d'Ingenieur in Computing (equivalent to an M.Sc.) from Telecom Nancy, France. After years of working with Java, he started developing professionally with Scala in 2010, and never looked back. He was a speaker at Scala Exchange 2015. When he is not coding in Scala, Mikael likes to dabble with Haskell, the Robotic Operating System, and deep learning. He strongly believes that functional programming with strong typing is the best way to write safe and scalable programs. Nicolas Jorand is a senior developer. He worked for the finance industry for about 15 years before switching to the energy industry. He is a freelancer enjoying a partial time at Romande Energy, a Swiss utility company providing exclusively green electricity. Nicolas is a full-stack developer, playing with microcontrollers, developing standard web user and 3D interfaces on Unity, developing software to animate a humanoid robot (Nao) and finally, working with Scala on integration and backend software. All these projects are done with the same leitmotif; "In the dev process, get the issues as early as possible."
  • Cover
  • Title Page
  • Copyright and Credits
  • Packt Upsell
  • Contributors
  • Table of Contents
  • Preface
  • Chapter 1: Writing Your First Program
  • Setting up your environment
  • Installing the Java SDK
  • Installing IntelliJ IDEA
  • Using the basic features
  • SBT synchronization
  • Build
  • Running the Scala Console
  • Using the Scala Console and Worksheet
  • Using the Scala Console
  • Declaring variables
  • Types
  • Declaring and calling functions
  • Side effects
  • If...else expression
  • Class
  • Using the worksheet
  • Class inheritance
  • Subclass assignment
  • Overriding methods
  • Abstract class
  • Trait
  • Scala class hierarchy
  • Case class
  • Companion object
  • Creating my first project
  • Creating the project
  • Creating the Main object
  • Writing the first unit test
  • Implementing another feature
  • Implementing the Main method
  • Summary
  • Chapter 2: Developing a Retirement Calculator
  • Project overview
  • Calculating the future capital
  • Writing a unit test for the accumulation phase
  • Implementing futureCapital
  • Refactoring the production code
  • Writing a test for the decumulation phase
  • Simulating a retirement plan
  • Writing a failing unit test
  • Working with tuples
  • Implementing simulatePlan
  • Calculating when you can retire
  • Writing a failing test for nbOfMonthsSaving
  • Writing the function body
  • Understanding tail-recursion
  • Ensuring termination
  • Using market rates
  • Defining an algebraic data type
  • Filtering returns for a specific period
  • Pattern matching
  • Refactoring simulatePlan
  • Loading market data
  • Writing the unit test using the column selection mode
  • Loading the file with Source
  • Loading inflation data
  • Computing real returns
  • Packaging the application
  • Creating the App object
  • Packaging the application
  • Summary
  • Chapter 3: Handling Errors
  • Setup
  • Using exceptions
  • Throwing exceptions
  • Catching exceptions
  • Using the finally block
  • Ensuring referential transparency
  • Defining pure functions
  • Best practices
  • Showing how exceptions break referential transparency
  • Using Option
  • Manipulating instances of Option
  • Composing transformations with for... yield
  • Refactoring the retirement calculator to use Option
  • Using Either
  • Manipulating Either
  • Refactoring the retirement calculator to use Either
  • Refactoring nbOfMonthsSavings
  • Refactoring monthlyRate
  • Refactoring simulatePlan
  • Refactoring SimulatePlanApp
  • Using ValidatedNel
  • Adding the cats dependency
  • Introducing NonEmptyList
  • Introducing Validated
  • Refactoring the retirement calculator to use ValidatedNel
  • Adding unit tests
  • Implementing parsing functions
  • Implementing SimulatePlanApp.strSimulatePlan
  • Refactoring SimulatePlanApp.strMain
  • Summary
  • Questions
  • Further reading
  • Chapter 4: Advanced Features
  • Project setup
  • Strictness and laziness
  • Strict val
  • lazy val
  • By-name parameters
  • Lazy data structures
  • Covariance and contravariance
  • InvariantDecoder
  • CovariantDecoder
  • Contravariant encoder
  • Covariance in collections
  • Currying and partially applied functions
  • Function value
  • Currying
  • Partially applied functions
  • Implicits
  • Implicit parameters
  • Implicit parameter usage
  • Passing a timeout
  • Passing an application context
  • Examples in the SDK
  • breakOut
  • executionContext
  • Implicit conversion
  • Implicit class
  • How are implicits resolved?
  • Summary
  • Chapter 5: Type Classes
  • Understanding type classes
  • Type class recipe
  • Common type classes
  • scala.math.Ordering
  • org.scalactic.Equality
  • cats.Semigroup
  • Laws
  • Usage examples
  • cats.Monoid
  • Laws
  • Usage examples
  • Higher-kinded types
  • Arity
  • Higher-order function
  • Higher-kinded types
  • cats.Functor
  • Laws
  • Usage examples
  • cats.Apply
  • Laws
  • Usage examples
  • cats.Applicative
  • Laws
  • Usage examples
  • cats.Monad
  • Laws
  • Usage examples
  • Summary
  • Chapter 6: Online Shopping - Persistence
  • Creating the project
  • Persistence
  • Setting up Slick
  • Setting up the database
  • Database test
  • Product test
  • Cart test
  • Future
  • Getting a concrete value
  • Waiting on a Future
  • Callback
  • Composing Futures
  • Using for-comprehension
  • Execution context
  • Rounding up Futures
  • Database creation
  • Data Access Object creation
  • Running the test
  • Deploying the application
  • Setting up an account
  • Deploying your application
  • Heroku configuration
  • Summary
  • Chapter 7: Online Shopping - REST API
  • The REST API
  • Writing the tests
  • Defining the routes
  • Running the test
  • Checking the API
  • Implementing the API with persistence
  • Completing the product tests
  • Implementing the product API
  • Product list
  • Encoding JSON with Circe
  • Action definition
  • Adding a product
  • Completing the cart test
  • Logging in
  • Unit test
  • Implementation
  • Passing the cookie
  • Listing products in cart
  • Swagger
  • Installing Swagger
  • Declaring endpoints
  • Running the application
  • Login
  • List of products
  • Cart endpoints
  • Deploying on Heroku
  • Summary
  • Chapter 8: Online Shopping - User Interface
  • Learning objectives
  • Setting up
  • Defining the layout
  • Creating the layout
  • Building the page
  • Main layout
  • Product list panel
  • Cart panel
  • Introducing the UI manager
  • Adding jQuery to our project
  • Calling our API
  • Setting the main method
  • Initializing the user interface
  • Implementing UI actions
  • Adding a product to the cart
  • Removing a product from the cart
  • Updating the quantity
  • Deploying the user interface
  • Debugging the interface
  • Summary
  • Chapter 9: Interactive Browser
  • Actors
  • Setting up
  • Implementing the server side
  • Creating the web socket route
  • Implementing BrowserManager
  • Handling WebSocket
  • A diagram of Actors
  • Implementing the client side
  • Adding the web socket
  • Notifying the user
  • Extending jQuery
  • Summary
  • Chapter 10: Fetching and Persisting Bitcoin Market Data
  • Setting up the project
  • Understanding Apache Spark
  • RDD, DataFrame, and Dataset
  • Spark SQL
  • Dataframe
  • Dataset
  • Exploring the Spark API with the Scala console
  • Transforming rows using map
  • Transforming rows using select
  • Execution model
  • Implementing the transaction batch producer
  • Calling the Bitstamp REST API
  • Parsing the JSON response
  • Unit testing jsonToHttpTransaction
  • Implementing jsonToHttpTransaction
  • Unit testing httpToDomainTransactions
  • Implementing httpToDomainTransactions
  • Saving transactions
  • Introducing the Parquet format
  • Writing transactions in Parquet
  • Using the IO Monad
  • Putting it all together
  • Testing processOneBatch
  • Implementing processOneBatch
  • Implementing processRepeatedly
  • Implementing BatchProducerApp
  • Running the application with spark-submit
  • Installing Apache Spark
  • Packaging the assembly JAR
  • Running spark-submit
  • Summary
  • Chapter 11: Batch and Streaming Analytics
  • Introduction to Zeppelin
  • Installing Zeppelin
  • Starting Zeppelin
  • Testing Zeppelin
  • Structure of a notebook
  • Writing a paragraph
  • Drawing charts
  • Analyzing transactions with Zeppelin
  • Drawing our first chart
  • Drawing more charts
  • Introducing Apache Kafka
  • Topics, partitions, and offsets
  • Producing data into Kafka
  • Consuming data from Kafka
  • Consumer group
  • Offset management
  • Connecting to Kafka
  • Streaming transactions to Kafka
  • Subscribing with Pusher
  • Deserializing live transactions
  • Converting to transaction and serializing
  • Putting it all together
  • Running StreamingProducerApp
  • Introducing Spark Streaming
  • Analyzing streaming transactions with Zeppelin
  • Reading transactions from Kafka
  • Writing to an in-memory sink
  • Drawing a scatter chart
  • Aggregating streaming transactions
  • Summary
  • Other Books You May Enjoy
  • Index

Dateiformat: ePUB
Kopierschutz: Adobe-DRM (Digital Rights Management)

Systemvoraussetzungen:

Computer (Windows; MacOS X; Linux): Installieren Sie bereits vor dem Download die kostenlose Software Adobe Digital Editions (siehe E-Book Hilfe).

Tablet/Smartphone (Android; iOS): Installieren Sie bereits vor dem Download die kostenlose App Adobe Digital Editions (siehe E-Book Hilfe).

E-Book-Reader: Bookeen, Kobo, Pocketbook, Sony, Tolino u.v.a.m. (nicht Kindle)

Das Dateiformat ePUB ist sehr gut für Romane und Sachbücher geeignet - also für "fließenden" Text ohne komplexes Layout. Bei E-Readern oder Smartphones passt sich der Zeilen- und Seitenumbruch automatisch den kleinen Displays an. Mit Adobe-DRM wird hier ein "harter" Kopierschutz verwendet. Wenn die notwendigen Voraussetzungen nicht vorliegen, können Sie das E-Book leider nicht öffnen. Daher müssen Sie bereits vor dem Download Ihre Lese-Hardware vorbereiten.

Bitte beachten Sie bei der Verwendung der Lese-Software Adobe Digital Editions: wir empfehlen Ihnen unbedingt nach Installation der Lese-Software diese mit Ihrer persönlichen Adobe-ID zu autorisieren!

Weitere Informationen finden Sie in unserer E-Book Hilfe.


Download (sofort verfügbar)

44,99 €
inkl. 7% MwSt.
Download / Einzel-Lizenz
ePUB mit Adobe-DRM
siehe Systemvoraussetzungen
E-Book bestellen