Praise for Programming Scala, Third Edition
Whether youre new to entirely Scala or making the two to three transition, Dean Wampler is the ideal traveling companion. Some Scala books make you feel like youre back in a classroom. This one makes you feel like youre pair-programming with a helpful expert by your side.
Seth Tisue, Senior Software Engineer, Scala Compiler Team, Lightbend Inc.
Dean leaves no question unanswered. Rather than telling you only what you need to know to produce working code, he takes an extra step and explains exactly: How is this feature implemented? Is there a more general idea behind it that can provide extra context? Reading this book will enable you to make new connections between concepts you couldnt connect before. Which is to say, youll learn something.
Lutz Huehnken, Chief Architect, Hamburg Sd, A Maersk Company
Dean has succeeded in giving a complete and comprehensive overview of the third major release of the Scala language by not only describing all the new features of the language, but also covering whats changed from Scala 2. Highly recommended for both newbies and experienced Scala 2 programmers!
Eric Loots, CTO, Lunatech
At his many Strata Data + AI talks and tutorials, Dean made the case for using Scala for data engineering, especially with tools such as Spark and Kafka. He captures his Scala expertise and practical advice here. "
Ben Lorica, Gradient Flow
Ive had the great pleasure of working with Dean in a few different roles over the past several years. He is ever the strong advocate for pragmatic, effective approaches for data engineeringespecially using Scala as the ideal programming language in that work. This book guides you through why Scala is so compelling and how to use it effectively.
Paco Nathan, Managing Partner at Derwen, Inc.
An excellent update to the earlier edition that will help developers understand how to harness the power of Scala 3 in a pragmatic and practical way.
Ramnivas Laddad, cofounder, Paya Labs, Inc.
Programming Scala
by Dean Wampler
Copyright 2021 Dean Wampler. All rights reserved.
Printed in the United States of America.
Published by OReilly Media, Inc. , 1005 Gravenstein Highway North, Sebastopol, CA 95472.
OReilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://oreilly.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com .
- Acquisitions Editor: Suzanne McQuade
- Development Editor: Michele Cronin
- Production Editor: Katherine Tozer
- Copyeditor: Sonia Saruba
- Proofreader: Athena Lakri
- Indexer: WordCo Indexing Services, Inc.
- Interior Designer: David Futato
- Cover Designer: Karen Montgomery
- Illustrator: Kate Dullea
Revision History for the Third Edition
- 2021-05-26: First Release
See http://oreilly.com/catalog/errata.csp?isbn=9781492077893 for release details.
The OReilly logo is a registered trademark of OReilly Media, Inc. Programming Scala, the cover image, and related trade dress are trademarks of OReilly Media, Inc.
The views expressed in this work are those of the author, and do not represent the publishers views. While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights.
978-1-492-07789-3
[LSI]
Dedication
To Peggy Williams Hammond, September 10, 1933May 11, 2018.
Dean
Foreword
Foreword, Third Edition
Forward-looking programming languages dont always make it. Yet Scala is not only surviving but thriving.Some languages never get commercial adoption at all. Those first few companies brave enough to bet their business on your language are hard to find. Other languages get their time in the commercial sun but dont manage to hang on, like Common Lisp and Smalltalk. They live on as influences, their genes still discernable in contemporary languages. Thats success of a kind, but not what the creators wanted.
Scala has been defying these trends for well over a decade now. Circa 2008, companies such as Twitter and Foursquare brought Scala out of academia and into the commercial world. Since then, the Scala job market and ecosystem have been sustained not only by independent enthusiasts but by superstar open source projects, such as Spark and Kafka, and companies like those on the Scala Centers advisory board, who collectively employ impressive numbers of Scala programmers.
Can Scala continue to pull it off? Its creator, Martin Odersky, thinks it can and I agree. Scala 3, launching in 2021, is a bold leap into the future of programming. Other languages will be playing catch-up for years to come.
And not for the first time, either. In the years since Scalas initial success, Java emerged from its long torpor with a parade of Scala-inspired language features. Swift and Rust also show Scalas influence. Direct competitors have appeared too. Kotlin remains a contender, while others, such as Ceylon, have already fallen by the wayside.
How much innovation is too much? How much is too little? Explorers must be bold but not foolhardy. Dangers lurk in new seas and on new lands, but youll never discover anything if you just stay home.
Scalas bet is that being a better Java isnt enough to meet programmers needsnot even if that better Java is Java itself. For one thing, competing with Java isnt enough anymore. If Scalas growth has leveled off somewhat in recent years, perhaps its because Javas has too, and because weve already converted all the Java programmers we can hope to convert. We need to show that Scala is also a more-than-worthy alternative to now-mainstream languages, like Python and TypeScript, and insurgent languages, like Rust and Haskell.
The big reason Scala still matters and is worth fighting for is that it fully embraces functional programming. Yes, its wonderful that Java has added lambdas and pattern matching, features that come from the functional tradition. But functional programming isnt just a bag of disconnected individual features. Its a paradigm shift, a fresh way of thinking. Learning Scala, or any functional language, makes you wonder how you ever programmed any other way.
Learning Scala doesnt mean forgetting everything you already know. Scala fuses the object-oriented and functional programming traditions into a single language youll never grow out of. And though Scala offers its own vibrant ecosystem of libraries, Scala programmers are also free to leverage vast worlds of Java and JavaScript.
The design of Scala 3 retains the same pragmatism that has been crucial to its success all along. My teammates and I at Lightbend, along with our colleagues at the Scala Center and in Martins lab, work hard to make migration to new versions smooth, even as we bring you a Christmas-mornings worth of new toys to play with.