Professional Scala - Janek Bogucki, Alessandro Lacava, Aliaksandr Bedrytski, Matthew De Detrich, Benjamin Neil

Professional Scala

Buch | Softcover
240 Seiten
2016
Wrox Press (Verlag)
978-1-119-26722-5 (ISBN)
48,69 inkl. MwSt
Professional Scala provides experienced programmers with fast track coverage aimed at supporting the use of Scala in professional production applications. Skipping over the basics and fundamentals of programming, the discussion launches directly into practical Scala topics with the most up–to–date coverage of the rapidly–expanding language and related tools. Scala bridges the gap between functional and object–oriented programming, and this book details that link with clear a discussion on both Java compatibility and the read–eval–print loop used in functional programming. You′ll learn the details of tooling for build and static analysis. You ll cover unit testing with ScalaTest, documentation with Scaladoc, how to handle concurrency, and much more as you build the in–demand skill set required to use Scala in a real–world production environment.


Java–compliant with functional programming properties, Scala′s popularity is growing quickly especially in the rapidly expanding areas of big data and cluster computing. This book explains everything professional programmers need to start using Scala and its main tools quickly and effectively.


Master Scala syntax, the SBT interactive build tool, and the REPL workflow




Explore functional design patterns, concurrency, and testing
Work effectively with Maven, Scaladoc, Scala.js, and more
Dive into the advanced type system
Find out about Scala.js


A working knowledge of Scala puts you in demand. As both the language and applications expand, so do the opportunities for experienced Scala programmers and many positions are going unfilled. Twitter, Comcast, Netflix, and other major enterprises across industries are using Scala every day, in a number of different applications and capacities. Professional Scala helps you update your skills quickly to start advancing your career.

Aliaksandr Bedrytski is a Big Data engineer at Worldline France. Janek Bogucki is a Co–Founder of Inferess Inc., and Principal Consultant (Scala and Data Science) at Combination One. Alessandro Lacava is a lead designer and developer who specializes in functional programming and Scala. Matthew de Detrich is a Software Engineer at Zalando. Benjamin Neil is a Full Stack Engineer at AppThis LLC. Visit us at wrox.com where you have access to free code samples, Programmer to Programmer forums, and discussions on the latest happenings in the industry from around the world.

INTRODUCTION xv
CHAPTER 1: LANGUAGE FEATURES 1


Static Types and Type Inference 2


Implicit Parameters, Conversions, and Their Resolution 3


Case Class, Tuples, and Case Object 5


Abstract Class, Traits, and Sealed 6


Pattern Matching 8


Statements Are Expressions 9


String Interpolation 9


Scala Collections, immutable and mutable 10


For Comprehension 12


Packages, Companion Objects, Package Objects, and Scoping 13


AnyVal, AnyRef, Any, and the Type Hierarchy 16


Summary 17


CHAPTER 2: FUNCTIONAL PROGRAMMING 19


Immutability 20


Pure Functions 22


Recursion 23


Higher–Order Functions 26


Core Collection Methods 27


Methods Returning a Collection 29


Methods Returning a Value 31


Currying and Partially Applied Functions 32


Null Handling (Option) 34


Strict versus Non–Strict Initialization 35


Summary 36


CHAPTER 3: JAVA COMPATIBILITY 37


Scala and Java Collections 37


Interfaces and Traits 40


Scala/Java Enumerations 42


Summary 43


CHAPTER 4: SIMPLE BUILD TOOL 45


Basic Usage 46


Project Structure 47


Single Project 47


Scopes 49


Custom Tasks 50


Dependencies 50


Resolvers 51


Advanced Usage 52


Advanced Dependencies 53


Testing in the Console 55


Release Management 56


Deploying to Sonatype 56


Packaging with SBT–Native–Packager 58


Creating a Docker Image 59


Common SBT Commands 60


Useful Plugins 61


Summary 62


CHAPTER 5: MAVEN 63


Getting Started with Maven and Scala 64


Introducing scala–maven–plugin 67


Adding Library Dependencies 70


Using the REPL 71


Getting Help 72


Running Tests 72


Joint Compilation with Java 74


Accelerating Compilation with Zinc 76


Summary 77


CHAPTER 6: SCALA STYLE/LINT 79


Scala with Style 79


Scaliform 81


Scapegoat 82


WartRemover 82


Scoverage 84


Summary 84


CHAPTER 7: TESTING 85


ScalaTest 86


Unit Tests 87


Integration Testing 87


Data–Driven Tests 88


Performance Testing 89


Acceptance Testing 90


Mocks 92


Load Testing 93


Summary 94


CHAPTER 8: DOCUMENTING YOUR CODE WITH SCALADOC 95


Why Document Your Code? 96


Revealing the Benefi ts 96


Bookending the Continuum 96


Choosing What to Document 96


Scaladoc Structure 97


Overall Layout 97


Index Pane 98


Content Pane 100


Invoking the Scaladoc Tool 106


Wiki Syntax 108


Formatting with Inline Wiki Syntax 108


Structuring with Block Elements 110


Linking 113


Locating Scaladoc 117


Tagging 117


Everyday Tagging 117


Tagging for Groups 123


Advanced Tagging 125


Invoking scaladoc: Additional Options 132


Integrating Scaladoc Creation with Your Project 133


Configuring Maven 133


Configuring SBT 134


Publishing Scaladoc 134


Tables and CSS 136


Summary 138


CHAPTER 9: TYPE SYSTEM 139


What Is a Type System? 140


Static versus Dynamic Typing 140


What Static Type Systems Are Good For 141


What Dynamic Type Systems Are Good For 141


Scala s Unified Type System 141


Value Classes 143


Polymorphism 145


Subtype Polymorphism 145


Parametric Polymorphism 146


Ad Hoc Polymorphism 146


Bounds 149


Context Bounds 149


Upper and Lower Bounds 150


Variance 151


Other Niceties 155


Self–Type Annotations 155


Self–Recursive Types 158


Abstract Type Members 159


Dynamic Programming 161


Structural Types 161


Dynamic Trait 162


Summary 164


CHAPTER 10: ADVANCED FUNCTIONAL PROGRAMMING 165


Higher–Kinded Types 165


Functional Design Patterns 167


Functor 167


Applicative Functor 170


Monad 172


Semigroup 173


Monoid 174


Summary 176


CHAPTER 11: CONCURRENCY 179


Synchronize/Atomic Variables 181


Future Composition 184


Parallel Collections 187


Reactive Streams 192


STM 195


Actors (Akka) 198


Spark 200


Summary 202


CHAPTER 12: SCALA.JS 205


Scala.js and Its Design 205


Getting Started: Scala.js with SBT 206


Scala.js Peculiarities 210


Webjars and Dealing with the Frontend Ecosytem 211


Summary 213


INDEX 215

Erscheinungsdatum
Sprache englisch
Maße 187 x 232 mm
Gewicht 414 g
Themenwelt Mathematik / Informatik Informatik Datenbanken
Mathematik / Informatik Informatik Netzwerke
Informatik Programmiersprachen / -werkzeuge Scala
Mathematik / Informatik Informatik Software Entwicklung
Informatik Weitere Themen Hardware
ISBN-10 1-119-26722-6 / 1119267226
ISBN-13 978-1-119-26722-5 / 9781119267225
Zustand Neuware
Haben Sie eine Frage zum Produkt?