front matter
Preface
When I first heard of Scala almost 10 years ago, I was immediately intrigued: a language that combines object-oriented programming (OOP) with functional programming (FP) sounded very interesting! And of course, at the time, I had no idea of what FP really meant or why I should care about it. When I decided to give this new language a try, I was lucky enough to work with great mentors who guided me in the learning process.
As I was learning new features of the language, I decided to start writing down my discoveries to further cement my understanding of them. After one or two months, I started writing my blog. My original motivation was to force myself to keep studying and improving my skills, but I soon realized that other people were finding my blog posts useful. In particular, readers of my blog enjoyed my writings because they were tackling practical problems that were explained with simple terms and that avoided unnecessary complexity.
Around the same time, I also started engaging with the Scala community by attending conferences and local meetups. By talking to fellow developers, I have recognized a similar pattern: folks were really intrigued by the language but surprised by a steep learning curve that was daunting for many newcomers due to the amount of complex and technical concepts that were assumed as common knowledge. Within six months, somebody nudged me into giving a presentation about a Scala library called Akka. When delivering the presentation, I decided that the best course of action was to offer my insights in a beginner-friendly fashionhelping several developers learn Scala one-on-one and sharing my knowledge of the Scala language and ecosystem in talks and workshops for beginners.
This book distills what I have learned about Scala and FP over the years and applies the lessons learned while teaching it to newcomers, trying to present the topic in a simple and accessible way so that you can learn the basics in a quick and pragmatic manner.
Learning new technologies can be overwhelming and intimidating, but it doesnt have to be. I hope this book will make you fall in love with Scala, a powerful yet approachable language that can be fun and increase your productivity at the same time.
Acknowledgments
This book has been the most exciting and ambitious challenge of my career so far, and it would have not been possible without the constant help and support of many people.
Id like to show my gratitude to the reviewers and the MEAP readers: your invaluable feedback has made this book much better.
Thanks to the Manning team, for their guidance and mentoring, particularly to Rebecca Rinehart, Michael Stephens, and Bert Bates for their precious advice during development of this book. Special thanks also go to my development editor, Katherine Olstein, for helping me continue focusing on its progress and get to the finishing line. Id also like to thank my technical development editor, Arthur Zubarev, for his enthusiastic encouragement and my technical proofreader, Jean-Franois Morin, for his invaluable and detailed feedback.
To all the reviewers: Andrew Jennings, Anto Aravinth, Bonnie Malec, Chad Davis, Damian Esteban, Dan Sheikh, David Clements, Dr. Davide Cadamuro, Edward G. Prentice, Emanuele Origgi, Evyatar Kafkafi, George Onofrei, George Thomas, Igor Karp, Jeff Smith, Jens Christian, B. Madsen, Jon Guenther, Kai Gellien, Kelvin Johnson, Kevin Orr, Michelle Williamson, Mike Jensen, Rambabu Posa, Ronald Tischliar, Sam Zaydel, Sanket Naik, Scott Dierbeck, William Wheeler, and Yvan Phelizot, your suggestions helped make this a better book.
Id like to show my gratitude to my mentors and colleagues, particularly to Bruno Filippone for introducing me to Scala, and ScalaItaly for inviting me to speak at a conference for the first time. Thanks to the Scala Community for your engagement and appreciation of this project and the Scala Center, particularly to Darja Jovanovic for her enthusiasm and support. Thanks to Professor Martin Odersky for creating such a beautiful language and for his invaluable feedback.
Last but surely not least, thanks to my life partner, Marco, for his unconditional support during every stage of this book and for encouraging me during the countless nights and weekends spent writing this book.
About this book
Object-oriented programming (OOP) has been the mainstream programming paradigm for the past couple of decades. More recently, the growing need for handling concurrency and multi-core processing has encouraged developers to explore functional programming (FP) thanks to its concepts of immutability and purity, which allow you to safely share data and design applications that are composable and easy to test. We are currently in a transition period where developers are familiar with the OOP paradigm but would like to learn more about FP.