Scala from Scratch: Exploration
Are you curious about functional programming, and why Scala is such a great fit for this paradigm? Is your team considering a switch to Scala? This book allows you to explore Scala from scratch. You'll get an overview of what it has to offer and a feeling for what it's like to code in Scala. You'll finish by developing a small command-line game.
About
About the Book
Scala from Scratch: Exploration is the first in a series of two books that teach you the Scala programming language. Readers that have some experience with an object-oriented or imperative language, like Java, Ruby, or Python, will get a comprehensive overview of what Scala brings to the table. The goal is to get you excited about Scala and give you a strong foundation for writing your first applications and continuing your journey. By the end of the book, you will have a good idea of what it's like to work with Scala, and you will have written a small, but complete command-line application based on a Functional Core, Imperative Shell architecture.
In this book you will learn about functional and object-oriented aspects of Scala. You will learn how to write expressive, intent-revealing code using pattern matching, functional sequence processing and for comprehensions, and how to design data types that enforce their business invariants in a functional way, without throwing exceptions. You will get a first glimpse at Scala's powerful type system and how to abstract over concrete types, and you will learn all there is to know about working with Option, Scala's approach at avoiding the million dollar mistake of null references.
If you are excited and want to continue your journey, you will be able to do with the upcoming second book in the series, Scala from Scratch: Understanding, which will go even deeper into the topics explored in this book and will discuss advanced language features and patterns.
Community Copies
If you're a member of a marginalised community and can't afford to buy this book, feel free to claim one of the free community copies. Copies are limited, but I will add more whenever someone donates one.
There in currently 1 community copy available.
Donating a copy
If you would like to support members of a marginalised community who can't afford the book, please consider donating a community copy by choosing the Donate a Community copy package.
Reviews
Have you read the book? I would be very grateful for reviews and ratings at the book's Goodreads page.
Categories
Feedback
Packages
Pick Your Package
All packages include the ebook in the following formats: PDF, EPUB, and Web
The Book
Minimum price
Suggested price$19.99$14.99
Donate a Community Copy
Minimum price
Suggested price$39.99Get the ebook and donate a free community copy. This can then be claimed by a member of a marginalised community who can currently not afford purchasing a copy of this book or someone who cannot pay for this book for other reasons.
$29.99
Author
About the Author
Daniel Westheide
Daniel Westheide is a software engineer living in Berlin, Germany. He is a senior consultant at INNOQ and co-organizer of ScalaBridge Berlin, the Berlin chapter of the ScalaBridge organization. He cares about empathy and inclusivity, and about the ethical, social, and ecological consequences of his work.
On his website, he discusses functional programming, architecture, as well as anything related to the software development process. He is not only interested in programming languages, but also a human language enthusiast. Moreover, he is passionate about specialty coffee, social science fiction, and tabletop roleplaying games.
Contents
Table of Contents
Credits
Preface
1.With a REPL yell
- 1.1What’s a REPL?
- 1.2Install fest
- 1.3Doing the math
- 1.4Greetings from Mr. Boole
- 1.5Values and variables
- 1.6The thin line between compile time and runtime
- 1.7Local type inference
- 1.8Calling methods
- 1.9Summary
2.Scala, the functional language
- 2.1The purely functional way
- 2.2More about writing functions
- 2.3If-expressions
- 2.4Functions as values
- 2.5Escaping the loop
- 2.6Summary
3.Scala, the object-oriented language
- 3.1Classes and objects
- 3.2Singleton objects
- 3.3Visibility modifiers
- 3.4Traits
- 3.5Everything is an object
- 3.6Am I equal? Yes I am!
- 3.7Summary
4.Scala, the expressive language
- 4.1Named and default arguments
- 4.2A first glance at pattern matching
- 4.3Case classes
- 4.4Tuples
- 4.5Processing sequences, the functional way
- 4.6More sugar with for comprehensions
- 4.7Type aliases
- 4.8No strings attached
- 4.9Summary
5.Tools for modular code
- 5.1Inner classes, objects, and traits
- 5.2Packages
- 5.3Imports
- 5.4Package-level visibility modifiers
- 5.5Package objects
- 5.6Summary
6.Bringing value to your classes
- 6.1Value classes
- 6.2Extension methods
- 6.3Summary
7.Scala type system 101
- 7.1Type constructors
- 7.2Polymorphic methods
- 7.3Polymorphic extension methods
- 7.4Summary
8.The strict brown fox jumps over the lazy dog
- 8.1By-name parameters
- 8.2Lazy values
- 8.3Summary
9.Know your options
- 9.1The basic idea
- 9.2Creating an option
- 9.3Working with optional values
- 9.4Options are collections
- 9.5For comprehensions
- 9.6Chaining options
- 9.7Purely functional data types
- 9.8Option in the standard library
- 9.9Summary
10.Putting it all together
- 10.1Talking to the product owner
- 10.2Architectural decisions
- 10.3Setting up the project
- 10.4The functional core
- 10.5The imperative shell
- 10.6Packaging the application
- 10.7Summary
11.Downtime
- 11.1Summary
- 11.2The road ahead
- 11.3Taking action
Contributor
About the Contributors
Ann-Marie Rechter
Ann-Marie is responsible for the cover illustration. She is a freelance illustrator and designer from Hamburg, Germany.
She regularly posts some of her artwork as illumarie_art on Instagram.
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earned over $14 million writing, 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) and 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
Write and Publish on Leanpub
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.