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.
80% Royalties. Earn $16 on a $20 book.
We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earned$12,307,240writing, publishing and selling on Leanpub.
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, tablets, and 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
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.
Personal Finance
Jason AndersonThis textbook provides an in-depth analysis on personal finance that is both practical and straightforward in its approach. It has been written in such a way that the readers can gain knowledge without getting overwhelmed by the technical terms. Suitable for both beginners and advanced learners.
Getting to Know IntelliJ IDEA
Trisha Gee and Helen ScottIf we treat our IDE as a text editor, we are doing ourselves a disservice. Using a combination of tutorials and a questions-and-answers approach, Getting to Know IntelliJ IDEA will help you find ways to use IntelliJ IDEA that enable you to work comfortably and productively as a professional developer.
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:
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.
R Programming for Data Science
Roger D. PengThis book brings the fundamentals of R programming to you, using the same material developed as part of the industry-leading Johns Hopkins Data Science Specialization. The skills taught in this book will lay the foundation for you to begin your journey learning data science. Printed copies of this book are available through Lulu.
Machine Learning Q and AI
Sebastian Raschka, PhDHave you recently completed a machine learning or deep learning course and wondered what to learn next? With 30 questions and answers on key concepts in machine learning and AI, this book provides bite-sized bits of knowledge for your journey to becoming a machine learning expert.
Stats One
William FooteThe Rails 7 Way
Obie Fernandez, Lucas Dohmen, and Tom Henrik AadlandThe Rails™ 7 Way is the comprehensive, authoritative reference guide for professionals delivering production-quality code using modern Ruby on Rails. It illuminates the entire Rails 7 API, its most powerful idioms, design approaches, and libraries. Building on the previous editions, this edition has been heavily refactored and updated.
Gradual Modularization for Ruby and Rails
Stephan HagemannGet yourself a new tool to manage your Rails application and your growing engineering organization! Prevent the ball-of-mud (and fix it!). Go for microservices or SOA if it makes sense not just because you don't have any other tool. Do all this through a low-overhead tool: packages. Enable better conversations to make practical changes today.
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... - #3
1500 QUIZ COMMENTATI (3 libri)
3 Books
Tre libri dei QUIZ MMG Commentati al prezzo di DUE! I QUIZ dei concorsi ufficiali di Medicina Generale relativi agli anni: 2000-2001-2003-2012-2013-2014-2015-2016-2017-2018-2019-2020-2021 +100 inediti Raccolti in unico bundle per aiutarvi nello studio e nella preparazione al concorso. All'interno di ogni libro i quiz sono stati suddivisi per... - #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... - #5
Practical FP in Scala + Functional event-driven architecture
2 Books
Practical FP in Scala (A hands-on approach) & Functional event-driven architecture, aka FEDA, (Powered by Scala 3), together as a bundle! The content of PFP in Scala is a requirement to understand FEDA so why not take advantage of this bundle!? - #6
Modern C++ Collection
3 Books
Get All about Modern C++C++ Standard Library, including C++20Concurrency with Modern C++, including C++20C++20Each book has about 200 complete code examples. Updates are included. When I update one of the books, you immediately get the updated bundle. You can expect significant updates to each new C++ standard (C++23, C++26, .. ) and also... - #7
Linux Administration Complet
4 Books
Ce lot comprend les quatre volumes du Guide Linux Administration :Linux Administration, Volume 1, Administration fondamentale : Guide pratique de préparation aux examens de certification LPIC 1, Linux Essentials, RHCSA et LFCS. Administration fondamentale. Introduction à Linux. Le Shell. Traitement du texte. Arborescence de fichiers. Sécurité... - #9
Development and Deployment of Multiplayer Online Games, Part ARCH. Architecture (Vol. I-III)
3 Books
What's the Big Idea? The idea behind this book is to summarize the body of knowledge that already exists on multiplayer games but is not available in one single place.And quite a fewof the issues discussed within this series (planned as three nine volumes ~300 pages each), while known in the industry, have not been published at all (except for... - #10
Growing Agile: The Complete Coach's Guide
7 Books
Growing Agile: Coach's Guide Series This bundle provides a collection of training and workshop plans for a variety of agile topics. The series is aimed at agile coaches, trainers and ScrumMasters who often find themselves needing to help teams understand agile concepts. Each book in the series provides the plans, slides, handouts and activity...