Come out and Play
Come out and Play
Webanwendungen schreiben mit Scala, Scala.js, Akka und dem Play Framework.
Über das Buch
Mit diesem Buch erfolgt ein praxisorientierter Einstieg in die Entwicklung größerer Webanwendungen mit dem Play Framwork, Scala, Akka und Scala.js.
Es wird vermittelt, wie man Webanwendungen mit dem Play Framework schreibt, Datenbankzugriffe via Slick implementiert, Aufgaben asynchron mit Futures und Aktoren umsetzt sowie geteilten und clientseitigen Code via Scala.js generiert. Für Authorisierung und Authentifizierung wird das Silhoutte Framework genutzt. Websockets, die aus den meisten Anwendungen nicht mehr wegzudenken sind, kommen ebenfalls zum Einsatz.
Das Buch vermittelt, wie man SBT zur Verwaltung und Organisation von Projekten nutzt. Kenntnisse von Scala werden nicht vorausgesetzt, es erfolgt eine kurze Einführung in die Programmiersprache und die funktionale Programmierung mit Scala.
Für wen ist dieses Buch geeignet?
Das Buch richtet sich an alle, die sich für die Webentwicklung mit Scala und Play interessieren. Es sollte grundlegende Erfahrung in einer beliebigen Programmiersprache sowie Kenntnis von Webtechnologien vorhanden sein.
Welche Versionen werden genutzt?
Der Quelltext nutzt Scala 2.12, Play 2.6, Silhouette 5.0, Scala.js 0.6 sowie Cats 1.x. Ansonsten wird soweit möglich die jeweils aktuellste Version verwendeter Bibiliotheken genutzt.
Wo liegt der Code?
Das Repository mit dem Code zum Buch liegt in einem öffentlichen Repository bei GitLab: https://gitlab.com/comeoutandplay/code
Sonstiges
Wir haben ein Diskussionsforum zum Buch, das direkt bei Leanpub liegt: https://community.leanpub.com/c/comeoutandplay
Inhaltsverzeichnis
-
-
Vorwort
- Einleitung
-
Aufbau des Buches
- Konventionen für den Quelltext
- Schutzmarken und Copyrights
- Logos und Bilder
- Quelltext zum Buch
-
Vorwort
-
Einrichtung der Werkzeuge und Einführung in Scala
-
1 Werkzeuge
- 1.1 Java
-
1.2 SBT
- 1.2.1 Installation
- 1.2.2 Nützliches für SBT
- 1.3 Entwicklungsumgebung
-
2 Programmierung in Scala
- 2.1 Interaktive Programmierung via REPL
- 2.2 Hinweise zu Datenstrukturen (var, val)
-
2.3 Schnelleinstieg in die funktionale Programmierung
- 2.3.1 Auswertungsstrategien (evaluation strategies)
- 2.3.2 Scopes und Blöcke
- 2.3.3 Semikolons und Infix-Operatoren
- 2.3.4 Tail-Rekursion
- 2.3.5 Funktionen höherer Ordnung (Higher Order Functions)
- 2.3.6 Currying
- 2.3.7 Polymorphismus
- 2.3.8 Pattern-Matching
- 2.3.9 Implizite Parameter
- 2.4 Hilfsmittel zur Unterstützung
- 2.5 Reduzierung von “Boilerplate” Code
-
1 Werkzeuge
-
Einführung und Grundlagen zu den verwendeten Technologien
-
3 Play Framework
-
3.1 Erstellen einer Play Anwendung
- 3.1.1 Play Anwendung über Schablonen erstellen
- 3.1.2 Play Anwendung von Hand erstellen
-
3.2 Projektstruktur
- 3.2.1 Verzeichnisse, SBT-Einstellungen und Abhängigkeiten
- 3.2.2 Unterprojekte
-
3.3 Requests, Routing und Controller
- 3.3.1 Requests
- 3.3.2 Routing
- 3.3.3 Controller
-
3.4 Templates (Twirl)
- 3.4.1 Wiederverwendung von Templates
-
3.5 Mehrsprachigkeit (Internationalisierung)
- 3.5.1 Messages Objekt
-
3.6 Formulare
- 3.6.1 Formdefinition
- 3.6.2 Form-Objekte und ihre Typen
- 3.6.3 Beispiele für Formulare
- 3.6.4 Verarbeitung von Formularen
- 3.6.5 Formulardarstellung in Template View
- 3.6.6 Beispiel mit sich wiederholenden Elementen
-
3.7 Datenbankkonfiguration
- 3.7.1 Konfiguration von Slick für Play
- 3.8 Datenbankzugriff
-
3.9 Asynchrone Programmierung mit Play
- 3.9.1 Websockets
- 3.10 Webservices
-
3.11 Migration von Play 2.5 auf 2.6
- 3.11.1 Was hat sich geändert
- 3.11.2 SBT 0.13.15 erforderlich
-
3.11.3
Guice
undOpenId
Unterstützung ausgelagert -
3.11.4 Bereitstellung neuer
Controller
Klassen - 3.11.5 Assets
- 3.11.6 Play WS
-
3.11.7 Anpassungen bei
i18n
- 3.11.8 Cache
-
3.11.9 Veränderungen an der
Scala Configuration API
- 3.11.10 Entfernung diverser APIs und Bibliotheken
-
3.11.11
play.api.libs.concurrent.Execution
ist nun veraltet -
3.11.12 Neue
Standardfilter
- 3.12 Konfiguration von Ehcache
- 3.13 Ausführen mit IntelliJ IDEA und Debuggen
-
3.1 Erstellen einer Play Anwendung
-
4 Akka
- 4.1 Einrichten einer Akka Anwendung
-
4.2 Akka Grundlagen
- 4.2.1 Aktorsystem und Aktoren
- 4.2.2 Supervision
- 4.2.3 Aktorreferenzen
- 4.2.4 Nachrichten und deren Auslieferung
- 4.2.5 Konfiguration
-
4.3 Aktoren
- 4.3.1 DeathWatch
- 4.3.2 Nachrichten
- 4.3.3 Aktoren beenden
- 4.3.4 FSM
- 4.3.5 Persistenz
- 4.3.6 Tests
-
4.4 Aktorenhilfsmittel
- 4.4.1 Event-Bus
- 4.4.2 Logging
- 4.4.3 Scheduler
- 4.4.4 Zeitdauer (Duration)
- 4.4.5 Unterbrecher (Circuit Breaker)
- 4.5 Streams
-
5 Scala.js
- 5.1 Erstellen einer Scala.js Anwendung
- 5.2 Abhängigkeiten
- 5.3 Module exportieren
- 5.4 Cross-Compile
- 5.5 Testen
-
3 Play Framework
-
Anwendungsszenario
- 6 Das Frontend
- 7 Das Online-Spiel
-
Das Frontend
- 8 Erstellung und Konfiguration einer Basis-Play-Anwendung
- 9 Einbindung von Silhouette als Authentifikations-Framework
-
10 Anmeldung der Nutzer am System
- 10.1 Konfiguration des Backend Store (PostgreSQL)
- 10.2 Definition des Nutzermodells
- 10.3 Erstellen einer Datenbank-Evolution
- 10.4 Tabellendefinition innerhalb der Anwendung
- 10.5 DAOs für den Zugriff auf die Nutzerdaten
- 10.6 Silhouette Konfiguration auf eigene DAOs umstellen
- 10.7 Konfiguration der Social-Provider
- 10.8 Funktionalität für das Löschen eines Accounts
-
11 Suchen und Verwalten von Freunden
- 11.1 Erweiterung des Nutzermodells um einen Nutzernamen
- 11.2 Registrierung der Nutzer mit Nutzernamen und E-Mail
- 11.3 Evolution und Tabellendefinitionen für Freundeslisten
- 11.4 Funktionalitäten für Freundeslisten in einem DAO
-
11.5 Erstellen von WebSockets zur dynamischen Interaktion
- 11.5.1 Erstellen des WebSocket auf Basis eines Actors
- 11.5.2 Controller als Endpunkt für das WebSocket
- 11.5.3 Verbinden der Action innerhalb des Routing
- 11.5.4 Erstellen von Funktionen innerhalb des Javascript, welche mit dem WebSocket zusammen arbeiten
- 11.6 Erweiterung des CSR für WebSockets
- 11.7 Visualisierung der Freundeslisten
- 11.8 Erweiterung der Views zur Übergabe von Skripten und CSS
-
12 Migration auf Play 2.6 und Silhouette 5
- 12.1 Upgrade der benötigten Abhängigkeiten
- 12.2 Anpassungen für das Upgrade von Silhouette
- 12.3 Änderungen im CustomPostgresDriver
- 12.4 Neue Controller-Klassen
- 12.5 Von WebJarAssets zu AssetsFinder
- 12.6 Anpassungen für die Änderungen in i18n
- 12.7 Impliziter ExecutionContext
- 12.8 Refactoring (Compiler-Warnungen)
-
Das Spiel
- 13 Regeln und Spielverlauf
-
14 Umsetzung
- 14.1 Grundlegende Datentypen
- 14.2 Operationen auf einem Spielstand
- 14.3 Operationen auf einem Spielfeld
- 14.4 Nutzung von Eq (Cats)
- 14.5 Datenbank (Repository)
- 14.6 Zeichnen von Spielfeldern im Client
-
14.7 Hilfsfunktionen
- 14.7.1 Websocket-URL berechnen
- 14.7.2 Feldgröße zum Zeichnen berechnen
- 14.7.3 Berechnen der Klickposition in einem Spielfeld
- 14.7.4 Logging
-
14.8 Spielvorbereitung (
Preparation
)- 14.8.1 Globale Variablen
- 14.8.2 Struktur der HTML-Datei
- 14.8.3 Funktionen
- 14.8.4 Websocket
- 14.8.5 Aufruf und Initialisierung
-
14.9 Spielablauf (
Game
)- 14.9.1 Globale Variablen
- 14.9.2 Struktur der HTML-Datei
- 14.9.3 Funktionen
- 14.9.4 Websocket
- 14.9.5 Aufruf und Initialisierung
-
15 Integration ins Frontend
-
15.1 Verzeichnisstruktur
- 15.1.1 Aktoren, Controller, DAO und Modelle
- 15.1.2 View-Templates
- 15.2 Datenbankschicht (Repository) als DAO
-
15.3 Websocket
- 15.3.1 Eine Websocket-Algebra
- 15.3.2 Komposition zum fertigen Websocket
-
15.4 Controller und Routing
- 15.4.1 Übersichtsseite
- 15.4.2 Spielerstellung
- 15.4.3 Löschen eines Spielstandes
- 15.4.4 Dem Spiel beitreten
- 15.4.5 Das Spiel
- 15.4.6 Spielvorbereitung
- 15.4.7 Websocket
- 15.5 Views
-
15.1 Verzeichnisstruktur
-
Deployment (Auslieferung)
- 16 Konfiguration für den Produktivbetrieb
- 17 Erstellen eines Artefakts mit allen Abhängigkeiten
-
18 Erstellen von Paketen für Debian
- 18.1 Systemstart-Skripte
-
19 Auslieferung zu einem Cloud Service
- 19.1 Deployment via Remote Repository
- 19.2 Deployment mittels des Plugins sbt-heroku
- 19.3 Datenbankzugriff bei Heroku
-
Erkenntnisse
-
20 Silhouette
- 20.1 Abhängigkeiten von anderen Bibliotheken
- 20.2 Aufwand durch inkompatible Änderungen
-
21 Circe
-
21.1 Erstellung von Codecs
- 21.1.1 Vollautomatische Ableitung
- 21.1.2 Halbautomatische Ableitung
- 21.1.3 Manuelle Implementierung
- 21.2 Geschwindigkeit des Compilers
- 21.3 Fehlerhäufigkeit
-
21.1 Erstellung von Codecs
-
WTFM - Write that fucking manual!
- Vorteile für bereits involvierte Entwickler
- Vorteile für neue Entwickler
- Danke
-
20 Silhouette
- Anmerkungen
Die bedingungslose Leanpub, Kein Risiko, 100% zufrieden Garantie
Innerhalb von 60 Tagen ab Kauf kannst du dein Geld zu 100% zurückverlangen, bei jedem Leanpub-Kauf, in nur zwei Klicks. Wir bearbeiten die Erstattungen manuell, daher dauert es ein paar Tage, bis der Betrag ankommt.
Lese die kompletten Bedingungen.
Do Well. Do Good.
Authors have earned$11,714,583writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Top Books
Recipes for Decoupling
Matthias NobackWrite software that survives
OpenIntro Statistics
David Diez, Christopher Barr, Mine Cetinkaya-Rundel, and OpenIntroA complete foundation for Statistics, also serving as a foundation for Data Science.
Leanpub revenue supports OpenIntro (US-based nonprofit) so we can provide free desk copies to teachers interested in using OpenIntro Statistics in the classroom and expand the project to support free textbooks in other subjects.
More resources: openintro.org.
C++20 - The Complete Guide
Nicolai M. JosuttisAll new language and library features of C++20 (for those who know previous C++ versions).
The book presents all new language and library features of C++20. Learn how this impacts day-to-day programming, to benefit in practice, to combine new features, and to avoid all new traps.
Buy early, pay less, free updates.
Other books:
CQRS by Example
Carlos Buenosvinos, Christian Soronellas, and Keyvan Akbary- Leverage your Software Architecture skills by learning everything about CQRS in detail with lots of examples
- Develop faster applications by applying CQRS and fostering Read Models and Projections
- Learn how to apply CQRS into a brownfield project from a pragmatic approach
Ansible for DevOps
Jeff GeerlingAnsible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
Maîtriser Apache JMeter
Philippe Mouawad, Bruno Demion (Milamber), and Antonio Gomes RodriguesToute la puissance d'Apache JMeter expliquée par ses commiteurs et utilisateurs experts. De l'intégration continue en passant par le Cloud, vous découvrirez comment intégrer JMeter à vos processus "Agile" et Devops.
If you're looking for the newer english version of this book, go to Master JMeter : From load testing to DevOps
Jetpack Compose internals
Jorge CastilloJetpack Compose is the future of Android UI. Master how it works internally and become a more efficient developer with it. You'll also find it valuable if you are not an Android dev. This book provides all the details to understand how the Compose compiler & runtime work, and how to create a client library using them.
The PowerShell Scripting and Toolmaking Book
Don Jones and Jeff HicksLearn the patterns, practices, and details of PowerShell Scripting and Toolmaking from the industry's two most recognized experts on the subject.
Mastering STM32 - Second Edition
Carmine NovielloWith more than 1200 microcontrollers, STM32 is probably the most complete ARM Cortex-M platform on the market. This book aims to be the most complete guide around introducing the reader to this exciting MCU portfolio from ST Microelectronics and its official CubeHAL and STM32CubeIDE development environment.
Introduction to Data Science
Rafael A IrizarryThe demand for skilled data science practitioners in industry, academia, and government is rapidly growing. This book introduces concepts from probability, statistical inference, linear regression and machine learning and R programming skills. Throughout the book we demonstrate how these can help you tackle real-world data analysis challenges.
Top Bundles
- #1
Software Architecture
2 Books
"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before... - #2
CCIE Service Provider Ultimate Study Bundle
2 Books
Piotr Jablonski, Lukasz Bromirski, and Nick Russo have joined forces to deliver the only CCIE Service Provider training resource you'll ever need. This bundle contains a detailed and challenging collection of workbook labs, plus an extensively detailed technical reference guide. All of us have earned the CCIE Service Provider certification... - #4
Pattern-Oriented Memory Forensics and Malware Detection
2 Books
This training bundle for security engineers and researchers, malware and memory forensics analysts includes two accelerated training courses for Windows memory dump analysis using WinDbg. It is also useful for technical support and escalation engineers who analyze memory dumps from complex software environments and need to check for possible... - #6
All the Books of The Medical Futurist
6 Books
We put together the most popular books from The Medical Futurist to provide a clear picture about the major trends shaping the future of medicine and healthcare. Digital health technologies, artificial intelligence, the future of 20 medical specialties, big pharma, data privacy, digital health investments and how technology giants such as Amazon...